[clang] [clang][ExprConst][NFC] Only call getExprLoc() once (PR #141473)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon May 26 03:24:43 PDT 2025
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/141473
It's potentially costly, so only do it once.
>From 6aab696419ca3762237461e2be46c96015dac4ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 26 May 2025 12:17:24 +0200
Subject: [PATCH] [clang][ExprConst][NFC] Onl call getExprLoc() once
It's potentially costly, so only do it once.
---
clang/lib/AST/ExprConstant.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
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() &&
More information about the cfe-commits
mailing list