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...) 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 { // Lock while printing out error message. | 489 Ice::OstreamLocker L(Context); |
490 Ice::OstreamLocker L(Context); | 490 raw_ostream &OldErrStream = setErrStream(Context->getStrDump()); |
491 raw_ostream &OldErrStream = setErrStream(Context->getStrDump()); | 491 NaClBitcodeParser::ErrorAt(Level, Bit, Message); |
492 NaClBitcodeParser::ErrorAt(Level, Bit, Message); | 492 setErrStream(OldErrStream); |
493 setErrStream(OldErrStream); | |
494 } | |
495 if (Level >= naclbitc::Error && | 493 if (Level >= naclbitc::Error && |
496 !Translator.getFlags().getAllowErrorRecovery()) | 494 !Translator.getFlags().getAllowErrorRecovery()) |
497 Fatal(); | 495 Fatal(); |
498 return true; | 496 return true; |
499 } | 497 } |
500 | 498 |
501 void TopLevelParser::reportBadTypeIDAs(unsigned ID, const ExtendedType *Ty, | 499 void TopLevelParser::reportBadTypeIDAs(unsigned ID, const ExtendedType *Ty, |
502 ExtendedType::TypeKind WantedType) { | 500 ExtendedType::TypeKind WantedType) { |
503 std::string Buffer; | 501 std::string Buffer; |
504 raw_string_ostream StrBuf(Buffer); | 502 raw_string_ostream StrBuf(Buffer); |
(...skipping 2511 matching lines...) Loading... |
3016 } | 3014 } |
3017 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { | 3015 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { |
3018 errs() << IRFilename | 3016 errs() << IRFilename |
3019 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; | 3017 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; |
3020 ErrorStatus.assign(EC_Bitcode); | 3018 ErrorStatus.assign(EC_Bitcode); |
3021 return; | 3019 return; |
3022 } | 3020 } |
3023 } | 3021 } |
3024 | 3022 |
3025 } // end of namespace Ice | 3023 } // end of namespace Ice |
OLD | NEW |