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

Christian Ulmann llvmlistbot at llvm.org
Thu Mar 14 00:23:49 PDT 2024


================
@@ -346,3 +385,20 @@ StringAttr DebugImporter::getStringAttrOrNull(llvm::MDString *stringNode) {
     return StringAttr();
   return StringAttr::get(context, stringNode->getString());
 }
+
+DistinctAttr DebugImporter::getOrCreateDistinctID(llvm::DINode *node) {
+  DistinctAttr &id = nodeToDistinctAttr[node];
+  if (!id)
+    id = DistinctAttr::create(UnitAttr::get(context));
+  return id;
+}
+
+function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>
+DebugImporter::getRecSelfConstructor(llvm::DINode *node) {
+  using CtorType = function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>;
+  return TypeSwitch<llvm::DINode *, CtorType>(node)
+      .Case<llvm::DICompositeType>([&](auto *concreteNode) {
----------------
Dinistro wrote:

```suggestion
      .Case([&](llvm::DICompositeType *concreteNode) {
```

Wouldn't this make it a bit simpler? Maybe MSVC is somehow falling apart due to this. This might additionally also help in simplifying the inner template magic even further.

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


More information about the Mlir-commits mailing list