speed up checkio by caching commonly looked up stuff in the symbol database (#4266)

This commit is contained in:
Robert Reif 2012-10-21 09:05:01 +02:00 committed by Daniel Marjamäki
parent 0e100f7563
commit 9bc2a62c1e
1 changed files with 21 additions and 21 deletions

View File

@ -188,15 +188,16 @@ void CheckLeakAutoVar::check()
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
// Check function scopes
for (std::list<Scope>::const_iterator i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i) {
if (i->type == Scope::eFunction) {
const std::size_t functions = symbolDatabase->functionScopes.size();
for (std::size_t i = 0; i < functions; ++i) {
const Scope * scope = symbolDatabase->functionScopes[i];
// Empty variable info
VarInfo varInfo;
// Local variables that are known to be non-zero.
const std::set<unsigned int> notzero;
checkScope(i->classStart, &varInfo, notzero);
checkScope(scope->classStart, &varInfo, notzero);
varInfo.conditionalAlloc.clear();
@ -212,8 +213,7 @@ void CheckLeakAutoVar::check()
++it;
}
ret(i->classEnd, varInfo);
}
ret(scope->classEnd, varInfo);
}
}