astutils.cpp: avoid redundant callback invocation in `isExpressionChangedAt()` (#4369)

This commit is contained in:
Oliver Stöneberg 2022-08-17 13:50:39 +02:00 committed by GitHub
parent 0978cc2d46
commit 0f0c4061ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -2482,10 +2482,11 @@ static bool isExpressionChangedAt(const F& getExprTok,
return true; return true;
bool aliased = false; bool aliased = false;
// If we can't find the expression then assume it is an alias // If we can't find the expression then assume it is an alias
if (!getExprTok()) auto expr = getExprTok();
if (!expr)
aliased = true; aliased = true;
if (!aliased) if (!aliased)
aliased = isAliasOf(tok, getExprTok()); aliased = isAliasOf(tok, expr);
if (!aliased) if (!aliased)
return false; return false;
if (isVariableChanged(tok, 1, settings, cpp, depth)) if (isVariableChanged(tok, 1, settings, cpp, depth))