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

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


================
@@ -88,6 +88,24 @@ class DebugTranslation {
   llvm::DISubroutineType *translateImpl(DISubroutineTypeAttr attr);
   llvm::DIType *translateImpl(DITypeAttr attr);
 
+  /// Attributes that support self recursion need to implement two methods and
+  /// hook into the `translateImpl` overload for `DIRecursiveTypeAttr`.
+  /// - `<llvm type> translateImplGetPlaceholder(<mlir type>)`:
+  ///   Translate the DI attr without translating any potentially recursive
+  ///   nested DI attrs.
+  /// - `void translateImplFillPlaceholder(<mlir type>, <llvm type>)`:
+  ///   Given the placeholder returned by `translateImplGetPlaceholder`, fill
+  ///   any holes by recursively translating nested DI attrs. This method must
+  ///   mutate the placeholder that is passed in, instead of creating a new one.
+  llvm::DIType *translateRecursive(DIRecursiveTypeAttrInterface attr);
+
+  /// Get a placeholder DICompositeType without recursing into the elements.
+  llvm::DICompositeType *translateImplGetPlaceholder(DICompositeTypeAttr attr);
+  /// Fill out the DICompositeType placeholder by recursively translating the
+  /// elements.
----------------
gysit wrote:

```suggestion
  /// Completes the DICompositeType `placeholder` by recursively translating the
  /// elements.
```
ultra nit: Usually we use third person singular (Fill -> Fills) for the verb that starts a comment (here and in other places). It is not consistent across mlir but below it looks like we are doing it in this file. 

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


More information about the Mlir-commits mailing list