[clang] d6f1de3 - [clang][bytecode] Bail out on invalid function declarations (#138503)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 5 07:24:56 PDT 2025
Author: Timm Baeder
Date: 2025-05-05T16:24:53+02:00
New Revision: d6f1de3107bb2367065cf39a6468b9466524be75
URL: https://github.com/llvm/llvm-project/commit/d6f1de3107bb2367065cf39a6468b9466524be75
DIFF: https://github.com/llvm/llvm-project/commit/d6f1de3107bb2367065cf39a6468b9466524be75.diff
LOG: [clang][bytecode] Bail out on invalid function declarations (#138503)
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 1a7fc6cf2b2fd..9c041ad782af9 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -834,6 +834,12 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
return false;
}
+ // Bail out if the function declaration itself is invalid. We will
+ // have produced a relevant diagnostic while parsing it, so just
+ // note the problematic sub-expression.
+ if (F->getDecl()->isInvalidDecl())
+ return Invalid(S, OpPC);
+
if (S.checkingPotentialConstantExpression() && S.Current->getDepth() != 0)
return false;
More information about the cfe-commits
mailing list