Optimising: Tokenizer::setVarId when setting variable ids for struct/class members

This commit is contained in:
Daniel Marjamäki 2010-08-08 19:14:23 +02:00
parent 195b48e81f
commit 6a3befa720
1 changed files with 6 additions and 3 deletions

View File

@ -2875,11 +2875,14 @@ void Tokenizer::setVarId()
{
++_varId;
const std::string pattern(std::string("%varid% . ") + tok->strAt(2));
const std::string pattern(std::string(". ") + tok->strAt(2));
for (Token *tok2 = tok; tok2; tok2 = tok2->next())
{
if (Token::Match(tok2, pattern.c_str(), tok->varId()))
tok2->tokAt(2)->varId(_varId);
if (tok2->varId() == tok->varId())
{
if (Token::Match(tok2->next(), pattern.c_str()))
tok2->tokAt(2)->varId(_varId);
}
}
}
}