Tokenizer: refactoring; use Token::link() instead of loop
This commit is contained in:
parent
00909486ab
commit
210f2ab352
|
@ -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")) {
|
||||||
|
|
Loading…
Reference in New Issue