summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2016-05-06 22:53:06 +0000
committerAdrian Prantl <aprantl@apple.com>2016-05-06 22:53:06 +0000
commit85338cbdb63215abefa45d51fe7e5f4f913a6ba4 (patch)
treea700220f85e581904cc22dd78a24efae428cd4f4 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent22152acf7b5d05bea25672cf5eb287893f85fa41 (diff)
downloadbcm5719-llvm-85338cbdb63215abefa45d51fe7e5f4f913a6ba4.tar.gz
bcm5719-llvm-85338cbdb63215abefa45d51fe7e5f4f913a6ba4.zip
Implement a safer bitcode upgrade for DISubprogram.
The bitcode upgrade I added for DISubprogram in r266446 was based on the assumption that the CU node for the subprogram was already materialized by the time the DISubprogram is visited. This assumption may not hold true as future versions of LLVM may decide to write out bitcode in a different order. This patch corrects this by introducing a versioning bit next to the distinct flag to unambiguously differentiate the new from the old record layouts. Note for people stabilizing LLVM out-of-tree: This patch introduces a bitcode incompatibility with llvm trunk revisions from r266446 — this commit. (But D19987 will ensure that it degrades gracefully). http://reviews.llvm.org/D20004 rdar://problem/26074194 llvm-svn: 268816
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 82e2cab6056..035e03e206e 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1353,7 +1353,8 @@ void ModuleBitcodeWriter::writeDICompileUnit(const DICompileUnit *N,
void ModuleBitcodeWriter::writeDISubprogram(const DISubprogram *N,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
- Record.push_back(N->isDistinct());
+ uint64_t HasUnitFlag = 1 << 1;
+ Record.push_back(N->isDistinct() | HasUnitFlag);
Record.push_back(VE.getMetadataOrNullID(N->getScope()));
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
Record.push_back(VE.getMetadataOrNullID(N->getRawLinkageName()));
OpenPOWER on IntegriCloud