| 186 | } |
| 187 | |
| 188 | static bool variableIsUsedInScope(const Token* start, nonneg int varId, const Scope *scope) |
| 189 | { |
| 190 | if (!start) // Ticket #5024 |
| 191 | return false; |
| 192 | |
| 193 | for (const Token *tok = start; tok && tok != scope->bodyEnd; tok = tok->next()) { |
| 194 | if (tok->varId() == varId) |
| 195 | return true; |
| 196 | const ScopeType scopeType = tok->scope()->type; |
| 197 | if (scopeType == ScopeType::eFor || scopeType == ScopeType::eDo || scopeType == ScopeType::eWhile) // In case of loops, better checking would be necessary |
| 198 | return true; |
| 199 | if (Token::simpleMatch(tok, "asm (")) |
| 200 | return true; |
| 201 | } |
| 202 | return false; |
| 203 | } |
| 204 | |
| 205 | void CheckAutoVariablesImpl::assignFunctionArg() |
| 206 | { |
no test coverage detected