Rewrite Tokenizer::hasEnumsWithTypedef by using 'findmatch' in order to shorten the code.
This commit is contained in:
parent
6a0c463ebd
commit
d0a3560c92
|
@ -2529,13 +2529,11 @@ bool Tokenizer::hasEnumsWithTypedef()
|
|||
{
|
||||
for (const Token *tok = _tokens; tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "enum %var% {")) {
|
||||
for (const Token *tok2 = tok->tokAt(3); tok2; tok2 = tok2->next()) {
|
||||
if (tok2->str() == "typedef") {
|
||||
syntaxError(tok2);
|
||||
return true;
|
||||
} else if (tok2->str() == "}") {
|
||||
break;
|
||||
}
|
||||
tok = tok->tokAt(2);
|
||||
const Token *tok2 = Token::findmatch(tok, "typedef", tok->link());
|
||||
if (tok2) {
|
||||
syntaxError(tok2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue