Tokenizer::setVarIdNew: Better C++ handling (varidclass5 and varidclass13)

This commit is contained in:
Daniel Marjamäki 2012-04-21 13:11:30 +02:00
parent 1492d8990f
commit 85b470c41b
2 changed files with 4 additions and 2 deletions

View File

@ -43,7 +43,7 @@ bugs that the compilers normally do not detect. The goal is to detect only real
errors in the code (i.e. have zero false positives).</p>
<h2>Download</h2>
<p><a class="downloadnow" href="http://downloads.sourceforge.net/cppcheck/cppcheck-1.53-x86-setup.msi"><strong>Download Now!</strong> <em>Version 1.53 for Windows</em></a></p>
<p><a class="downloadnow" href="http://sourceforge.net/projects/cppcheck/files/cppcheck/1.54/cppcheck-1.54-x86-Setup.msi"><strong>Download Now!</strong> <em>Version 1.54 for Windows</em></a></p>
<p>You can download the standalone Cppcheck from our
<a href="http://sourceforge.net/projects/cppcheck/">project page</a> or add it
as a plugin for your favorite IDE:</p>

View File

@ -2856,6 +2856,8 @@ static void setVarIdClassDeclaration(Token * const startToken, const std::map<st
// replace varids..
for (Token *tok = startToken; tok != endToken; tok = tok->next()) {
if (tok->isName() && tok->varId() <= scopeStartVarId) {
if (tok->previous()->str() == "::" || tok->next()->str() == "::")
continue;
const std::map<std::string, unsigned int>::const_iterator it = variableId.find(tok->str());
if (it != variableId.end()) {
tok->varId(it->second);
@ -2931,7 +2933,7 @@ void Tokenizer::setVarIdNew()
// Variable declaration can't start with "return", etc
if (tok2->str() == "return" || tok2->str() == "NOT" || tok2->str() == "goto" ||
(!isC() && (tok2->str() == "delete" || tok2->str() == "friend" || tok2->str() == "throw" || tok2->str() == "using" || tok2->str() == "virtual")))
(!isC() && (tok2->str() == "delete" || tok2->str() == "friend" || tok2->str() == "new" || tok2->str() == "throw" || tok2->str() == "using" || tok2->str() == "virtual")))
continue;
const bool decl = setVarIdParseDeclaration(&tok2, variableId, executableScope.top());