| 74 | } |
| 75 | |
| 76 | static bool isAutoVar(const Token *tok) |
| 77 | { |
| 78 | const Variable *var = tok->variable(); |
| 79 | |
| 80 | if (!var || !var->isLocal() || var->isStatic()) |
| 81 | return false; |
| 82 | |
| 83 | if (var->isReference()) { |
| 84 | // address of reference variable can be taken if the address |
| 85 | // of the variable it points at is not a auto-var |
| 86 | // TODO: check what the reference variable references. |
| 87 | return false; |
| 88 | } |
| 89 | |
| 90 | if (Token::Match(tok, "%name% .|::")) { |
| 91 | do { |
| 92 | tok = tok->tokAt(2); |
| 93 | } while (Token::Match(tok, "%name% .|::")); |
| 94 | if (Token::Match(tok, "%name% (")) |
| 95 | return false; |
| 96 | if (tok->variable() && tok->variable()->isPointer()) |
| 97 | return false; |
| 98 | } |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | static bool isAutoVarArray(const Token *tok) |
| 103 | { |
no test coverage detected