summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-09-20 18:59:33 +0000
committerVedant Kumar <vsk@apple.com>2018-09-20 18:59:33 +0000
commit386ad01c7b6d83beb95267116af295471e36d426 (patch)
tree8f3bbf44fccf2a9aa4fe9e3591834c69aeedd77e /llvm/lib/Bitcode
parentcc06a782baa9fcabc5e10b42e23e06d6018cc429 (diff)
downloadbcm5719-llvm-386ad01c7b6d83beb95267116af295471e36d426.tar.gz
bcm5719-llvm-386ad01c7b6d83beb95267116af295471e36d426.zip
[Bitcode] Address backwards compat bug in r342631
r342631 expanded bitc::METADATA_LOCATION by one element. The bitcode metadata loader was changed in a backwards-incompatible way, leading to crashes when disassembling old bitcode: assertion: empty() && "PlaceholderQueue hasn't been flushed before being destroyed" Assertion failed: (empty() && "PlaceholderQueue hasn't been flushed before being destroyed") This commit teaches the metadata loader to assume that the newly-added IsImplicitCode bit is 'false' when not present in old bitcode. I've added a bitcode compat regression test. rdar://44645820 llvm-svn: 342678
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 1af17f485e1..3fe7d220563 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1139,7 +1139,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
break;
}
case bitc::METADATA_LOCATION: {
- if (Record.size() != 6)
+ if (Record.size() != 5 && Record.size() != 6)
return error("Invalid record");
IsDistinct = Record[0];
@@ -1147,7 +1147,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
unsigned Column = Record[2];
Metadata *Scope = getMD(Record[3]);
Metadata *InlinedAt = getMDOrNull(Record[4]);
- bool ImplicitCode = Record[5];
+ bool ImplicitCode = Record.size() == 6 && Record[5];
MetadataList.assignValue(
GET_OR_DISTINCT(DILocation, (Context, Line, Column, Scope, InlinedAt,
ImplicitCode)),
OpenPOWER on IntegriCloud