Add replaceAllUsesWith() to FE replace debug info constructs while building complex...
authorDevang Patel <dpatel@apple.com>
Wed, 22 Jul 2009 18:23:44 +0000 (18:23 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 22 Jul 2009 18:23:44 +0000 (18:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76765 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/Analysis/DebugInfo.cpp

index 91046c2c8669e8d8b5c34684640d026c8cf9c625..39fe01d3428b1518c9d8749943c553d718fd6717 100644 (file)
@@ -253,6 +253,11 @@ namespace llvm {
     uint64_t getOriginalTypeSize() const;
     /// dump - print derived type.
     void dump() const;
+
+    /// replaceAllUsesWith - Replace all uses of debug info referenced by
+    /// this descriptor. After this completes, the current debug info value
+    /// is erased.
+    void replaceAllUsesWith(DIDescriptor &D);
   };
 
   /// DICompositeType - This descriptor holds a type that can refer to multiple
index 437ff03b327e370af57358e0596bf0d36ea7ede5..aa012ef8bcb8c36bdeaf76099d6166e3c40e3947 100644 (file)
@@ -206,6 +206,18 @@ unsigned DIArray::getNumElements() const {
   return C->getNumOperands();
 }
 
+/// replaceAllUsesWith - Replace all uses of debug info referenced by
+/// this descriptor. After this completes, the current debug info value
+/// is erased.
+void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) {
+  if (isNull())
+    return;
+
+  assert (D.isNull() && "Can not replace with null");
+  getGV()->replaceAllUsesWith(D.getGV());
+  getGV()->eraseFromParent();
+}
+
 /// Verify - Verify that a compile unit is well formed.
 bool DICompileUnit::Verify() const {
   if (isNull())