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

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitstreamReader.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 nits. 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/NaClBitstreamReader.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h b/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
index 4aa827d3d7c8716c5de71a57d03974b837af60ff..47fa7ebc3d654c61f4b7f9b4e3cdad940bb1b89d 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
@@ -27,6 +27,28 @@ namespace llvm {
class Deserializer;
+namespace naclbitc {
+
+/// Returns the Bit as a Byte:BitInByte string. MinByteWidth is the
jvoung (off chromium) 2015/03/06 22:30:27 There's no MinByteWidth argument for this function
Karl 2015/03/06 22:54:20 Good catch. Removing the sentence.
+/// minimum number of characters to print out the Byte value (blank
+/// fills).
+std::string getBitAddress(uint64_t Bit);
+
+/// Severity levels for reporting errors.
+enum ErrorLevel {
+ Warning,
+ Error,
+ Fatal
+};
+
+// Basic printing routine to generate the beginning of an error
+// message. BitPosition is the bit position the error was found.
+// Level is the severity of the error.
+raw_ostream &ErrorAt(raw_ostream &Out, ErrorLevel Level,
+ uint64_t BitPosition);
+
+} // End namespace naclbitc.
+
/// This class is used to read from a NaCl bitcode wire format stream,
/// maintaining information that is global to decoding the entire file.
/// While a file is being read, multiple cursors can be independently
@@ -88,11 +110,6 @@ public:
return InitialAddress;
}
- /// Returns the Bit as a Byte:BitInByte string. MinByteWidth is the
- /// minimum number of characters to print out the Byte value (blank
- /// fills).
- static std::string getBitAddress(uint64_t Bit, unsigned MinByteWidth=1);
-
//===--------------------------------------------------------------------===//
// Block Manipulation
//===--------------------------------------------------------------------===//
@@ -329,8 +346,8 @@ public:
/// Returns the current bit address (string) of the bit cursor.
/// MinByteWidth is the minimum number of characters to print out
jvoung (off chromium) 2015/03/06 22:30:27 There's no MinByteWidth parameter here anymore.
Karl 2015/03/06 22:54:20 Removed the sentence.
/// the Byte value (blank fills).
- std::string getCurrentBitAddress(unsigned MinByteWidth=1) const {
- return BitStream->getBitAddress(GetCurrentBitNo(), MinByteWidth);
+ std::string getCurrentBitAddress() const {
+ return naclbitc::getBitAddress(GetCurrentBitNo());
}
/// Flags that modify the behavior of advance().

Powered by Google App Engine
This is Rietveld 408576698