]> granicus.if.org Git - clang/commitdiff
Use TrackingVH to hold forward decl.
authorDevang Patel <dpatel@apple.com>
Mon, 16 Nov 2009 20:09:38 +0000 (20:09 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 16 Nov 2009 20:09:38 +0000 (20:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88951 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 64748dc8f34ba13b5ef0de24c5cc08bc3e068744..0cd8f1bcd8fb1b6041e95676165995a734cb86f7 100644 (file)
@@ -600,6 +600,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
   if (Decl->isForwardDecl())
     return FwdDecl;
 
+  llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FwdDecl.getNode();
   // Otherwise, insert it into the TypeCache so that recursive uses will find
   // it.
   TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl.getNode();
@@ -686,7 +687,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
 
   // Now that we have a real decl for the struct, replace anything using the
   // old decl with the new one.  This will recursively update the debug info.
-  FwdDecl.replaceAllUsesWith(RealDecl);
+  llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl);
 
   return RealDecl;
 }