MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / check

Method check

lib/checkuninitvar.cpp:110–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void 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
130void CheckUninitVarImpl::checkScope(const Scope* scope, const std::set<std::string> &arrayTypeDefs)
131{

Callers 1

runChecksMethod · 0.45

Calls 4

checkScopeFunction · 0.85
nextMethod · 0.80
variableMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected