summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-21 18:54:18 +0000
committerDan Gohman <gohman@apple.com>2010-07-21 18:54:18 +0000
commit093cb79d4bcbe3cb8fd0bda40137e2c9415b67f1 (patch)
tree0a0fd9c767b4815db39b20d0ac7599c879b02832 /llvm/lib/Analysis/DebugInfo.cpp
parent99d2cf48382061d77de2c990b6f39babf74e4fca (diff)
downloadbcm5719-llvm-093cb79d4bcbe3cb8fd0bda40137e2c9415b67f1.tar.gz
bcm5719-llvm-093cb79d4bcbe3cb8fd0bda40137e2c9415b67f1.zip
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). llvm-svn: 109028
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
-rw-r--r--llvm/lib/Analysis/DebugInfo.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index ca6c2e6d721..277edefe7b7 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/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)
OpenPOWER on IntegriCloud