speed up checkio by caching commonly looked up stuff in the symbol database (#4266)
This commit is contained in:
parent
0e100f7563
commit
9bc2a62c1e
|
@ -188,15 +188,16 @@ void CheckLeakAutoVar::check()
|
||||||
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
// Check function scopes
|
// Check function scopes
|
||||||
for (std::list<Scope>::const_iterator i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i) {
|
const std::size_t functions = symbolDatabase->functionScopes.size();
|
||||||
if (i->type == Scope::eFunction) {
|
for (std::size_t i = 0; i < functions; ++i) {
|
||||||
|
const Scope * scope = symbolDatabase->functionScopes[i];
|
||||||
// Empty variable info
|
// Empty variable info
|
||||||
VarInfo varInfo;
|
VarInfo varInfo;
|
||||||
|
|
||||||
// Local variables that are known to be non-zero.
|
// Local variables that are known to be non-zero.
|
||||||
const std::set<unsigned int> notzero;
|
const std::set<unsigned int> notzero;
|
||||||
|
|
||||||
checkScope(i->classStart, &varInfo, notzero);
|
checkScope(scope->classStart, &varInfo, notzero);
|
||||||
|
|
||||||
varInfo.conditionalAlloc.clear();
|
varInfo.conditionalAlloc.clear();
|
||||||
|
|
||||||
|
@ -212,8 +213,7 @@ void CheckLeakAutoVar::check()
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret(i->classEnd, varInfo);
|
ret(scope->classEnd, varInfo);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue