diff options
author | Devang Patel <dpatel@apple.com> | 2009-07-22 18:23:44 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-07-22 18:23:44 +0000 |
commit | f03c9bec63da8718b4531db2ba24658609302fe7 (patch) | |
tree | 3606af16795e6102a34188c1b1ea9f38d1e9febe | |
parent | e171bc8ae5cb6ab3d9024aa10e8d49204cbd487b (diff) | |
download | bcm5719-llvm-f03c9bec63da8718b4531db2ba24658609302fe7.tar.gz bcm5719-llvm-f03c9bec63da8718b4531db2ba24658609302fe7.zip |
Add replaceAllUsesWith() to FE replace debug info constructs while building complex types.
llvm-svn: 76765
-rw-r--r-- | llvm/include/llvm/Analysis/DebugInfo.h | 5 | ||||
-rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/DebugInfo.h b/llvm/include/llvm/Analysis/DebugInfo.h index 91046c2c866..39fe01d3428 100644 --- a/llvm/include/llvm/Analysis/DebugInfo.h +++ b/llvm/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/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index 437ff03b327..aa012ef8bcb 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/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()) |