[clang] [clang][bytecode][NFC] Only call getSource() when necessary (PR #125419)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 2 08:46:16 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/125419.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/Interp.cpp (+3-3)
``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index f91820e16fac522..1123ced99eb0698 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -65,17 +65,17 @@ static void diagnoseNonConstVariable(InterpState &S, CodePtr OpPC,
const ValueDecl *VD);
static bool diagnoseUnknownDecl(InterpState &S, CodePtr OpPC,
const ValueDecl *D) {
- const SourceInfo &E = S.Current->getSource(OpPC);
if (isa<ParmVarDecl>(D)) {
if (D->getType()->isReferenceType())
return false;
+ const SourceInfo &Loc = S.Current->getSource(OpPC);
if (S.getLangOpts().CPlusPlus11) {
- S.FFDiag(E, diag::note_constexpr_function_param_value_unknown) << D;
+ S.FFDiag(Loc, diag::note_constexpr_function_param_value_unknown) << D;
S.Note(D->getLocation(), diag::note_declared_at) << D->getSourceRange();
} else {
- S.FFDiag(E);
+ S.FFDiag(Loc);
}
return false;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/125419
More information about the cfe-commits
mailing list