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

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

Issue 14314016: Copy LLVM bitcode reader to generate a PNaCl wire format reader. (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
similarity index 91%
copy from include/llvm/Bitcode/BitstreamReader.h
copy to include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
index 2d2976cde13ca867b8a1344c25979a0569203ffa..fa440566d4a16d4b3d0ea5e624a91fc12c23af1e 100644
--- a/include/llvm/Bitcode/BitstreamReader.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitstreamReader.h
@@ -1,4 +1,5 @@
-//===- BitstreamReader.h - Low-level bitstream reader interface -*- C++ -*-===//
+//===- NaClBitstreamReader.h -----------------------------------*- C++ -*-===//
+// Low-level bitstream reader interface
//
// The LLVM Compiler Infrastructure
//
@@ -12,8 +13,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_BITCODE_BITSTREAMREADER_H
-#define LLVM_BITCODE_BITSTREAMREADER_H
+#ifndef LLVM_BITCODE_NACL_NACLBITSTREAMREADER_H
+#define LLVM_BITCODE_NACL_NACLBITSTREAMREADER_H
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Bitcode/BitCodes.h"
@@ -27,12 +28,12 @@ namespace llvm {
class Deserializer;
-/// BitstreamReader - This class is used to read from an LLVM bitcode stream,
+/// NaClBitstreamReader - This class is used to read from an LLVM bitcode stream,
/// maintaining information that is global to decoding the entire file. While
/// a file is being read, multiple cursors can be independently advanced or
/// skipped around within the file. These are represented by the
-/// BitstreamCursor class.
-class BitstreamReader {
+/// NaClBitstreamCursor class.
+class NaClBitstreamReader {
public:
/// BlockInfo - This contains information emitted to BLOCKINFO_BLOCK blocks.
/// These describe abbreviations that all blocks of the specified ID inherit.
@@ -53,18 +54,18 @@ private:
/// uses this.
bool IgnoreBlockInfoNames;
- BitstreamReader(const BitstreamReader&) LLVM_DELETED_FUNCTION;
- void operator=(const BitstreamReader&) LLVM_DELETED_FUNCTION;
+ NaClBitstreamReader(const NaClBitstreamReader&) LLVM_DELETED_FUNCTION;
+ void operator=(const NaClBitstreamReader&) LLVM_DELETED_FUNCTION;
public:
- BitstreamReader() : IgnoreBlockInfoNames(true) {
+ NaClBitstreamReader() : IgnoreBlockInfoNames(true) {
}
- BitstreamReader(const unsigned char *Start, const unsigned char *End) {
+ NaClBitstreamReader(const unsigned char *Start, const unsigned char *End) {
IgnoreBlockInfoNames = true;
init(Start, End);
}
- BitstreamReader(StreamableMemoryObject *bytes) {
+ NaClBitstreamReader(StreamableMemoryObject *bytes) {
BitcodeBytes.reset(bytes);
}
@@ -75,7 +76,7 @@ public:
StreamableMemoryObject &getBitcodeBytes() { return *BitcodeBytes; }
- ~BitstreamReader() {
+ ~NaClBitstreamReader() {
// Free the BlockInfoRecords.
while (!BlockInfoRecords.empty()) {
BlockInfo &Info = BlockInfoRecords.back();
@@ -159,15 +160,15 @@ struct BitstreamEntry {
}
};
-/// BitstreamCursor - This represents a position within a bitcode file. There
-/// may be multiple independent cursors reading within one bitstream, each
-/// maintaining their own local state.
+/// NaClBitstreamCursor - This represents a position within a bitcode
+/// file. There may be multiple independent cursors reading within
+/// one bitstream, each maintaining their own local state.
///
-/// Unlike iterators, BitstreamCursors are heavy-weight objects that should not
-/// be passed by value.
-class BitstreamCursor {
+/// Unlike iterators, NaClBitstreamCursors are heavy-weight objects
+/// that should not be passed by value.
+class NaClBitstreamCursor {
friend class Deserializer;
- BitstreamReader *BitStream;
+ NaClBitstreamReader *BitStream;
size_t NextChar;
@@ -201,20 +202,21 @@ class BitstreamCursor {
public:
- BitstreamCursor() : BitStream(0), NextChar(0) {
+ NaClBitstreamCursor() : BitStream(0), NextChar(0) {
}
- BitstreamCursor(const BitstreamCursor &RHS) : BitStream(0), NextChar(0) {
+ NaClBitstreamCursor(const NaClBitstreamCursor &RHS)
+ : BitStream(0), NextChar(0) {
operator=(RHS);
}
- explicit BitstreamCursor(BitstreamReader &R) : BitStream(&R) {
+ explicit NaClBitstreamCursor(NaClBitstreamReader &R) : BitStream(&R) {
NextChar = 0;
CurWord = 0;
BitsInCurWord = 0;
CurCodeSize = 2;
}
- void init(BitstreamReader &R) {
+ void init(NaClBitstreamReader &R) {
freeState();
BitStream = &R;
@@ -224,11 +226,11 @@ public:
CurCodeSize = 2;
}
- ~BitstreamCursor() {
+ ~NaClBitstreamCursor() {
freeState();
}
- void operator=(const BitstreamCursor &RHS);
+ void operator=(const NaClBitstreamCursor &RHS);
void freeState();
@@ -260,10 +262,10 @@ public:
return NextChar*CHAR_BIT - BitsInCurWord;
}
- BitstreamReader *getBitStreamReader() {
+ NaClBitstreamReader *getBitStreamReader() {
return BitStream;
}
- const BitstreamReader *getBitStreamReader() const {
+ const NaClBitstreamReader *getBitStreamReader() const {
return BitStream;
}
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClReaderWriter.h » ('j') | include/llvm/Bitcode/NaCl/NaClReaderWriter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698