convert CheckOther::checkIncrementBoolean() to use the symbol database
This commit is contained in:
parent
c2b32bcfe5
commit
741eabba16
|
@ -40,14 +40,17 @@ void CheckOther::checkIncrementBoolean()
|
||||||
if (!_settings->isEnabled("style"))
|
if (!_settings->isEnabled("style"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
if (Token::Match(tok, "%var% ++"))
|
if (Token::Match(tok, "%var% ++"))
|
||||||
{
|
{
|
||||||
if (tok->varId())
|
if (tok->varId())
|
||||||
{
|
{
|
||||||
const Token *declTok = Token::findmatch(_tokenizer->tokens(), "bool %varid%", tok->varId());
|
const Variable *var = symbolDatabase->getVariableFromVarId(tok->varId());
|
||||||
if (declTok)
|
|
||||||
|
if (var && var->typeEndToken()->str() == "bool")
|
||||||
incrementBooleanError(tok);
|
incrementBooleanError(tok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue