OLD | NEW |
1 //===- NaClBitcodeReader.cpp ----------------------------------------------===// | 1 //===- NaClBitcodeReader.cpp ----------------------------------------------===// |
2 // Internal NaClBitcodeReader implementation | 2 // Internal NaClBitcodeReader implementation |
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 static const unsigned MaxAlignmentExponent = 29; | 186 static const unsigned MaxAlignmentExponent = 29; |
187 static_assert( | 187 static_assert( |
188 (1u << MaxAlignmentExponent) == Value::MaximumAlignment, | 188 (1u << MaxAlignmentExponent) == Value::MaximumAlignment, |
189 "Inconsistency between Value.MaxAlignment and PNaCl alignment limit"); | 189 "Inconsistency between Value.MaxAlignment and PNaCl alignment limit"); |
190 } | 190 } |
191 | 191 |
192 std::error_code NaClBitcodeReader::Error(ErrorType E, | 192 std::error_code NaClBitcodeReader::Error(ErrorType E, |
193 const std::string &Message) const { | 193 const std::string &Message) const { |
194 if (Verbose) { | 194 if (Verbose) { |
195 uint64_t Bit = Stream.GetCurrentBitNo(); | 195 naclbitc::ErrorAt(*Verbose, naclbitc::Error, Stream.GetCurrentBitNo()) |
196 *Verbose << "Error: (" << (Bit / CHAR_BIT) << ":" | 196 << Message << "\n"; |
197 << static_cast<unsigned>(Bit % CHAR_BIT) | |
198 << ") " << Message << "\n"; | |
199 } | 197 } |
200 return Error(E); | 198 return Error(E); |
201 } | 199 } |
202 | 200 |
203 std::error_code NaClBitcodeReader::getAlignmentValue( | 201 std::error_code NaClBitcodeReader::getAlignmentValue( |
204 uint64_t Exponent, unsigned &Alignment) { | 202 uint64_t Exponent, unsigned &Alignment) { |
205 if (Exponent > MaxAlignmentExponent + 1) { | 203 if (Exponent > MaxAlignmentExponent + 1) { |
206 std::string Buffer; | 204 std::string Buffer; |
207 raw_string_ostream StrBuf(Buffer); | 205 raw_string_ostream StrBuf(Buffer); |
208 StrBuf << "Alignment can't be greater than 2**" << MaxAlignmentExponent | 206 StrBuf << "Alignment can't be greater than 2**" << MaxAlignmentExponent |
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1937 if (std::error_code EC = M->materializeAllPermanently()) { | 1935 if (std::error_code EC = M->materializeAllPermanently()) { |
1938 delete M; | 1936 delete M; |
1939 return EC; | 1937 return EC; |
1940 } | 1938 } |
1941 | 1939 |
1942 // TODO: Restore the use-lists to the in-memory state when the bitcode was | 1940 // TODO: Restore the use-lists to the in-memory state when the bitcode was |
1943 // written. We must defer until the Module has been fully materialized. | 1941 // written. We must defer until the Module has been fully materialized. |
1944 | 1942 |
1945 return M; | 1943 return M; |
1946 } | 1944 } |
OLD | NEW |