[clang] [clang][ExprConst][NFC] Only call getExprLoc() once (PR #141473)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 26 03:25:16 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
It's potentially costly, so only do it once.
---
Full diff: https://github.com/llvm/llvm-project/pull/141473.diff
1 Files Affected:
- (modified) clang/lib/AST/ExprConstant.cpp (+4-3)
``````````diff
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() &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/141473
More information about the cfe-commits
mailing list