[Mlir-commits] [mlir] [MLIR][LLVM] Support Recursive DITypes (PR #80251)

Tobias Gysi llvmlistbot at llvm.org
Sun Mar 10 08:48:03 PDT 2024


================
@@ -371,6 +376,21 @@ def LLVM_DICompositeTypeAttr : LLVM_Attr<"DICompositeType", "di_composite_type",
     OptionalArrayRefParameter<"DINodeAttr">:$elements
   );
   let assemblyFormat = "`<` struct(params) `>`";
+  let extraClassDeclaration = [{
+    /// Requirements of DIRecursiveTypeAttrInterface.
+    /// @{
+
+    /// Get whether this attr describes a recursive self reference.
+    bool isRecSelf() { return getTag() == 0; }
+
+    /// Get a copy of this type attr but with the recursive ID set to `recId`.
+    DIRecursiveTypeAttrInterface withRecId(DistinctAttr recId);
+
+    /// Build a rec-self instance using the provided recId.
+    static DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId);
----------------
gysit wrote:

```suggestion
    /// Build a rec-self instance using the provided `recId`.
    static DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId);
```
ultra nit: 

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


More information about the Mlir-commits mailing list