[llvm] r286206 - Bitcode: Split out block info reading into a separate function.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 20:16:57 PST 2016
Author: pcc
Date: Mon Nov 7 22:16:57 2016
New Revision: 286206
URL: http://llvm.org/viewvc/llvm-project?rev=286206&view=rev
Log:
Bitcode: Split out block info reading into a separate function.
We're about to make this more complicated.
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=286206&r1=286205&r2=286206&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Nov 7 22:16:57 2016
@@ -237,6 +237,7 @@ protected:
BitstreamCursor Stream;
std::error_code initStream();
+ bool readBlockInfo();
virtual std::error_code error(const Twine &Message) = 0;
virtual ~BitcodeReaderBase() = default;
@@ -3758,6 +3759,11 @@ std::error_code BitcodeReader::parseBitc
}
}
+
+bool BitcodeReaderBase::readBlockInfo() {
+ return Stream.ReadBlockInfoBlock();
+}
+
std::error_code BitcodeReader::parseModule(uint64_t ResumeBit,
bool ShouldLazyLoadMetadata) {
if (ResumeBit)
@@ -3786,7 +3792,7 @@ std::error_code BitcodeReader::parseModu
return error("Invalid record");
break;
case bitc::BLOCKINFO_BLOCK_ID:
- if (Stream.ReadBlockInfoBlock())
+ if (readBlockInfo())
return error("Malformed block");
break;
case bitc::PARAMATTR_BLOCK_ID:
@@ -6153,7 +6159,7 @@ std::error_code ModuleSummaryIndexBitcod
break;
case bitc::BLOCKINFO_BLOCK_ID:
// Need to parse these to get abbrev ids (e.g. for VST)
- if (Stream.ReadBlockInfoBlock())
+ if (readBlockInfo())
return error("Malformed block");
break;
case bitc::VALUE_SYMTAB_BLOCK_ID:
More information about the llvm-commits
mailing list