Author: Timm Baeder
Date: 2025-05-26T13:45:22+02:00
New Revision: f17b9a77aa902082e1851c9bed9c7749d450d9df

URL: 
https://github.com/llvm/llvm-project/commit/f17b9a77aa902082e1851c9bed9c7749d450d9df
DIFF: 
https://github.com/llvm/llvm-project/commit/f17b9a77aa902082e1851c9bed9c7749d450d9df.diff

LOG: [clang][ExprConst][NFC] Only call getExprLoc() once (#141473)

It's potentially costly, so only do it once.

Added: 
    

Modified: 
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index e9a269337404a..39fc714402728 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -8468,10 +8468,11 @@ class ExprEvaluatorBase
 
     const FunctionDecl *Definition = nullptr;
     Stmt *Body = FD->getBody(Definition);
+    SourceLocation Loc = E->getExprLoc();
 
-    if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition, Body) ||
-        !HandleFunctionCall(E->getExprLoc(), Definition, This, E, Args, Call,
-                            Body, Info, Result, ResultSlot))
+    if (!CheckConstexprFunction(Info, Loc, FD, Definition, Body) ||
+        !HandleFunctionCall(Loc, Definition, This, E, Args, Call, Body, Info,
+                            Result, ResultSlot))
       return false;
 
     if (!CovariantAdjustmentPath.empty() &&


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to