summaryrefslogtreecommitdiff
path: root/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-12-08 20:18:20 +0000
committerDevang Patel <dpatel@apple.com>2010-12-08 20:18:20 +0000
commit0a2551de2c61b372d45b236b413a5d2e15225c0f (patch)
tree5984b9921eb18f8cedf78f29fcf7075f0252a0f3 /lib/Analysis/DebugInfo.cpp
parentf4f39d35cd30073362c04ab5c37dda6d646d4b0b (diff)
downloadllvm-0a2551de2c61b372d45b236b413a5d2e15225c0f.tar.gz
llvm-0a2551de2c61b372d45b236b413a5d2e15225c0f.tar.bz2
llvm-0a2551de2c61b372d45b236b413a5d2e15225c0f.tar.xz
Add support to create class type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121279 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r--lib/Analysis/DebugInfo.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index f968d06195..9e802c64b0 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -288,6 +288,26 @@ void DIType::replaceAllUsesWith(DIDescriptor &D) {
}
}
+/// replaceAllUsesWith - Replace all uses of debug info referenced by
+/// this descriptor.
+void DIType::replaceAllUsesWith(MDNode *D) {
+ if (!DbgNode)
+ return;
+
+ // Since we use a TrackingVH for the node, its easy for clients to manufacture
+ // legitimate situations where they want to replaceAllUsesWith() on something
+ // which, due to uniquing, has merged with the source. We shield clients from
+ // this detail by allowing a value to be replaced with replaceAllUsesWith()
+ // itself.
+ if (DbgNode != D) {
+ MDNode *Node = const_cast<MDNode*>(DbgNode);
+ const MDNode *DN = D;
+ const Value *V = cast_or_null<Value>(DN);
+ Node->replaceAllUsesWith(const_cast<Value*>(V));
+ MDNode::deleteTemporary(Node);
+ }
+}
+
/// Verify - Verify that a compile unit is well formed.
bool DICompileUnit::Verify() const {
if (!DbgNode)