OLD | NEW |
1 //===- NaClBitcodeParser.cpp ----------------------------------------------===// | 1 //===- NaClBitcodeParser.cpp ----------------------------------------------===// |
2 // Low-level bitcode driver to parse PNaCl bitcode files. | 2 // Low-level bitcode driver to parse PNaCl bitcode files. |
3 // | 3 // |
4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
5 // | 5 // |
6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 Parser->ProcessAbbreviation(IsLocal ? Parser->GetBlockID() : GlobalBlockID, | 79 Parser->ProcessAbbreviation(IsLocal ? Parser->GetBlockID() : GlobalBlockID, |
80 Abbrev, IsLocal); | 80 Abbrev, IsLocal); |
81 } | 81 } |
82 | 82 |
83 NaClBitcodeParser::~NaClBitcodeParser() { | 83 NaClBitcodeParser::~NaClBitcodeParser() { |
84 if (EnclosingParser) { | 84 if (EnclosingParser) { |
85 EnclosingParser->Block.LocalStartBit += Block.GetNumBits(); | 85 EnclosingParser->Block.LocalStartBit += Block.GetNumBits(); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
| 89 bool NaClBitcodeParser::ErrorAt(uint64_t BitPosition, |
| 90 const std::string &Message) { |
| 91 *ErrStream << "Error(" << NaClBitstreamReader::getBitAddress(BitPosition, 1) |
| 92 << "): " << Message << "\n"; |
| 93 return true; |
| 94 } |
| 95 |
| 96 void NaClBitcodeParser::FatalAt(uint64_t BitPosition, |
| 97 const std::string &Message) { |
| 98 ErrorAt(BitPosition, Message); |
| 99 report_fatal_error("Unable to continue"); |
| 100 } |
| 101 |
89 bool NaClBitcodeParser::Parse() { | 102 bool NaClBitcodeParser::Parse() { |
90 Record.ReadEntry(); | 103 Record.ReadEntry(); |
91 | 104 |
92 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock) | 105 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock) |
93 return Error("Expected block, but not found"); | 106 return Error("Expected block, but not found"); |
94 | 107 |
95 return ParseBlock(Record.GetEntryID()); | 108 return ParseBlock(Record.GetEntryID()); |
96 } | 109 } |
97 | 110 |
98 bool NaClBitcodeParser::ParseBlockInfoInternal() { | 111 bool NaClBitcodeParser::ParseBlockInfoInternal() { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } else { | 155 } else { |
143 // Read in a record. | 156 // Read in a record. |
144 Record.ReadValues(); | 157 Record.ReadValues(); |
145 ProcessRecord(); | 158 ProcessRecord(); |
146 } | 159 } |
147 break; | 160 break; |
148 } | 161 } |
149 } | 162 } |
150 return false; | 163 return false; |
151 } | 164 } |
OLD | NEW |