From 0f0c4061ff0c1278aa52dd4d30a3fe5fd24d315c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Wed, 17 Aug 2022 13:50:39 +0200 Subject: [PATCH] astutils.cpp: avoid redundant callback invocation in `isExpressionChangedAt()` (#4369) --- lib/astutils.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 68c5120d8..fb5a2934b 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -2482,10 +2482,11 @@ static bool isExpressionChangedAt(const F& getExprTok, return true; bool aliased = false; // If we can't find the expression then assume it is an alias - if (!getExprTok()) + auto expr = getExprTok(); + if (!expr) aliased = true; if (!aliased) - aliased = isAliasOf(tok, getExprTok()); + aliased = isAliasOf(tok, expr); if (!aliased) return false; if (isVariableChanged(tok, 1, settings, cpp, depth))