summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-07-22 18:23:44 +0000
committerDevang Patel <dpatel@apple.com>2009-07-22 18:23:44 +0000
commitc4999d71e162bab8c38fe104554a3b81b4f08771 (patch)
treeb6d3252bb52bd58b8c9d79700c248df1f2e420fc
parent66a9d6702f6f6f89aac64bc0cd31c437836dfffc (diff)
downloadexternal_llvm-c4999d71e162bab8c38fe104554a3b81b4f08771.zip
external_llvm-c4999d71e162bab8c38fe104554a3b81b4f08771.tar.gz
external_llvm-c4999d71e162bab8c38fe104554a3b81b4f08771.tar.bz2
Add replaceAllUsesWith() to FE replace debug info constructs while building complex types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76765 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DebugInfo.h5
-rw-r--r--lib/Analysis/DebugInfo.cpp12
2 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index 91046c2..39fe01d 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -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
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 437ff03..aa012ef 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -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())