Improve varId and getVariableList filter, related to previous commit.

This commit is contained in:
Edoardo Prezioso 2011-12-30 18:13:42 +01:00
parent 8c68b811f3
commit 0d3bf5340d
2 changed files with 7 additions and 8 deletions

View File

@ -1484,6 +1484,12 @@ void Scope::getVariableList()
tok = tok->next(); tok = tok->next();
continue; continue;
} }
else if (Token::Match(tok, "using namespace| %type% ;")) {
tok = tok->tokAt(2);
continue;
}
// Search for start of statement.. // Search for start of statement..
else if (tok->previous() && !Token::Match(tok->previous(), ";|{|}|public:|protected:|private:")) else if (tok->previous() && !Token::Match(tok->previous(), ";|{|}|public:|protected:|private:"))
@ -1493,9 +1499,6 @@ void Scope::getVariableList()
else if (Token::Match(tok, "goto %var% ;")) { else if (Token::Match(tok, "goto %var% ;")) {
tok = tok->tokAt(2); tok = tok->tokAt(2);
continue; continue;
} else if (check->_tokenizer->isCSharp() && Token::Match(tok, "using %var% ;")) {
tok = tok->tokAt(2);
continue;
} }
tok = checkVariable(tok, varaccess); tok = checkVariable(tok, varaccess);

View File

@ -3655,15 +3655,11 @@ void Tokenizer::setVarId()
if (tok->str() == "unsigned") if (tok->str() == "unsigned")
tok = tok->next(); tok = tok->next();
if (Token::Match(tok, "using namespace %type% ;")) { if (Token::Match(tok, "using namespace| %type% ;")) {
tok = tok->next(); tok = tok->next();
continue; continue;
} }
if (tok->str() == "using") {
continue;
}
if (Token::Match(tok, "goto %any% ;")) if (Token::Match(tok, "goto %any% ;"))
continue; continue;