llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Henrich Lauko (xlauko)

<details>
<summary>Changes</summary>

Switch the remaining enum properties that spell their default as a 
`DefaultValuedProp&lt;EnumProp&lt;E&gt;, "ns::E::Case"&gt;` string to 
`DefaultValuedEnumProp&lt;E, Case&gt;` (added in #<!-- -->240360), which takes 
the case def and checks at TableGen time that it belongs to the enum. The 
`none` cases of the Ptr dialect's `PtrAddFlags`/`PtrDiffFlags` and the 
`Default` case of CIR's `VisibilityKind` get named defs for this. Generated 
code is unchanged apart from the default value now being spelled fully 
qualified.

Assisted-by: Claude Code (Claude Fable 5.1).

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


4 Files Affected:

- (modified) clang/include/clang/CIR/Dialect/IR/CIRAttrs.td (+3-1) 
- (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+4-6) 
- (modified) mlir/include/mlir/Dialect/Ptr/IR/PtrEnums.td (+6-2) 
- (modified) mlir/include/mlir/Dialect/Ptr/IR/PtrOps.td (+2-2) 


``````````diff
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td 
b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
index 2fb7102b0ccf2..dad5d94c6f803 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
@@ -1584,8 +1584,10 @@ def CIR_ConstComplexAttr : 
CIR_ValueLikeAttr<"ConstComplex", "const_complex"> {
 // VisibilityKind
 
//===----------------------------------------------------------------------===//
 
+def CIR_VisibilityDefault : I32EnumCase<"Default", 0, "default">;
+
 def CIR_VisibilityKind : CIR_I32Enum<"VisibilityKind", "C/C++ visibility", [
-  I32EnumCase<"Default", 0, "default">,
+  CIR_VisibilityDefault,
   I32EnumCase<"Hidden", 1, "hidden">,
   I32EnumCase<"Protected", 2, "protected">
 ]>;
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td 
b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 93c91a48bd0c7..2cc3eb571f45b 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -3519,9 +3519,8 @@ def CIR_GlobalOp : CIR_RegionBranchOpBase<"global", [
   // TODO: sym_visibility can possibly be represented by implementing the
   // necessary Symbol's interface in terms of linkage instead.
   let arguments = (ins SymbolNameAttr:$sym_name,
-                       DefaultValuedProp<
-                        EnumProp<CIR_VisibilityKind>,
-                        "cir::VisibilityKind::Default"
+                       DefaultValuedEnumProp<
+                        CIR_VisibilityKind, CIR_VisibilityDefault
                        >:$global_visibility,
                        OptionalAttr<StrAttr>:$sym_visibility,
                        TypeAttr:$sym_type,
@@ -4431,9 +4430,8 @@ def CIR_FuncOp : CIR_Op<"func", [
 
   let arguments = (ins
     SymbolNameAttr:$sym_name,
-    DefaultValuedProp<
-      EnumProp<CIR_VisibilityKind>,
-      "cir::VisibilityKind::Default"
+    DefaultValuedEnumProp<
+      CIR_VisibilityKind, CIR_VisibilityDefault
     >:$global_visibility,
     TypeAttrOf<CIR_FuncType>:$function_type,
     UnitAttr:$builtin,
diff --git a/mlir/include/mlir/Dialect/Ptr/IR/PtrEnums.td 
b/mlir/include/mlir/Dialect/Ptr/IR/PtrEnums.td
index c97bd04d32896..ee81faad43830 100644
--- a/mlir/include/mlir/Dialect/Ptr/IR/PtrEnums.td
+++ b/mlir/include/mlir/Dialect/Ptr/IR/PtrEnums.td
@@ -72,8 +72,10 @@ def AtomicOrderingProp : EnumProp<AtomicOrdering>;
 // Ptr add flags enum properties.
 
//===----------------------------------------------------------------------===//
 
+def PtrAddFlagsNone : I32EnumCase<"none", 0>;
+
 def Ptr_PtrAddFlags : I32Enum<"PtrAddFlags", "Pointer add flags", [
-    I32EnumCase<"none", 0>, I32EnumCase<"nusw", 1>, I32EnumCase<"nuw", 2>,
+    PtrAddFlagsNone, I32EnumCase<"nusw", 1>, I32EnumCase<"nuw", 2>,
     I32EnumCase<"inbounds", 3>
   ]> {
   let cppNamespace = "::mlir::ptr";
@@ -83,8 +85,10 @@ def Ptr_PtrAddFlags : I32Enum<"PtrAddFlags", "Pointer add 
flags", [
 // Ptr diff flags enum properties.
 
//===----------------------------------------------------------------------===//
 
+def PtrDiffFlagsNone : I8BitEnumCase<"none", 0>;
+
 def Ptr_PtrDiffFlags : I8BitEnum<"PtrDiffFlags", "Pointer difference flags", [
-    I8BitEnumCase<"none", 0>, I8BitEnumCase<"nuw", 1>, I8BitEnumCase<"nsw", 2>
+    PtrDiffFlagsNone, I8BitEnumCase<"nuw", 1>, I8BitEnumCase<"nsw", 2>
   ]> {
   let cppNamespace = "::mlir::ptr";
 }
diff --git a/mlir/include/mlir/Dialect/Ptr/IR/PtrOps.td 
b/mlir/include/mlir/Dialect/Ptr/IR/PtrOps.td
index e14f64330c294..06c7837d61c87 100644
--- a/mlir/include/mlir/Dialect/Ptr/IR/PtrOps.td
+++ b/mlir/include/mlir/Dialect/Ptr/IR/PtrOps.td
@@ -400,7 +400,7 @@ def Ptr_PtrAddOp : Pointer_Op<"ptr_add", [
   let arguments = (ins
     Ptr_PtrLikeType:$base,
     Ptr_IntLikeType:$offset,
-    DefaultValuedProp<EnumProp<Ptr_PtrAddFlags>, "PtrAddFlags::none">:$flags);
+    DefaultValuedEnumProp<Ptr_PtrAddFlags, PtrAddFlagsNone>:$flags);
   let results = (outs Ptr_PtrLikeType:$result);
   let assemblyFormat = [{
     ($flags^)? $base `,` $offset attr-dict `:` type($base) `,` type($offset)
@@ -457,7 +457,7 @@ def Ptr_PtrDiffOp : Pointer_Op<"ptr_diff", [
   }];
   let arguments = (ins
     Ptr_PtrLikeType:$lhs, Ptr_PtrLikeType:$rhs,
-    DefaultValuedProp<EnumProp<Ptr_PtrDiffFlags>, "PtrDiffFlags::none">:$flags
+    DefaultValuedEnumProp<Ptr_PtrDiffFlags, PtrDiffFlagsNone>:$flags
   );
   let results = (outs Ptr_IntLikeType:$result);
   let assemblyFormat = [{

``````````

</details>


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

Reply via email to