[PATCH] Refactor bitcode reader to simplify control.
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Mon Jun 15 12:55:37 PDT 2015
Applying the patch locally to take a better look.
================
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.
================
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.
================
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.
http://reviews.llvm.org/D8786
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list