]> granicus.if.org Git - clang/commitdiff
DebugInfo: Switch from replaceAllUsesWith() to replaceTemporary()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 11 Apr 2015 19:05:04 +0000 (19:05 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 11 Apr 2015 19:05:04 +0000 (19:05 +0000)
Stop using `DIDescriptor`'s wrapper around
`MDNode::replaceAllUsesWith()` (which is going away).  The new home for
this logic is `DIBuilder::replaceTemporary()`, added in LLVM r234695.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234696 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index d22744b04a116d4c2f02e5dc3ea23bb2cbd54de8..e2bbb6d427c692b05c673ca3fe730ebca4c9e4fb 100644 (file)
@@ -3385,10 +3385,10 @@ void CGDebugInfo::finalize() {
   // element and the size(), so don't cache/reference them.
   for (size_t i = 0; i != ObjCInterfaceCache.size(); ++i) {
     ObjCInterfaceCacheEntry E = ObjCInterfaceCache[i];
-    E.Decl.replaceAllUsesWith(CGM.getLLVMContext(),
-                              E.Type->getDecl()->getDefinition()
-                                  ? CreateTypeDefinition(E.Type, E.Unit)
-                                  : E.Decl);
+    llvm::MDType *Ty = E.Type->getDecl()->getDefinition()
+                           ? CreateTypeDefinition(E.Type, E.Unit)
+                           : E.Decl;
+    DBuilder.replaceTemporary(llvm::TempMDType(E.Decl), Ty);
   }
 
   for (auto p : ReplaceMap) {
@@ -3400,8 +3400,8 @@ void CGDebugInfo::finalize() {
     assert(it != TypeCache.end());
     assert(it->second);
 
-    llvm::DIType RepTy = cast<llvm::MDType>(it->second);
-    Ty.replaceAllUsesWith(CGM.getLLVMContext(), RepTy);
+    DBuilder.replaceTemporary(llvm::TempMDType(Ty),
+                               cast<llvm::MDType>(it->second));
   }
 
   for (const auto &p : FwdDeclReplaceMap) {
@@ -3418,8 +3418,8 @@ void CGDebugInfo::finalize() {
     else
       Repl = it->second;
 
-    FwdDecl.replaceAllUsesWith(CGM.getLLVMContext(),
-                               llvm::DIDescriptor(cast<llvm::MDNode>(Repl)));
+    DBuilder.replaceTemporary(llvm::TempMDNode(FwdDecl),
+                              cast<llvm::MDNode>(Repl));
   }
 
   // We keep our own list of retained types, because we need to look