llvm.org GIT mirror llvm / 8669714
The stream to read from is now an ivar git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36615 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
2 changed file(s) with 18 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
151151 }
152152
153153
154 bool BitcodeReader::ParseTypeTable(BitstreamReader &Stream) {
154 bool BitcodeReader::ParseTypeTable() {
155155 if (Stream.EnterSubBlock())
156156 return Error("Malformed block record");
157157
297297 }
298298
299299
300 bool BitcodeReader::ParseTypeSymbolTable(BitstreamReader &Stream) {
300 bool BitcodeReader::ParseTypeSymbolTable() {
301301 if (Stream.EnterSubBlock())
302302 return Error("Malformed block record");
303303
345345 }
346346 }
347347
348 bool BitcodeReader::ParseValueSymbolTable(BitstreamReader &Stream) {
348 bool BitcodeReader::ParseValueSymbolTable() {
349349 if (Stream.EnterSubBlock())
350350 return Error("Malformed block record");
351351
443443 }
444444
445445
446 bool BitcodeReader::ParseConstants(BitstreamReader &Stream) {
446 bool BitcodeReader::ParseConstants() {
447447 if (Stream.EnterSubBlock())
448448 return Error("Malformed block record");
449449
660660
661661 /// ParseFunction - When we see the block for a function body, remember where it
662662 /// is and then skip it. This lets us lazily deserialize the functions.
663 bool BitcodeReader::ParseFunction(BitstreamReader &Stream) {
663 bool BitcodeReader::ParseFunction() {
664664 // Get the function we are talking about.
665665 if (FunctionsWithBodies.empty())
666666 return Error("Insufficient function protos");
682682 return false;
683683 }
684684
685 bool BitcodeReader::ParseModule(BitstreamReader &Stream,
686 const std::string &ModuleID) {
685 bool BitcodeReader::ParseModule(const std::string &ModuleID) {
687686 // Reject multiple MODULE_BLOCK's in a single bitstream.
688687 if (TheModule)
689688 return Error("Multiple MODULE_BLOCKs in same stream");
718717 return Error("Malformed block record");
719718 break;
720719 case bitc::TYPE_BLOCK_ID:
721 if (ParseTypeTable(Stream))
720 if (ParseTypeTable())
722721 return true;
723722 break;
724723 case bitc::TYPE_SYMTAB_BLOCK_ID:
725 if (ParseTypeSymbolTable(Stream))
724 if (ParseTypeSymbolTable())
726725 return true;
727726 break;
728727 case bitc::VALUE_SYMTAB_BLOCK_ID:
729 if (ParseValueSymbolTable(Stream))
728 if (ParseValueSymbolTable())
730729 return true;
731730 break;
732731 case bitc::CONSTANTS_BLOCK_ID:
733 if (ParseConstants(Stream) || ResolveGlobalAndAliasInits())
732 if (ParseConstants() || ResolveGlobalAndAliasInits())
734733 return true;
735734 break;
736735 case bitc::FUNCTION_BLOCK_ID:
741740 HasReversedFunctionsWithBodies = true;
742741 }
743742
744 if (ParseFunction(Stream))
743 if (ParseFunction())
745744 return true;
746745 break;
747746 }
931930
932931 // We only know the MODULE subblock ID.
933932 if (BlockID == bitc::MODULE_BLOCK_ID) {
934 if (ParseModule(Stream, Buffer->getBufferIdentifier()))
933 if (ParseModule(Buffer->getBufferIdentifier()))
935934 return true;
936935 } else if (Stream.SkipBlock()) {
937936 return Error("Malformed block record");
2222 #include
2323
2424 namespace llvm {
25 class BitstreamReader;
2625 class MemoryBuffer;
2726
2827 class BitcodeReaderValueList : public User {
116115 private:
117116 const Type *getTypeByID(unsigned ID, bool isTypeTable = false);
118117
119 bool ParseModule(BitstreamReader &Stream, const std::string &ModuleID);
120 bool ParseTypeTable(BitstreamReader &Stream);
121 bool ParseTypeSymbolTable(BitstreamReader &Stream);
122 bool ParseValueSymbolTable(BitstreamReader &Stream);
123 bool ParseConstants(BitstreamReader &Stream);
124 bool ParseFunction(BitstreamReader &Stream);
118 bool ParseModule(const std::string &ModuleID);
119 bool ParseTypeTable();
120 bool ParseTypeSymbolTable();
121 bool ParseValueSymbolTable();
122 bool ParseConstants();
123 bool ParseFunction();
125124 bool ResolveGlobalAndAliasInits();
126125 };
127126