Refactoring: Use symbol database to get variable type

This commit is contained in:
Daniel Marjamäki 2011-03-13 08:48:38 +01:00
parent ed11a9e3cb
commit 85daa26fdf
1 changed files with 5 additions and 4 deletions

View File

@ -100,10 +100,11 @@ void CheckStl::iterators()
// skip error message if container is a set.. // skip error message if container is a set..
if (tok2->varId() > 0) if (tok2->varId() > 0)
{ {
const Token *decltok = Token::findmatch(_tokenizer->tokens(), "%varid%", tok2->varId()); const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
while (decltok && !Token::Match(decltok, "[;{},(]")) const Variable *variableInfo = symbolDatabase->getVariableFromVarId(tok2->varId());
decltok = decltok->previous(); const Token *decltok = variableInfo ? variableInfo->typeStartToken() : NULL;
if (Token::Match(decltok, "%any% const| std :: set"))
if (Token::Match(decltok, "const| std :: set"))
continue; // No warning continue; // No warning
} }