From 741eabba1673a3ab9a902df816066a41d273162a Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sun, 14 Aug 2011 10:16:39 -0400 Subject: [PATCH] convert CheckOther::checkIncrementBoolean() to use the symbol database --- lib/checkother.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index bd118c63f..89ae20b54 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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); } }