Merge pull request #736 from Dmitry-Me/cacheAndReuse4

Cache and reuse result of expensive operation
This commit is contained in:
PKEuS 2015-12-22 15:06:33 +01:00
commit 590f925d54
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();