Refactoring: Use symbol database to get variable type
This commit is contained in:
parent
ed11a9e3cb
commit
85daa26fdf
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue