https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/219869
There were some cases when `Loc` was not used. Avoid calling `getSource()` in those cases. >From 6622cdb016e262a295e8c9af19ad3a37f230627d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Sun, 30 Aug 2026 19:51:38 +0200 Subject: [PATCH] diagnoseNonConstVariable --- clang/lib/AST/ByteCode/Interp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index 896b2ab4494e7..716f3320299a3 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -155,9 +155,8 @@ static void diagnoseNonConstVariable(InterpState &S, CodePtr OpPC, if (!S.diagnosing()) return; - const SourceInfo &Loc = S.Current->getSource(OpPC); if (!S.getLangOpts().CPlusPlus) { - S.FFDiag(Loc); + S.FFDiag(S.Current->getSource(OpPC)); return; } @@ -175,6 +174,7 @@ static void diagnoseNonConstVariable(InterpState &S, CodePtr OpPC, return; if (VD->getType()->isIntegralOrEnumerationType()) { + SourceInfo Loc = S.Current->getSource(OpPC); if (isModification(AK)) { S.FFDiag(Loc, diag::note_constexpr_modify_global); } else { @@ -184,7 +184,7 @@ static void diagnoseNonConstVariable(InterpState &S, CodePtr OpPC, return; } - S.FFDiag(Loc, + S.FFDiag(S.Current->getSource(OpPC), S.getLangOpts().CPlusPlus11 ? diag::note_constexpr_ltor_non_constexpr : diag::note_constexpr_ltor_non_integral, 1) _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
