diff options
| author | Dan Gohman <gohman@apple.com> | 2010-07-20 21:42:28 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-07-20 21:42:28 +0000 |
| commit | 85302f36b133a4ca759e7087011ef7370ca27d7e (patch) | |
| tree | 80e4eb366ba74a1e80c1f102b65ed2e869d7542d /lib/Bitcode/Writer/BitcodeWriter.cpp | |
| parent | 776c0c64652dc1319b75705f198e2be24bd8994d (diff) | |
| download | external_llvm-85302f36b133a4ca759e7087011ef7370ca27d7e.zip external_llvm-85302f36b133a4ca759e7087011ef7370ca27d7e.tar.gz external_llvm-85302f36b133a4ca759e7087011ef7370ca27d7e.tar.bz2 | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp')
| -rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index fa1b2c4..985c16c 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/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()); |
