[clang] [CIR] Add the ability to detect enum argument for switch op (PR #172236)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 18 12:49:24 PST 2025
================
@@ -1106,6 +1106,7 @@ mlir::LogicalResult CIRGenFunction::emitSwitchStmt(const clang::SwitchStmt &s) {
terminateBody(builder, caseOp.getCaseRegion(), caseOp.getLoc());
terminateBody(builder, swop.getBody(), swop.getLoc());
+ swop.setHandlingEnum(s.getCond()->IgnoreParenImpCasts()->getType()->isEnumeralType());
----------------
bcardosolopes wrote:
Assuming `s.isAllEnumCasesCovered()` implies this is an enum, the type should be `isEnumeralType` everytime that returns true? Might be worth adding an assert here in case somehow they differ
https://github.com/llvm/llvm-project/pull/172236
More information about the cfe-commits
mailing list