Skip to content

Conversation

@xlauko
Copy link
Contributor

@xlauko xlauko commented Dec 13, 2025

Use the convetional snake_case for MLIR assembly and align with operation documentation that already mentions snake_cased attribute.

@xlauko xlauko marked this pull request as ready for review December 13, 2025 11:25
@xlauko
Copy link
Contributor Author

xlauko commented Dec 13, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Dec 13, 2025
@xlauko xlauko changed the title [CIR] Fix allEnumCasesCovered format to be snake_case [CIR] Rename allEnumCasesCovered to all_enum_cases_covered Dec 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2025

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: Henrich Lauko (xlauko)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/172153.diff

3 Files Affected:

  • (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+2-2)
  • (modified) clang/test/CIR/CodeGen/switch.cpp (+1-1)
  • (modified) clang/test/CIR/IR/switch.cir (+2-2)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 868b813458aae..240459428b22c 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -1216,7 +1216,7 @@ def CIR_SwitchOp : CIR_Op<"switch", [
 
   let arguments = (ins 
     CIR_IntType:$condition,
-    UnitAttr:$allEnumCasesCovered
+    UnitAttr:$all_enum_cases_covered
   );
 
   let regions = (region AnyRegion:$body);
@@ -1229,7 +1229,7 @@ def CIR_SwitchOp : CIR_Op<"switch", [
 
   let assemblyFormat = [{
     `(` $condition `:` qualified(type($condition)) `)` 
-     (`allEnumCasesCovered` $allEnumCasesCovered^)?
+     (`all_enum_cases_covered` $all_enum_cases_covered^)?
     $body
     attr-dict
   }];
diff --git a/clang/test/CIR/CodeGen/switch.cpp b/clang/test/CIR/CodeGen/switch.cpp
index b7bd2da5e39b8..a7468954665c0 100644
--- a/clang/test/CIR/CodeGen/switch.cpp
+++ b/clang/test/CIR/CodeGen/switch.cpp
@@ -1282,7 +1282,7 @@ void testSwitchCoverAllCase(M m) {
     break;
   }
 }
-// CIR: cir.switch(%[[ARG:.*]] : !s32i) allEnumCasesCovered {
+// CIR: cir.switch(%[[ARG:.*]] : !s32i) all_enum_cases_covered {
 
 void testSwitchNotCoverAllCase(M m) {
   switch (m) {
diff --git a/clang/test/CIR/IR/switch.cir b/clang/test/CIR/IR/switch.cir
index 89614480e43cd..676b206e237ed 100644
--- a/clang/test/CIR/IR/switch.cir
+++ b/clang/test/CIR/IR/switch.cir
@@ -40,7 +40,7 @@ cir.func @s0() {
 
 // Pretends that this is lowered from a C file and was tagged with allEnumCasesCovered = true
 cir.func @s1(%1 : !s32i) {
-  cir.switch (%1 : !s32i) allEnumCasesCovered {
+  cir.switch (%1 : !s32i) all_enum_cases_covered {
     cir.case (default, []) {
       cir.return
     }
@@ -54,7 +54,7 @@ cir.func @s1(%1 : !s32i) {
   } { }
   cir.return
 } 
-// CHECK: cir.switch(%[[ARG:.*]] : !s32i) allEnumCasesCovered {
+// CHECK: cir.switch(%[[ARG:.*]] : !s32i) all_enum_cases_covered {
 // CHECK-NEXT: cir.case(default, []) {
 // CHECK-NEXT:   cir.return
 // CHECK-NEXT: }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants