[llvm-commits] [llvm] r76765 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp
    Devang Patel 
    dpatel at apple.com
       
    Wed Jul 22 11:23:45 PDT 2009
    
    
  
Author: dpatel
Date: Wed Jul 22 13:23:44 2009
New Revision: 76765
URL: http://llvm.org/viewvc/llvm-project?rev=76765&view=rev
Log:
Add replaceAllUsesWith() to FE replace debug info constructs while building complex types.
Modified:
    llvm/trunk/include/llvm/Analysis/DebugInfo.h
    llvm/trunk/lib/Analysis/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=76765&r1=76764&r2=76765&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Wed Jul 22 13:23:44 2009
@@ -253,6 +253,11 @@
     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
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=76765&r1=76764&r2=76765&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Jul 22 13:23:44 2009
@@ -206,6 +206,18 @@
   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()) 
    
    
More information about the llvm-commits
mailing list