summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-20 21:42:28 +0000
committerDan Gohman <gohman@apple.com>2010-07-20 21:42:28 +0000
commit43aa8f03c18459b574d49d6a11616845e1d2ba30 (patch)
treeabcb8b4049feace6a57d4ca54019fe96f2618646 /llvm/lib/Bitcode/Writer
parentc3eb5e3d4bf1152b702a196b903c9c6559b02b1c (diff)
downloadbcm5719-llvm-43aa8f03c18459b574d49d6a11616845e1d2ba30.tar.gz
bcm5719-llvm-43aa8f03c18459b574d49d6a11616845e1d2ba30.zip
Add support for remapping metadata kind IDs when reading in a
bitcode file, so that two bitcode files where the same metadata kind name happens to have been assigned a different ID can still be linked together. Eliminate the restriction that metadata kind IDs can't be 0. Change MD_dbg from 1 to 0, because we can now, and because it's less mysterious that way. llvm-svn: 108939
Diffstat (limited to 'llvm/lib/Bitcode/Writer')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index fa1b2c4bee2..985c16c783d 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -634,12 +634,11 @@ static void WriteModuleMetadataStore(const Module *M, BitstreamWriter &Stream) {
SmallVector<StringRef, 4> Names;
M->getMDKindNames(Names);
- assert(Names[0] == "" && "MDKind #0 is invalid");
- if (Names.size() == 1) return;
+ if (Names.empty()) return;
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
- for (unsigned MDKindID = 1, e = Names.size(); MDKindID != e; ++MDKindID) {
+ for (unsigned MDKindID = 0, e = Names.size(); MDKindID != e; ++MDKindID) {
Record.push_back(MDKindID);
StringRef KName = Names[MDKindID];
Record.append(KName.begin(), KName.end());
OpenPOWER on IntegriCloud