convert CheckOther::checkIncrementBoolean() to use the symbol database

This commit is contained in:
Robert Reif 2011-08-14 10:16:39 -04:00
parent c2b32bcfe5
commit 741eabba16
1 changed files with 5 additions and 2 deletions

View File

@ -40,14 +40,17 @@ void CheckOther::checkIncrementBoolean()
if (!_settings->isEnabled("style"))
return;
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
{
if (Token::Match(tok, "%var% ++"))
{
if (tok->varId())
{
const Token *declTok = Token::findmatch(_tokenizer->tokens(), "bool %varid%", tok->varId());
if (declTok)
const Variable *var = symbolDatabase->getVariableFromVarId(tok->varId());
if (var && var->typeEndToken()->str() == "bool")
incrementBooleanError(tok);
}
}