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

Unified Diff: include/llvm/Support/StreamingMemoryObject.h

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « include/llvm/Support/ELF.h ('k') | include/llvm/Support/TargetRegistry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « include/llvm/Support/ELF.h ('k') | include/llvm/Support/TargetRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698