Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1052833003: First attempt to capture parser/translation errors in browser. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits and syntax errors. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | unittest/BitcodeMunge.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 { // Lock while printing out error message.
490 Ice::OstreamLocker L(Context); 490 Ice::OstreamLocker L(Context);
491 raw_ostream &OldErrStream = setErrStream(Context->getStrDump()); 491 raw_ostream &OldErrStream = setErrStream(Context->getStrError());
492 NaClBitcodeParser::ErrorAt(Level, Bit, Message); 492 NaClBitcodeParser::ErrorAt(Level, Bit, Message);
493 setErrStream(OldErrStream); 493 setErrStream(OldErrStream);
494 } 494 }
495 if (Level >= naclbitc::Error && 495 if (Level >= naclbitc::Error &&
496 !Translator.getFlags().getAllowErrorRecovery()) 496 !Translator.getFlags().getAllowErrorRecovery())
497 Fatal(); 497 Fatal();
498 return true; 498 return true;
499 } 499 }
500 500
501 void TopLevelParser::reportBadTypeIDAs(unsigned ID, const ExtendedType *Ty, 501 void TopLevelParser::reportBadTypeIDAs(unsigned ID, const ExtendedType *Ty,
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 } 3016 }
3017 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3017 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3018 errs() << IRFilename 3018 errs() << IRFilename
3019 << ": 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";
3020 ErrorStatus.assign(EC_Bitcode); 3020 ErrorStatus.assign(EC_Bitcode);
3021 return; 3021 return;
3022 } 3022 }
3023 } 3023 }
3024 3024
3025 } // end of namespace Ice 3025 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | unittest/BitcodeMunge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698