Bug hunting: Handle early returns faster
This commit is contained in:
parent
ff88bf1080
commit
3042bbdc3d
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue