| 108 | } |
| 109 | |
| 110 | void CheckUninitVarImpl::check() |
| 111 | { |
| 112 | logChecker("CheckUninitVar::check"); |
| 113 | |
| 114 | const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase(); |
| 115 | |
| 116 | std::set<std::string> arrayTypeDefs; |
| 117 | for (const Token *tok = mTokenizer->tokens(); tok; tok = tok->next()) { |
| 118 | if (Token::Match(tok, "%name% [") && tok->variable() && Token::Match(tok->variable()->typeStartToken(), "%type% %var% ;")) |
| 119 | arrayTypeDefs.insert(tok->variable()->typeStartToken()->str()); |
| 120 | } |
| 121 | |
| 122 | // check every executable scope |
| 123 | for (const Scope &scope : symbolDatabase->scopeList) { |
| 124 | if (scope.isExecutable()) { |
| 125 | checkScope(&scope, arrayTypeDefs); |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | void CheckUninitVarImpl::checkScope(const Scope* scope, const std::set<std::string> &arrayTypeDefs) |
| 131 | { |
no test coverage detected