Tokenizer::setVarIdNew: Better C++ handling (varidclass5 and varidclass13)
This commit is contained in:
parent
1492d8990f
commit
85b470c41b
|
@ -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>
|
errors in the code (i.e. have zero false positives).</p>
|
||||||
|
|
||||||
<h2>Download</h2>
|
<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
|
<p>You can download the standalone Cppcheck from our
|
||||||
<a href="http://sourceforge.net/projects/cppcheck/">project page</a> or add it
|
<a href="http://sourceforge.net/projects/cppcheck/">project page</a> or add it
|
||||||
as a plugin for your favorite IDE:</p>
|
as a plugin for your favorite IDE:</p>
|
||||||
|
|
|
@ -2856,6 +2856,8 @@ static void setVarIdClassDeclaration(Token * const startToken, const std::map<st
|
||||||
// replace varids..
|
// replace varids..
|
||||||
for (Token *tok = startToken; tok != endToken; tok = tok->next()) {
|
for (Token *tok = startToken; tok != endToken; tok = tok->next()) {
|
||||||
if (tok->isName() && tok->varId() <= scopeStartVarId) {
|
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());
|
const std::map<std::string, unsigned int>::const_iterator it = variableId.find(tok->str());
|
||||||
if (it != variableId.end()) {
|
if (it != variableId.end()) {
|
||||||
tok->varId(it->second);
|
tok->varId(it->second);
|
||||||
|
@ -2931,7 +2933,7 @@ void Tokenizer::setVarIdNew()
|
||||||
|
|
||||||
// Variable declaration can't start with "return", etc
|
// Variable declaration can't start with "return", etc
|
||||||
if (tok2->str() == "return" || tok2->str() == "NOT" || tok2->str() == "goto" ||
|
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;
|
continue;
|
||||||
|
|
||||||
const bool decl = setVarIdParseDeclaration(&tok2, variableId, executableScope.top());
|
const bool decl = setVarIdParseDeclaration(&tok2, variableId, executableScope.top());
|
||||||
|
|
Loading…
Reference in New Issue