summaryrefslogtreecommitdiffstats
path: root/tools/llvm-bcanalyzer
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-12-28 23:45:54 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-12-28 23:45:54 +0000
commit6fc58a7278690266622a2bcd52e2168264824b94 (patch)
tree93caf62ed8759573d35457fb3a75366ecc1ae210 /tools/llvm-bcanalyzer
parent90bcc71ffb1a67fb53f8ab9e0e380c48336fb878 (diff)
Change Metadata Index emission in the bitcode to use 2x32 bits for the placeholder
The Bitstream reader and writer are limited to handle a "size_t" at most, which means that we can't backpatch and read back a 64bits value on 32 bits platform. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-bcanalyzer')
-rw-r--r--tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
index 3220063275b0..f97a18448f0a 100644
--- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -609,7 +609,12 @@ static bool ParseBlock(BitstreamCursor &Stream, BitstreamBlockInfo &BlockInfo,
// and validate its forward reference offset was correct!
if (BlockID == bitc::METADATA_BLOCK_ID) {
if (Code == bitc::METADATA_INDEX_OFFSET) {
- MetadataIndexOffset = Stream.GetCurrentBitNo() + Record[0];
+ if (Record.size() != 2)
+ outs() << "(Invalid record)";
+ else {
+ auto Offset = Record[0] + (Record[1] << 32);
+ MetadataIndexOffset = Stream.GetCurrentBitNo() + Offset;
+ }
}
if (Code == bitc::METADATA_INDEX) {
outs() << " (offset ";