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;
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to