| Index: include/llvm/Support/StreamingMemoryObject.h
|
| diff --git a/include/llvm/Support/StreamingMemoryObject.h b/include/llvm/Support/StreamingMemoryObject.h
|
| index 66ed521a411c753fdeb0e23f02363de1dd6ca3c2..3bcce66eb92ada33d43eb47097ab2fec66916b9a 100644
|
| --- a/include/llvm/Support/StreamingMemoryObject.h
|
| +++ b/include/llvm/Support/StreamingMemoryObject.h
|
| @@ -23,9 +23,26 @@ namespace llvm {
|
| /// Interface to data which is actually streamed from a DataStreamer. In
|
| /// addition to inherited members, it has the dropLeadingBytes and
|
| /// setKnownObjectSize methods which are not applicable to non-streamed objects.
|
| +/// @LOCALMOD -- Made dropLeadingBytes/setKnownObjectSize virtual.
|
| class StreamingMemoryObject : public MemoryObject {
|
| + public:
|
| + /// 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,
|
| + /// since we don't know a priori if it's present, and we can't put bytes
|
| + /// back into the stream once we've read them.
|
| + virtual bool dropLeadingBytes(size_t s) = 0;
|
| +
|
| + /// If the data object size is known in advance, many of the operations can
|
| + /// be made more efficient, so this method should be called before reading
|
| + /// starts (although it can be called anytime).
|
| + virtual void setKnownObjectSize(size_t size) = 0;
|
| +};
|
| +
|
| +/// @LOCALMOD -- split out StreamingMemoryObjectImpl from StreamingMemoryObject.
|
| +/// StreamingMemoryObjectImpl - an implementation of a StreamingMemoryObject.
|
| +class StreamingMemoryObjectImpl : public StreamingMemoryObject {
|
| public:
|
| - StreamingMemoryObject(DataStreamer *streamer);
|
| + StreamingMemoryObjectImpl(DataStreamer *streamer);
|
| uint64_t getExtent() const override;
|
| uint64_t readBytes(uint8_t *Buf, uint64_t Size,
|
| uint64_t Address) const override;
|
| @@ -43,12 +60,12 @@ public:
|
| /// remaining bytes down by s. This is used to skip past the bitcode header,
|
| /// since we don't know a priori if it's present, and we can't put bytes
|
| /// back into the stream once we've read them.
|
| - bool dropLeadingBytes(size_t s);
|
| + bool dropLeadingBytes(size_t s) override;
|
|
|
| /// If the data object size is known in advance, many of the operations can
|
| /// be made more efficient, so this method should be called before reading
|
| /// starts (although it can be called anytime).
|
| - void setKnownObjectSize(size_t size);
|
| + void setKnownObjectSize(size_t size) override;
|
|
|
| private:
|
| const static uint32_t kChunkSize = 4096 * 4;
|
| @@ -81,8 +98,10 @@ private:
|
| return Pos < BytesRead;
|
| }
|
|
|
| - StreamingMemoryObject(const StreamingMemoryObject&) LLVM_DELETED_FUNCTION;
|
| - void operator=(const StreamingMemoryObject&) LLVM_DELETED_FUNCTION;
|
| + StreamingMemoryObjectImpl(
|
| + const StreamingMemoryObjectImpl&) LLVM_DELETED_FUNCTION;
|
| + void operator=(
|
| + const StreamingMemoryObjectImpl&) LLVM_DELETED_FUNCTION;
|
| };
|
|
|
| MemoryObject *getNonStreamedMemoryObject(
|
|
|