================
@@ -4189,8 +4189,13 @@ llvm::DICompositeType 
*CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
         llvm::MDNode::replaceWithDistinct(llvm::TempDICompositeType(RealDecl));
     break;
   }
-
-  RegionMap[Ty->getDecl()].reset(RealDecl);
+  if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(Ty->getDecl())) {
+    CXXRecordDecl *TemplateDecl =
+        CTSD->getSpecializedTemplate()->getTemplatedDecl();
+    RegionMap[TemplateDecl].reset(RealDecl);
+  } else {
+    RegionMap[Ty->getDecl()].reset(RealDecl);
+  }
----------------
dwblaikie wrote:

But I'm still a bit confused by this code in general - the `templated decl` is 
the generic thing, right? But DWARF doesn't describe generic things, so we'd 
want to put these nested elements in specific instantiations... 

(presumably if this patch is the right path forward, we'd need something 
similar for the `RegionMap.erase(Ty->getDecl());` ? (or perhapps that's matched 
up with some other mutation))

https://github.com/llvm/llvm-project/pull/146729
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to