Parallel fix to r88951: use TrackingVH to hold forward decl.

llvm-svn: 88962
This commit is contained in:
Eli Friedman 2009-11-16 21:04:30 +00:00
parent 544b15cbc3
commit 00dbf4c3c6
1 changed files with 2 additions and 1 deletions

View File

@ -490,6 +490,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
if (!Decl->getDefinition(M->getContext())) if (!Decl->getDefinition(M->getContext()))
return FwdDecl; return FwdDecl;
llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FwdDecl.getNode();
// Otherwise, insert it into the TypeCache so that recursive uses will find // Otherwise, insert it into the TypeCache so that recursive uses will find
// it. // it.
TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl.getNode(); TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl.getNode();
@ -563,7 +564,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// Now that we have a real decl for the struct, replace anything using the // 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. // old decl with the new one. This will recursively update the debug info.
FwdDecl.replaceAllUsesWith(RealDecl); llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl);
return RealDecl; return RealDecl;
} }