================
@@ -4170,9 +4170,16 @@ llvm::DICompositeType 
*CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
         llvm::MDNode::replaceWithDistinct(llvm::TempDICompositeType(RealDecl));
     break;
   }
-
-  RegionMap[Ty->getDecl()].reset(RealDecl);
-  TypeCache[QualType(Ty, 0).getAsOpaquePtr()].reset(RealDecl);
+  auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(Ty->getDecl());
+  if (CTSD) {
+    CXXRecordDecl *TemplateDecl =
+        CTSD->getSpecializedTemplate()->getTemplatedDecl();
+    RegionMap[TemplateDecl].reset(RealDecl);
+    TypeCache[QualType(Ty, 0).getAsOpaquePtr()].reset(RealDecl);
----------------
stevemerr wrote:

This line is present in both blocks, so it should be pulled out of the if-else. 
 

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