[llvm-commits] [llvm] r151676 - in /llvm/trunk/lib/Bitcode/Reader: BitcodeReader.cpp BitcodeReader.h
Derek Schuff
dschuff at google.com
Tue Feb 28 16:07:10 PST 2012
Author: dschuff
Date: Tue Feb 28 18:07:09 2012
New Revision: 151676
URL: http://llvm.org/viewvc/llvm-project?rev=151676&view=rev
Log:
Fix PR12080 by ensuring that MaterializeModule actually reads all the bitcode
in the streaming case.
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=151676&r1=151675&r2=151676&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Feb 28 18:07:09 2012
@@ -2789,6 +2789,12 @@
Materialize(F, ErrInfo))
return true;
+ // At this point, if there are any function bodies, the current bit is
+ // pointing to the END_BLOCK record after them. Now make sure the rest
+ // of the bits in the module have been read.
+ if (NextUnreadBit)
+ ParseModule(true);
+
// Upgrade any intrinsic calls that slipped through (should not happen!) and
// delete the old functions to clean up. We can't do this unless the entire
// module is materialized because there could always be another function body
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=151676&r1=151675&r2=151676&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Tue Feb 28 18:07:09 2012
@@ -182,13 +182,15 @@
public:
explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C)
: Context(C), TheModule(0), Buffer(buffer), BufferOwned(false),
- LazyStreamer(0), SeenValueSymbolTable(false), ErrorString(0),
- ValueList(C), MDValueList(C), SeenFirstFunctionBody(false) {
+ LazyStreamer(0), NextUnreadBit(0), SeenValueSymbolTable(false),
+ ErrorString(0), ValueList(C), MDValueList(C),
+ SeenFirstFunctionBody(false) {
}
explicit BitcodeReader(DataStreamer *streamer, LLVMContext &C)
: Context(C), TheModule(0), Buffer(0), BufferOwned(false),
- LazyStreamer(streamer), SeenValueSymbolTable(false), ErrorString(0),
- ValueList(C), MDValueList(C), SeenFirstFunctionBody(false) {
+ LazyStreamer(streamer), NextUnreadBit(0), SeenValueSymbolTable(false),
+ ErrorString(0), ValueList(C), MDValueList(C),
+ SeenFirstFunctionBody(false) {
}
~BitcodeReader() {
FreeState();
More information about the llvm-commits
mailing list