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

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

Issue 23753003: Report fatal translator errors to the browser (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: split errors from streamable readBytes and Header ReadPrefix Created 7 years, 3 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 | lib/Bitcode/NaCl/Reader/NaClBitcodeHeader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h b/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h
index 4f5f83a17a6cca5a9fc3926f7cbf4261f9d01bf9..214971e701fa57a36a181a20bc422100fecfb27f 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h
@@ -16,6 +16,7 @@
#ifndef LLVM_BITCODE_NACL_NACLBITCODEHEADER_H
#define LLVM_BITCODE_NACL_NACLBITCODEHEADER_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <string>
@@ -148,7 +149,7 @@ public:
~NaClBitcodeHeader();
/// \brief Installs the fields of the header, defining if the header
- /// is readable and supported.
+ /// is readable and supported. Sets UnsupportedMessage on failure.
void InstallFields();
/// \brief Adds a field to the list of fields in a header. Takes ownership
@@ -209,15 +210,21 @@ private:
// Reads and verifies the first 8 bytes of the header, consisting
// of the magic number 'PEXE', and the value defining the number
// of fields and number of bytes used to hold fields.
- // Returns false if successful.
+ // Returns false if successful, sets UnsupportedMessage otherwise.
bool ReadPrefix(const unsigned char *BufPtr, const unsigned char *BufEnd,
unsigned &NumFields, unsigned &NumBytes);
// Reads and verifies the fields in the header.
- // Returns false if successful.
+ // Returns false if successful, sets UnsupportedMessage otherwise.
bool ReadFields(const unsigned char *BufPtr, const unsigned char *BufEnd,
unsigned NumFields, unsigned NumBytes);
+ // Sets the Unsupported error message and returns true.
+ bool UnsupportedError(StringRef Message) {
+ UnsupportedMessage = Message.str();
+ return true;
+ }
+
};
} // namespace llvm
« no previous file with comments | « no previous file | lib/Bitcode/NaCl/Reader/NaClBitcodeHeader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698