https://github.com/AdityaC4 created 
https://github.com/llvm/llvm-project/pull/161755

fixes: #161685

>From 0cfc176af36ff5d9c9930fb85fca6c0e7f558ed3 Mon Sep 17 00:00:00 2001
From: AdityaC4 <[email protected]>
Date: Thu, 2 Oct 2025 19:20:50 -0500
Subject: [PATCH] add: NUMERIC_TYPE_SWITCH

---
 clang/lib/AST/ByteCode/PrimType.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/clang/lib/AST/ByteCode/PrimType.h 
b/clang/lib/AST/ByteCode/PrimType.h
index 54fd39ac6fcc8..e1c2bf58a75e6 100644
--- a/clang/lib/AST/ByteCode/PrimType.h
+++ b/clang/lib/AST/ByteCode/PrimType.h
@@ -262,6 +262,25 @@ static inline bool aligned(const void *P) {
     }                                                                          
\
   } while (0)
 
+#define NUMERIC_TYPE_SWITCH(Expr, B)                                           
\
+  do {                                                                         
\
+    switch (Expr) {                                                            
\
+      TYPE_SWITCH_CASE(PT_Sint8, B)                                            
\
+      TYPE_SWITCH_CASE(PT_Uint8, B)                                            
\
+      TYPE_SWITCH_CASE(PT_Sint16, B)                                           
\
+      TYPE_SWITCH_CASE(PT_Uint16, B)                                           
\
+      TYPE_SWITCH_CASE(PT_Sint32, B)                                           
\
+      TYPE_SWITCH_CASE(PT_Uint32, B)                                           
\
+      TYPE_SWITCH_CASE(PT_Sint64, B)                                           
\
+      TYPE_SWITCH_CASE(PT_Uint64, B)                                           
\
+      TYPE_SWITCH_CASE(PT_IntAP, B)                                            
\
+      TYPE_SWITCH_CASE(PT_IntAPS, B)                                           
\
+      TYPE_SWITCH_CASE(PT_Float, B)                                            
\
+    default:                                                                   
\
+      llvm_unreachable("Not an integer or floating point value");              
\
+    }                                                                          
\
+  } while (0)
+
 #define TYPE_SWITCH_ALLOC(Expr, B)                                             
\
   do {                                                                         
\
     switch (Expr) {                                                            
\

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to