[clang] a9731df - [clang][bytecode][NFC] Avoid a getSource() call (#117311)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 05:00:14 PST 2024
Author: Timm Baeder
Date: 2024-11-22T14:00:10+01:00
New Revision: a9731dff0a0133f718e8e4fb6c729aa1d7c909a4
URL: https://github.com/llvm/llvm-project/commit/a9731dff0a0133f718e8e4fb6c729aa1d7c909a4
DIFF: https://github.com/llvm/llvm-project/commit/a9731dff0a0133f718e8e4fb6c729aa1d7c909a4.diff
LOG: [clang][bytecode][NFC] Avoid a getSource() call (#117311)
This is only needed when we actually emit a diagnostic, so move the
getSource() after the early return.
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 4af1d6f40e9017..329f1584be34bf 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1481,11 +1481,12 @@ bool CheckNewTypeMismatch(InterpState &S, CodePtr OpPC, const Expr *E,
bool InvalidNewDeleteExpr(InterpState &S, CodePtr OpPC, const Expr *E) {
assert(E);
- const auto &Loc = S.Current->getSource(OpPC);
if (S.getLangOpts().CPlusPlus26)
return true;
+ const auto &Loc = S.Current->getSource(OpPC);
+
if (const auto *NewExpr = dyn_cast<CXXNewExpr>(E)) {
const FunctionDecl *OperatorNew = NewExpr->getOperatorNew();
More information about the cfe-commits
mailing list