Author: Timm Baeder Date: 2025-02-03T08:51:30+01:00 New Revision: c475356603cd33ead378a9db00b7e579c9da366e
URL: https://github.com/llvm/llvm-project/commit/c475356603cd33ead378a9db00b7e579c9da366e DIFF: https://github.com/llvm/llvm-project/commit/c475356603cd33ead378a9db00b7e579c9da366e.diff LOG: [clang][bytecode][NFC] Only call getSource() when necessary (#125419) Added: Modified: clang/lib/AST/ByteCode/Interp.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index f91820e16fac52..1123ced99eb069 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; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits