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
This commit is contained in:
Devang Patel 2009-07-22 18:23:44 +00:00
parent 66a9d6702f
commit c4999d71e1
2 changed files with 17 additions and 0 deletions

View File

@ -253,6 +253,11 @@ namespace llvm {
uint64_t getOriginalTypeSize() const; uint64_t getOriginalTypeSize() const;
/// dump - print derived type. /// dump - print derived type.
void dump() const; 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 /// DICompositeType - This descriptor holds a type that can refer to multiple

View File

@ -206,6 +206,18 @@ unsigned DIArray::getNumElements() const {
return C->getNumOperands(); 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. /// Verify - Verify that a compile unit is well formed.
bool DICompileUnit::Verify() const { bool DICompileUnit::Verify() const {
if (isNull()) if (isNull())