[clang] 227f954 - [clang][bytecode][NFC] Bail out on non constant evaluated builtins (#130431)

via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 8 21:35:23 PST 2025


Author: Timm Baeder
Date: 2025-03-09T06:35:19+01:00
New Revision: 227f9544a4d4bf9ab4da8a78cc801de697d4bc6d

URL: https://github.com/llvm/llvm-project/commit/227f9544a4d4bf9ab4da8a78cc801de697d4bc6d
DIFF: https://github.com/llvm/llvm-project/commit/227f9544a4d4bf9ab4da8a78cc801de697d4bc6d.diff

LOG: [clang][bytecode][NFC] Bail out on non constant evaluated builtins (#130431)

If the ASTContext says so, don't bother trying to constant evaluate the
given builtin.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/InterpBuiltin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index b8c4ef2f48a79..14e716daa3f12 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -2059,6 +2059,9 @@ static bool interp__builtin_memchr(InterpState &S, CodePtr OpPC,
 
 bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
                       const CallExpr *Call, uint32_t BuiltinID) {
+  if (!S.getASTContext().BuiltinInfo.isConstantEvaluated(BuiltinID))
+    return false;
+
   const InterpFrame *Frame = S.Current;
 
   std::optional<PrimType> ReturnT = S.getContext().classify(Call);


        


More information about the cfe-commits mailing list