Move the bitcode error enum to the include directory.

This will let users in other libraries know which error occurred. In particular,
it will be possible to check if the parsing failed or if the file is not
bitcode.

llvm-svn: 214209
This commit is contained in:
Rafael Espindola
2014-07-29 20:22:46 +00:00
parent 7522b90640
commit 06b2000418
3 changed files with 280 additions and 276 deletions
+1 -28
View File
@@ -193,35 +193,8 @@ class BitcodeReader : public GVMaterializer {
/// not need this flag.
bool UseRelativeIDs;
static const std::error_category &BitcodeErrorCategory();
public:
enum ErrorType {
BitcodeStreamInvalidSize,
ConflictingMETADATA_KINDRecords,
CouldNotFindFunctionInStream,
ExpectedConstant,
InsufficientFunctionProtos,
InvalidBitcodeSignature,
InvalidBitcodeWrapperHeader,
InvalidConstantReference,
InvalidID, // A read identifier is not found in the table it should be in.
InvalidInstructionWithNoBB,
InvalidRecord, // A read record doesn't have the expected size or structure
InvalidTypeForValue, // Type read OK, but is invalid for its use
InvalidTYPETable,
InvalidType, // We were unable to read a type
MalformedBlock, // We are unable to advance in the stream.
MalformedGlobalInitializerSet,
InvalidMultipleBlocks, // We found multiple blocks of a kind that should
// have only one
NeverResolvedValueFoundInFunction,
InvalidValue // Invalid version, inst number, attr number, etc
};
std::error_code Error(ErrorType E) {
return std::error_code(E, BitcodeErrorCategory());
}
std::error_code Error(BitcodeError E) { return make_error_code(E); }
explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C)
: Context(C), TheModule(nullptr), Buffer(buffer), LazyStreamer(nullptr),