Bug hunting: Handle early returns faster

This commit is contained in:
Daniel Marjamäki 2020-04-24 18:51:54 +02:00
parent ff88bf1080
commit 3042bbdc3d
1 changed files with 6 additions and 1 deletions

View File

@ -1531,7 +1531,12 @@ static void execute(const Token *start, const Token *end, Data &data)
const Token *thenStart = tok->linkAt(1)->next(); const Token *thenStart = tok->linkAt(1)->next();
const Token *thenEnd = thenStart->link(); const Token *thenEnd = thenStart->link();
if (Token::Match(thenStart, "{ return|throw|break|continue"))
execute(thenStart->next(), thenEnd, ifData);
else
execute(thenStart->next(), end, ifData); execute(thenStart->next(), end, ifData);
if (Token::simpleMatch(thenEnd, "} else {")) { if (Token::simpleMatch(thenEnd, "} else {")) {
const Token *elseStart = thenEnd->tokAt(2); const Token *elseStart = thenEnd->tokAt(2);
execute(elseStart->next(), end, elseData); execute(elseStart->next(), end, elseData);