[clang] [CIR] Add the ability to detect enum argument for switch op (PR #172236)

Jasmine Tang via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 19 09:30:32 PST 2026


================
@@ -1282,7 +1282,7 @@ void testSwitchCoverAllCase(M m) {
     break;
   }
 }
-// CIR: cir.switch(%[[ARG:.*]] : !s32i) allEnumCasesCovered {
+// CIR: cir.switch(%[[ARG:.*]] : !s32i) allEnumCasesCovered handling_enum {
----------------
badumbatish wrote:

hmm are you saying we should redo the accepting types of switch op and case op? Because currently once switch op is created, the switch operand will turn into i32 without any ways to recover the information. About the enum all cases covered being expensive, I believe it's already available as an unsigned inside the AST already, we're just copying the integer over as a boolean.

https://github.com/llvm/llvm-project/pull/172236


More information about the cfe-commits mailing list