Add two of the float related ARM-specific entries for e_flags needed for
[oota-llvm.git] / include / llvm / Support / StreamableMemoryObject.h
index ab480864d0f51fe78533987f7eba36f009dec4ac..385548579b1f20c1317323840f2ed200400f87b5 100644 (file)
@@ -8,12 +8,13 @@
 //===----------------------------------------------------------------------===//
 
 
-#ifndef STREAMABLEMEMORYOBJECT_H_
-#define STREAMABLEMEMORYOBJECT_H_
+#ifndef LLVM_SUPPORT_STREAMABLEMEMORYOBJECT_H
+#define LLVM_SUPPORT_STREAMABLEMEMORYOBJECT_H
 
 #include "llvm/ADT/OwningPtr.h"
-#include "llvm/Support/MemoryObject.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DataStream.h"
+#include "llvm/Support/MemoryObject.h"
 #include <vector>
 
 namespace llvm {
@@ -45,7 +46,7 @@ class StreamableMemoryObject : public MemoryObject {
   ///                   May block until all bytes in the stream have been read
   ///
   /// @result         - The size of the region.
-  virtual uint64_t getExtent() = 0;
+  virtual uint64_t getExtent() const = 0;
 
   /// readByte        - Tries to read a single byte from the region.
   ///                   May block until (address - base) bytes have been read
@@ -53,7 +54,7 @@ class StreamableMemoryObject : public MemoryObject {
   /// @param ptr      - A pointer to a byte to be filled in.  Must be non-NULL.
   /// @result         - 0 if successful; -1 if not.  Failure may be due to a
   ///                   bounds violation or an implementation-specific error.
-  virtual int readByte(uint64_t address, uint8_t* ptr) = 0;
+  virtual int readByte(uint64_t address, uint8_t* ptr) const = 0;
 
   /// readBytes       - Tries to read a contiguous range of bytes from the
   ///                   region, up to the end of the region.
@@ -74,7 +75,7 @@ class StreamableMemoryObject : public MemoryObject {
   virtual int readBytes(uint64_t address,
                         uint64_t size,
                         uint8_t* buf,
-                        uint64_t* copied) = 0;
+                        uint64_t* copied) const = 0;
 
   /// getPointer  - Ensures that the requested data is in memory, and returns
   ///               A pointer to it. More efficient than using readBytes if the
@@ -83,21 +84,21 @@ class StreamableMemoryObject : public MemoryObject {
   /// @param address - address of the byte, in the same space as getBase()
   /// @param size    - amount of data that must be available on return
   /// @result        - valid pointer to the requested data
-  virtual const uint8_t *getPointer(uint64_t address, uint64_t size) = 0;
+  virtual const uint8_t *getPointer(uint64_t address, uint64_t size) const = 0;
 
   /// isValidAddress - Returns true if the address is within the object
   ///                  (i.e. between base and base + extent - 1 inclusive)
   ///                  May block until (address - base) bytes have been read
   /// @param address - address of the byte, in the same space as getBase()
   /// @result        - true if the address may be read with readByte()
-  virtual bool isValidAddress(uint64_t address) = 0;
+  virtual bool isValidAddress(uint64_t address) const = 0;
 
   /// isObjectEnd    - Returns true if the address is one past the end of the
   ///                  object (i.e. if it is equal to base + extent)
   ///                  May block until (address - base) bytes have been read
   /// @param address - address of the byte, in the same space as getBase()
   /// @result        - true if the address is equal to base + extent
-  virtual bool isObjectEnd(uint64_t address) = 0;
+  virtual bool isObjectEnd(uint64_t address) const = 0;
 };
 
 /// StreamingMemoryObject - interface to data which is actually streamed from
@@ -107,14 +108,15 @@ class StreamableMemoryObject : public MemoryObject {
 class StreamingMemoryObject : public StreamableMemoryObject {
 public:
   StreamingMemoryObject(DataStreamer *streamer);
-  virtual uint64_t getBase() const { return 0; }
-  virtual uint64_t getExtent();
-  virtual int readByte(uint64_t address, uint8_t* ptr);
+  virtual uint64_t getBase() const LLVM_OVERRIDE { return 0; }
+  virtual uint64_t getExtent() const LLVM_OVERRIDE;
+  virtual int readByte(uint64_t address, uint8_t* ptr) const LLVM_OVERRIDE;
   virtual int readBytes(uint64_t address,
                         uint64_t size,
                         uint8_t* buf,
-                        uint64_t* copied);
-  virtual const uint8_t *getPointer(uint64_t address, uint64_t size) {
+                        uint64_t* copied) const LLVM_OVERRIDE;
+  virtual const uint8_t *getPointer(uint64_t address,
+                                    uint64_t size) const LLVM_OVERRIDE {
     // This could be fixed by ensuring the bytes are fetched and making a copy,
     // requiring that the bitcode size be known, or otherwise ensuring that
     // the memory doesn't go away/get reallocated, but it's
@@ -122,8 +124,8 @@ public:
     assert(0 && "getPointer in streaming memory objects not allowed");
     return NULL;
   }
-  virtual bool isValidAddress(uint64_t address);
-  virtual bool isObjectEnd(uint64_t address);
+  virtual bool isValidAddress(uint64_t address) const LLVM_OVERRIDE;
+  virtual bool isObjectEnd(uint64_t address) const LLVM_OVERRIDE;
 
   /// Drop s bytes from the front of the stream, pushing the positions of the
   /// remaining bytes down by s. This is used to skip past the bitcode header,
@@ -138,19 +140,19 @@ public:
 
 private:
   const static uint32_t kChunkSize = 4096 * 4;
-  std::vector<unsigned char> Bytes;
+  mutable std::vector<unsigned char> Bytes;
   OwningPtr<DataStreamer> Streamer;
-  size_t BytesRead;   // Bytes read from stream
+  mutable size_t BytesRead;   // Bytes read from stream
   size_t BytesSkipped;// Bytes skipped at start of stream (e.g. wrapper/header)
-  size_t ObjectSize; // 0 if unknown, set if wrapper was seen or EOF reached
-  bool EOFReached;
+  mutable size_t ObjectSize; // 0 if unknown, set if wrapper seen or EOF reached
+  mutable bool EOFReached;
 
   // Fetch enough bytes such that Pos can be read or EOF is reached
   // (i.e. BytesRead > Pos). Return true if Pos can be read.
   // Unlike most of the functions in BitcodeReader, returns true on success.
   // Most of the requests will be small, but we fetch at kChunkSize bytes
   // at a time to avoid making too many potentially expensive GetBytes calls
-  bool fetchToPos(size_t Pos) {
+  bool fetchToPos(size_t Pos) const {
     if (EOFReached) return Pos < ObjectSize;
     while (Pos >= BytesRead) {
       Bytes.resize(BytesRead + BytesSkipped + kChunkSize);
@@ -170,8 +172,8 @@ private:
     return true;
   }
 
-  StreamingMemoryObject(const StreamingMemoryObject&);  // DO NOT IMPLEMENT
-  void operator=(const StreamingMemoryObject&);  // DO NOT IMPLEMENT
+  StreamingMemoryObject(const StreamingMemoryObject&) LLVM_DELETED_FUNCTION;
+  void operator=(const StreamingMemoryObject&) LLVM_DELETED_FUNCTION;
 };
 
 StreamableMemoryObject *getNonStreamedMemoryObject(