diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-15 06:13:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-15 06:13:09 +0000 |
commit | 7969dc2beca333e556b533053a94777169ffaa98 (patch) | |
tree | 7bc16347bb7f22e61c460de4f8c9f3499d053978 /lib/Bytecode/Reader/ReaderInternals.h | |
parent | c8434e3d71105e2e908c7b07fc190a74c6b2ddf0 (diff) |
Change all of the bytecode reader primitives to throw exceptions instead of
returning error codes. Because they don't return an error code, they can
return the value read, which simplifies the code and makes the reader more
efficient (yaay!).
Also eliminate the special case code for little endian machines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10871 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/ReaderInternals.h')
-rw-r--r-- | lib/Bytecode/Reader/ReaderInternals.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h index 54a38e457b..deb120672a 100644 --- a/lib/Bytecode/Reader/ReaderInternals.h +++ b/lib/Bytecode/Reader/ReaderInternals.h @@ -214,23 +214,11 @@ struct ConstantPlaceHolderHelper : public ConstantExpr { typedef PlaceholderDef<ConstantPlaceHolderHelper> ConstPHolder; -// Some common errors we find -static const std::string Error_readvbr = "read_vbr(): error reading."; -static const std::string Error_read = "read(): error reading."; -static const std::string Error_inputdata = "input_data(): error reading."; -static const std::string Error_DestSlot = "No destination slot found."; - static inline void readBlock(const unsigned char *&Buf, const unsigned char *EndBuf, unsigned &Type, unsigned &Size) { -#ifdef DEBUG_OUTPUT - bool Result = read(Buf, EndBuf, Type) || read(Buf, EndBuf, Size); - std::cerr << "StartLoc = " << ((unsigned)Buf & 4095) - << " Type = " << Type << " Size = " << Size << "\n"; - if (Result) throw Error_read; -#else - if (read(Buf, EndBuf, Type) || read(Buf, EndBuf, Size)) throw Error_read; -#endif + Type = read(Buf, EndBuf); + Size = read(Buf, EndBuf); } } // End llvm namespace |