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, | 89 bool NaClBitcodeParser::ErrorAt( |
90 const std::string &Message) { | 90 naclbitc::ErrorLevel Level, uint64_t BitPosition, |
91 *ErrStream << "Error(" << NaClBitstreamReader::getBitAddress(BitPosition, 1) | 91 const std::string &Message) { |
92 << "): " << Message << "\n"; | 92 naclbitc::ErrorAt(*ErrStream, Level, BitPosition) << Message << "\n"; |
| 93 if (Level == naclbitc::Fatal) |
| 94 report_fatal_error("Unable to continue"); |
93 return true; | 95 return true; |
94 } | 96 } |
95 | 97 |
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 | |
102 bool NaClBitcodeParser::Parse() { | 98 bool NaClBitcodeParser::Parse() { |
103 Record.ReadEntry(); | 99 Record.ReadEntry(); |
104 | 100 |
105 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock) | 101 if (Record.GetEntryKind() != NaClBitstreamEntry::SubBlock) |
106 return Error("Expected block, but not found"); | 102 return Error("Expected block, but not found"); |
107 | 103 |
108 return ParseBlock(Record.GetEntryID()); | 104 return ParseBlock(Record.GetEntryID()); |
109 } | 105 } |
110 | 106 |
111 bool NaClBitcodeParser::ParseBlockInfoInternal() { | 107 bool NaClBitcodeParser::ParseBlockInfoInternal() { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } else { | 150 } else { |
155 // Read in a record. | 151 // Read in a record. |
156 Record.ReadValues(); | 152 Record.ReadValues(); |
157 ProcessRecord(); | 153 ProcessRecord(); |
158 } | 154 } |
159 break; | 155 break; |
160 } | 156 } |
161 } | 157 } |
162 return false; | 158 return false; |
163 } | 159 } |
OLD | NEW |