diff options
author | Dan Gohman <gohman@apple.com> | 2010-07-21 18:54:18 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-07-21 18:54:18 +0000 |
commit | 872814ae048df032bddf9299c850f5bda08299a9 (patch) | |
tree | 8abc3d283bd51ea3430c80b7c69f84b8e6067010 /lib/Analysis/DebugInfo.cpp | |
parent | ec237ffd28f1408f524dc134220d8502e167f4d9 (diff) |
Disallow null as a named metadata operand.
Make MDNode::destroy private.
Fix the one thing that used MDNode::destroy, outside of MDNode itself.
One should never delete or destroy an MDNode explicitly. MDNodes
implicitly go away when there are no references to them (implementation
details aside).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index ca6c2e6d72..277edefe7b 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -233,8 +233,7 @@ unsigned DIArray::getNumElements() const { } /// replaceAllUsesWith - Replace all uses of debug info referenced by -/// this descriptor. After this completes, the current debug info value -/// is erased. +/// this descriptor. void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) { if (!DbgNode) return; @@ -249,7 +248,6 @@ void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) { const MDNode *DN = D; const Value *V = cast_or_null<Value>(DN); Node->replaceAllUsesWith(const_cast<Value*>(V)); - Node->destroy(); } } @@ -1385,7 +1383,7 @@ static Value *findDbgGlobalDeclare(GlobalVariable *V) { return 0; for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { - DIDescriptor DIG(cast_or_null<MDNode>(NMD->getOperand(i))); + DIDescriptor DIG(cast<MDNode>(NMD->getOperand(i))); if (!DIG.isGlobalVariable()) continue; if (DIGlobalVariable(DIG).getGlobal() == V) |