From cd2c0fd9c88d05b6365541add3ce20b251752ec1 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sun, 14 Aug 2011 10:21:07 -0400 Subject: [PATCH] convert CheckOther::checkSizeofForNumericParameter() 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 89ae20b54..edee091fd 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -230,6 +230,8 @@ void CheckOther::checkSizeofForNumericParameter() void CheckOther::checkSizeofForArrayParameter() { + const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase(); + for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { if (Token::Match(tok, "sizeof ( %var% )") || Token::Match(tok, "sizeof %var%")) @@ -241,9 +243,10 @@ void CheckOther::checkSizeofForArrayParameter() } if (tok->tokAt(tokIdx)->varId() > 0) { - const Token *declTok = Token::findmatch(_tokenizer->tokens(), "%varid%", tok->tokAt(tokIdx)->varId()); - if (declTok) + const Variable *var = symbolDatabase->getVariableFromVarId(tok->tokAt(tokIdx)->varId()); + if (var) { + const Token *declTok = var->nameToken(); if (Token::simpleMatch(declTok->next(), "[")) { declTok = declTok->next()->link();