Tokenizer: refactoring; use Token::link() instead of loop

This commit is contained in:
Daniel Marjamäki 2013-06-16 15:27:59 +02:00
parent 00909486ab
commit 210f2ab352
1 changed files with 2 additions and 14 deletions

View File

@ -3585,20 +3585,8 @@ void Tokenizer::removeMacrosInGlobalScope()
if (Token::Match(tok, "[;{}] %type%") && tok->next()->isUpperCaseName()) { if (Token::Match(tok, "[;{}] %type%") && tok->next()->isUpperCaseName()) {
const Token *tok2 = tok->tokAt(2); const Token *tok2 = tok->tokAt(2);
if (tok2 && tok2->str() == "(") { if (tok2 && tok2->str() == "(")
unsigned int par = 0; tok2 = tok2->link()->next();
for (; tok2; tok2 = tok2->next()) {
if (tok2->str() == "(")
++par;
else if (tok2->str() == ")") {
if (par <= 1)
break;
--par;
}
}
if (tok2 && tok2->str() == ")")
tok2 = tok2->next();
}
// remove unknown macros before namespace|class|struct|union // remove unknown macros before namespace|class|struct|union
if (Token::Match(tok2, "namespace|class|struct|union")) { if (Token::Match(tok2, "namespace|class|struct|union")) {