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()) {
|
for (const Token *tok = _tokens; tok; tok = tok->next()) {
|
||||||
if (Token::Match(tok, "enum %var% {")) {
|
if (Token::Match(tok, "enum %var% {")) {
|
||||||
for (const Token *tok2 = tok->tokAt(3); tok2; tok2 = tok2->next()) {
|
tok = tok->tokAt(2);
|
||||||
if (tok2->str() == "typedef") {
|
const Token *tok2 = Token::findmatch(tok, "typedef", tok->link());
|
||||||
syntaxError(tok2);
|
if (tok2) {
|
||||||
return true;
|
syntaxError(tok2);
|
||||||
} else if (tok2->str() == "}") {
|
return true;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue