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

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitcodeParser.h

Issue 986453002: Additional clean ups on errors in bitcode parsing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix comment. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClBitstreamReader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h b/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
index 06ad98a92ff1d5d18bc62165b0246c83020386c5..8c1e8fcdcf8a2ac17685964ad691d9a8220309bd 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
@@ -487,10 +487,7 @@ public:
// 1) To change (from the default errs()) inside the constructor of the
// derived class. In this context, it will be used for all error
// messages for the derived class.
- // 2) Temporarily modify it for a single error message. In this context,
- // the method Error() is overridden in the derived class, and
- // calls this method twice. Once before calling base method Error(),
- // and followed by a second call to restore the default error stream.
+ // 2) Temporarily modify it for a single error message.
raw_ostream &setErrStream(raw_ostream &Stream) {
raw_ostream &OldErrStream = *ErrStream;
ErrStream = &Stream;
@@ -499,8 +496,14 @@ public:
// Called when an error occurs. BitPosition is the bit position the
// error was found, and Message is the error to report. Always
- // returns true (the error return value of Parse).
- virtual bool ErrorAt(uint64_t BitPosition, const std::string &Message);
+ // returns true (the error return value of Parse). Level is
+ // the severity of the error.
+ virtual bool ErrorAt(naclbitc::ErrorLevel Level, uint64_t BitPosition,
+ const std::string &Message);
+
+ bool ErrorAt(uint64_t BitPosition, const std::string &Message) {
+ return ErrorAt(naclbitc::Error, BitPosition, Message);
+ }
// Called when an error occurs. Message is the error to
// report. Always returns true (the error return value of Parse).
@@ -512,7 +515,10 @@ public:
// the error was found, and Message is the error to report. Does not
// return.
LLVM_ATTRIBUTE_NORETURN
- virtual void FatalAt(uint64_t BitPosition, const std::string &Message);
+ void FatalAt(uint64_t BitPosition, const std::string &Message) {
+ ErrorAt(naclbitc::Fatal, BitPosition, Message);
+ llvm_unreachable("Fatal errors should not return");
+ }
// Called when a fatal error occurs. Message is the error to
// report. Does not return.
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClBitstreamReader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698