From f03c9bec63da8718b4531db2ba24658609302fe7 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 22 Jul 2009 18:23:44 +0000 Subject: Add replaceAllUsesWith() to FE replace debug info constructs while building complex types. llvm-svn: 76765 --- llvm/lib/Analysis/DebugInfo.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'llvm/lib/Analysis/DebugInfo.cpp') 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()) -- cgit v1.2.3