Cache and reuse result of expensive operation

This commit is contained in:
Dmitry-Me 2015-12-22 14:03:45 +03:00
parent 31171f038a
commit 398da8ea7c
1 changed files with 3 additions and 3 deletions

View File

@ -37,6 +37,7 @@ CheckUnusedFunctions CheckUnusedFunctions::instance;
void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char FileName[], const Settings *settings) void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char FileName[], const Settings *settings)
{ {
const bool doMarkup = settings->library.markupFile(FileName);
const SymbolDatabase* symbolDatabase = tokenizer.getSymbolDatabase(); const SymbolDatabase* symbolDatabase = tokenizer.getSymbolDatabase();
// Function declarations.. // Function declarations..
@ -103,7 +104,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
} }
} }
if (!settings->library.markupFile(FileName) // only check source files if (!doMarkup // only check source files
&& settings->library.isexporter(tok->str()) && tok->next() != 0) { && settings->library.isexporter(tok->str()) && tok->next() != 0) {
const Token * propToken = tok->next(); const Token * propToken = tok->next();
while (propToken && propToken->str() != ")") { while (propToken && propToken->str() != ")") {
@ -125,8 +126,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
} }
} }
if (settings->library.markupFile(FileName) if (doMarkup && settings->library.isimporter(FileName, tok->str()) && tok->next()) {
&& settings->library.isimporter(FileName, tok->str()) && tok->next()) {
const Token * propToken = tok->next(); const Token * propToken = tok->next();
if (propToken->next()) { if (propToken->next()) {
propToken = propToken->next(); propToken = propToken->next();