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

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 nit. 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
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..dbfe11bf13f6c0f1a2d45175981276fc7761feec 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
@@ -488,9 +488,10 @@ public:
// 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.
+ // the method ErrorAt(ErrorLevel, Bit, Message) is overridden in
+ // the derived class, and calls this method twice. Once before
+ // calling base method Error(), and followed by a second call to
jvoung (off chromium) 2015/03/09 18:50:23 Another mention of "base method Error()". Probabl
Karl 2015/03/09 19:49:25 Done.
+ // restore the default error stream.
raw_ostream &setErrStream(raw_ostream &Stream) {
raw_ostream &OldErrStream = *ErrStream;
ErrStream = &Stream;
@@ -499,8 +500,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 +519,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') | lib/Bitcode/NaCl/Analysis/NaClObjDumpStream.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698