[clang] 022e37a - [clang][bytecode][NFC] Remove reflection indirection in builtins (#237106)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 30 06:04:06 PDT 2026


Author: Timm Baeder
Date: 2026-10-30T14:04:01+01:00
New Revision: 022e37a533ea6b3812b9fd064c99cbdd6d88f34f

URL: https://github.com/llvm/llvm-project/commit/022e37a533ea6b3812b9fd064c99cbdd6d88f34f
DIFF: https://github.com/llvm/llvm-project/commit/022e37a533ea6b3812b9fd064c99cbdd6d88f34f.diff

LOG: [clang][bytecode][NFC] Remove reflection indirection in builtins (#237106)

The additional indirection through InterpretReflectionBuiltin adds
nothing other than more complexity and a function call that returns
`false` for basically ALL cases.

Remove the call to InterpretReflectionBuiltin and just add the
reflection builtin to the existing switch. If this file gets to big, we
can still move the individual reflection functions in a different file.

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 84edb0bce4a10..c9f44807c9080 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -4783,22 +4783,8 @@ static bool interp__builtin_meta_is_type(InterpState &S, CodePtr OpPC,
   return true;
 }
 
-static bool InterpretReflectionBuiltin(InterpState &S, CodePtr OpPC,
-                                       const CallExpr *Call,
-                                       uint32_t BuiltinID) {
-  switch (BuiltinID) {
-  case Builtin::BI__builtin_meta_is_type:
-    return interp__builtin_meta_is_type(S, OpPC, Call);
-  default:
-    llvm_unreachable("unknown metafunction builtin");
-  }
-}
-
 bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
                       uint32_t BuiltinID) {
-  if (S.getASTContext().BuiltinInfo.isReflectionMetafunctionBuiltin(BuiltinID))
-    return InterpretReflectionBuiltin(S, OpPC, Call, BuiltinID);
-
   const InterpFrame *Frame = S.Current;
   switch (BuiltinID) {
   case Builtin::BI__builtin_is_constant_evaluated:
@@ -6954,6 +6940,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case X86::BI__builtin_ia32_cvttpd2dq256:
   case X86::BI__builtin_ia32_cvttps2dq256:
     return interp_builtin_ia32_cvt_vector_to_int(S, OpPC, Call);
+
+  case Builtin::BI__builtin_meta_is_type:
+    return interp__builtin_meta_is_type(S, OpPC, Call);
+
   default:
     return Invalid(S, OpPC);
   }


        


More information about the cfe-commits mailing list