[PATCH] Refactor bitcode reader to simplify control.
kschimpf at google.com
Wed Jun 17 13:57:38 PDT 2015
This CL has gotten a bit long, and hard to read (to many versions). Moved to a new CL http://reviews.llvm.org/D10518
Comment at: lib/Bitcode/Reader/BitcodeReader.cpp:269
@@ -244,5 +268,3 @@
- /// @brief Main interface to parsing a bitcode buffer.
- /// @returns true if an error occurred.
- std::error_code ParseBitcodeInto(Module *M,
- bool ShouldLazyLoadMetadata = false);
+ /// \brief Starts parse of bitcode. Materializes during parse based on flags.
> Please commit the pure cleanup bits first:
> using \ instead of @
> starting functions with lowercase names.
I assume this has already been done. The new CL doesn't have suc cases anymore.
Comment at: lib/Bitcode/Reader/BitcodeReader.cpp:3234
@@ +3233,3 @@
+ StrBuf << "Malformed IR file at bit " << format("%x", (Bit / CHAR_BIT))
+ << ":" << (Bit % CHAR_BIT);
+ return Error(StrBuf.str());
> This looks a bit much to be honest. Corrupted files are not that common and it is trivial to set a breakpoint to find the state.
Simplified in new CL to do same as before.
Comment at: lib/Bitcode/Reader/BitcodeReader.cpp:3245
@@ -3133,3 +3244,3 @@
// Reject multiple MODULE_BLOCK's in a single bitstream.
- if (TheModule)
+ if (NumModulesParsed++)
return Error("Invalid multiple blocks");
> This is always 0 or 1. Use a boolean instead.
This was already fixed in master.
More information about the llvm-commits