Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===// | 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file implements the PNaCl bitcode file to Ice, to machine code | 10 // This file implements the PNaCl bitcode file to Ice, to machine code |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 // Reports that there is no corresponding ICE type for LLVMTy, and | 479 // Reports that there is no corresponding ICE type for LLVMTy, and |
| 480 // returns ICE::IceType_void. | 480 // returns ICE::IceType_void. |
| 481 Ice::Type convertToIceTypeError(Type *LLVMTy); | 481 Ice::Type convertToIceTypeError(Type *LLVMTy); |
| 482 }; | 482 }; |
| 483 | 483 |
| 484 bool TopLevelParser::ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit, | 484 bool TopLevelParser::ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit, |
| 485 const std::string &Message) { | 485 const std::string &Message) { |
| 486 ErrorStatus.assign(Ice::EC_Bitcode); | 486 ErrorStatus.assign(Ice::EC_Bitcode); |
| 487 ++NumErrors; | 487 ++NumErrors; |
| 488 Ice::GlobalContext *Context = Translator.getContext(); | 488 Ice::GlobalContext *Context = Translator.getContext(); |
| 489 Ice::OstreamLocker L(Context); | 489 { // Lock while printing out error message. |
| 490 raw_ostream &OldErrStream = setErrStream(Context->getStrDump()); | 490 Ice::OstreamLocker L(Context); |
| 491 NaClBitcodeParser::ErrorAt(Level, Bit, Message); | 491 raw_ostream &OldErrStream = setErrStream(Context->getStrDump()); |
| 492 setErrStream(OldErrStream); | 492 NaClBitcodeParser::ErrorAt(Level, Bit, Message); |
| 493 setErrStream(OldErrStream); | |
| 494 } | |
| 493 if (Level >= naclbitc::Error && | 495 if (Level >= naclbitc::Error && |
| 494 !Translator.getFlags().getAllowErrorRecovery()) | 496 !Translator.getFlags().getAllowErrorRecovery()) |
| 495 Fatal(); | 497 Fatal(); |
|
jvoung (off chromium)
2015/04/16 19:11:52
I was wondering why not just report_fatal_error he
Karl
2015/04/16 19:58:51
The point of calling fatal() is that it uses exist
jvoung (off chromium)
2015/04/16 20:22:47
Ok right, because this call to Fatal() has no para
| |
| 496 return true; | 498 return true; |
| 497 } | 499 } |
| 498 | 500 |
| 499 void TopLevelParser::reportBadTypeIDAs(unsigned ID, const ExtendedType *Ty, | 501 void TopLevelParser::reportBadTypeIDAs(unsigned ID, const ExtendedType *Ty, |
| 500 ExtendedType::TypeKind WantedType) { | 502 ExtendedType::TypeKind WantedType) { |
| 501 std::string Buffer; | 503 std::string Buffer; |
| 502 raw_string_ostream StrBuf(Buffer); | 504 raw_string_ostream StrBuf(Buffer); |
| 503 if (Ty == nullptr) { | 505 if (Ty == nullptr) { |
| 504 StrBuf << "Can't find extended type for type id: " << ID; | 506 StrBuf << "Can't find extended type for type id: " << ID; |
| 505 } else { | 507 } else { |
| (...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3014 } | 3016 } |
| 3015 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { | 3017 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { |
| 3016 errs() << IRFilename | 3018 errs() << IRFilename |
| 3017 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; | 3019 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; |
| 3018 ErrorStatus.assign(EC_Bitcode); | 3020 ErrorStatus.assign(EC_Bitcode); |
| 3019 return; | 3021 return; |
| 3020 } | 3022 } |
| 3021 } | 3023 } |
| 3022 | 3024 |
| 3023 } // end of namespace Ice | 3025 } // end of namespace Ice |
| OLD | NEW |