Try to stop range overflow in forwardRange() (#4235)

* Try to stop range overflow in forwardRange()

* Use predefinded function for check instead
This commit is contained in:
Jens Yllman 2022-07-09 00:57:44 +02:00 committed by GitHub
parent 0b63e7273d
commit b246781da6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ PathAnalysis::Progress PathAnalysis::forwardRecursive(const Token* tok, Info inf
PathAnalysis::Progress PathAnalysis::forwardRange(const Token* startToken, const Token* endToken, Info info, const std::function<PathAnalysis::Progress(const Info&)>& f) const PathAnalysis::Progress PathAnalysis::forwardRange(const Token* startToken, const Token* endToken, Info info, const std::function<PathAnalysis::Progress(const Info&)>& f) const
{ {
for (const Token *tok = startToken; tok && tok != endToken; tok = tok->next()) { for (const Token *tok = startToken; precedes(tok, endToken); tok = tok->next()) {
if (Token::Match(tok, "asm|goto|break|continue")) if (Token::Match(tok, "asm|goto|break|continue"))
return Progress::Break; return Progress::Break;
else if (Token::Match(tok, "return|throw")) { else if (Token::Match(tok, "return|throw")) {