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 | 093cb79d4bcbe3cb8fd0bda40137e2c9415b67f1 (patch) | |
tree | 0a0fd9c767b4815db39b20d0ac7599c879b02832 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 99d2cf48382061d77de2c990b6f39babf74e4fca (diff) | |
download | bcm5719-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/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 985c16c783d..64c2dfaee82 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -558,12 +558,8 @@ static void WriteModuleMetadata(const ValueEnumerator &VE, Record.clear(); // Write named metadata operands. - for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { - if (NMD->getOperand(i)) - Record.push_back(VE.getValueID(NMD->getOperand(i))); - else - Record.push_back(~0U); - } + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) + Record.push_back(VE.getValueID(NMD->getOperand(i))); Stream.EmitRecord(bitc::METADATA_NAMED_NODE, Record, 0); Record.clear(); } |