summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-07-29 21:01:24 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-07-29 21:01:24 +0000
commit27435250328b4c4eb0dfb80b088be76a0f98b2ea (patch)
tree14a1538e7bb6bfd3ec4792482933b74565270c9b /llvm/lib/Bitcode/Reader
parent1eb18309d5c1c1b6e58f2366a7f6253abdddc682 (diff)
downloadbcm5719-llvm-27435250328b4c4eb0dfb80b088be76a0f98b2ea.tar.gz
bcm5719-llvm-27435250328b4c4eb0dfb80b088be76a0f98b2ea.zip
Have a single enum for "not a bitcode" error.
This is more convenient for callers. No functionality change, this will be used in a next patch to the gold plugin. llvm-svn: 214218
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index ce66a3d0c78..9dd209df124 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3350,12 +3350,8 @@ std::error_code BitcodeReader::InitStreamFromBuffer() {
const unsigned char *BufPtr = (const unsigned char*)Buffer->getBufferStart();
const unsigned char *BufEnd = BufPtr+Buffer->getBufferSize();
- if (Buffer->getBufferSize() & 3) {
- if (!isRawBitcode(BufPtr, BufEnd) && !isBitcodeWrapper(BufPtr, BufEnd))
- return Error(BitcodeError::InvalidBitcodeSignature);
- else
- return Error(BitcodeError::BitcodeStreamInvalidSize);
- }
+ if (Buffer->getBufferSize() & 3)
+ return Error(BitcodeError::InvalidBitcodeSignature);
// If we have a wrapper header, parse it and ignore the non-bc file contents.
// The magic number is 0x0B17C0DE stored in little endian.
@@ -3378,7 +3374,7 @@ std::error_code BitcodeReader::InitLazyStream() {
unsigned char buf[16];
if (Bytes->readBytes(0, 16, buf) == -1)
- return Error(BitcodeError::BitcodeStreamInvalidSize);
+ return Error(BitcodeError::InvalidBitcodeSignature);
if (!isBitcode(buf, buf + 16))
return Error(BitcodeError::InvalidBitcodeSignature);
@@ -3401,8 +3397,6 @@ class BitcodeErrorCategoryType : public std::error_category {
std::string message(int IE) const override {
BitcodeError E = static_cast<BitcodeError>(IE);
switch (E) {
- case BitcodeError::BitcodeStreamInvalidSize:
- return "Bitcode stream length should be >= 16 bytes and a multiple of 4";
case BitcodeError::ConflictingMETADATA_KINDRecords:
return "Conflicting METADATA_KIND records";
case BitcodeError::CouldNotFindFunctionInStream:
OpenPOWER on IntegriCloud