summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-05-24 10:54:58 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-05-24 10:54:58 +0000
commit534d3a467085d9be5b4cbe7d59f3ee5bec61fc7c (patch)
tree6f726e83a5c98d74381fe3aad9041ed92e9edb3b /llvm/include
parent01a8079bf2aea993f3dc6d751626bfd7ddb1f11e (diff)
downloadbcm5719-llvm-534d3a467085d9be5b4cbe7d59f3ee5bec61fc7c.tar.gz
bcm5719-llvm-534d3a467085d9be5b4cbe7d59f3ee5bec61fc7c.zip
Remove the Copied parameter from MemoryObject::readBytes.
There was exactly one caller using this API right, the others were relying on specific behavior of the default implementation. Since it's too hard to use it right just remove it and standardize on the default behavior. Defines away PR16132. llvm-svn: 182636
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Bitcode/BitstreamReader.h5
-rw-r--r--llvm/include/llvm/Support/MemoryObject.h11
-rw-r--r--llvm/include/llvm/Support/StreamableMemoryObject.h18
-rw-r--r--llvm/include/llvm/Support/StringRefMemoryObject.h11
4 files changed, 17 insertions, 28 deletions
diff --git a/llvm/include/llvm/Bitcode/BitstreamReader.h b/llvm/include/llvm/Bitcode/BitstreamReader.h
index f3139739cd1..dc5e095155f 100644
--- a/llvm/include/llvm/Bitcode/BitstreamReader.h
+++ b/llvm/include/llvm/Bitcode/BitstreamReader.h
@@ -244,7 +244,7 @@ public:
uint32_t getWord(size_t pos) {
uint8_t buf[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
- BitStream->getBitcodeBytes().readBytes(pos, sizeof(buf), buf, NULL);
+ BitStream->getBitcodeBytes().readBytes(pos, sizeof(buf), buf);
return *reinterpret_cast<support::ulittle32_t *>(buf);
}
@@ -366,8 +366,7 @@ public:
// Read the next word from the stream.
uint8_t Array[sizeof(word_t)] = {0};
- BitStream->getBitcodeBytes().readBytes(NextChar, sizeof(Array),
- Array, NULL);
+ BitStream->getBitcodeBytes().readBytes(NextChar, sizeof(Array), Array);
// Handle big-endian byte-swapping if necessary.
support::detail::packed_endian_specific_integral
diff --git a/llvm/include/llvm/Support/MemoryObject.h b/llvm/include/llvm/Support/MemoryObject.h
index 732b0f07746..17aa9d2f675 100644
--- a/llvm/include/llvm/Support/MemoryObject.h
+++ b/llvm/include/llvm/Support/MemoryObject.h
@@ -42,7 +42,7 @@ public:
/// @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) const = 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.
@@ -51,17 +51,12 @@ public:
///
/// @param address - The address of the first byte, in the same space as
/// getBase().
- /// @param size - The maximum number of bytes to copy.
+ /// @param size - The number of bytes to copy.
/// @param buf - A pointer to a buffer to be filled in. Must be non-NULL
/// and large enough to hold size bytes.
- /// @param copied - A pointer to a nunber that is filled in with the number
- /// of bytes actually read. May be NULL.
/// @result - 0 if successful; -1 if not. Failure may be due to a
/// bounds violation or an implementation-specific error.
- virtual int readBytes(uint64_t address,
- uint64_t size,
- uint8_t* buf,
- uint64_t* copied) const;
+ virtual int readBytes(uint64_t address, uint64_t size, uint8_t *buf) const;
};
}
diff --git a/llvm/include/llvm/Support/StreamableMemoryObject.h b/llvm/include/llvm/Support/StreamableMemoryObject.h
index 385548579b1..e823d489d3a 100644
--- a/llvm/include/llvm/Support/StreamableMemoryObject.h
+++ b/llvm/include/llvm/Support/StreamableMemoryObject.h
@@ -38,7 +38,7 @@ class StreamableMemoryObject : public MemoryObject {
/// getBase - Returns the lowest valid address in the region.
///
/// @result - The lowest valid address.
- virtual uint64_t getBase() const = 0;
+ virtual uint64_t getBase() const LLVM_OVERRIDE = 0;
/// getExtent - Returns the size of the region in bytes. (The region is
/// contiguous, so the highest valid address of the region
@@ -46,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() const = 0;
+ virtual uint64_t getExtent() const LLVM_OVERRIDE = 0;
/// readByte - Tries to read a single byte from the region.
/// May block until (address - base) bytes have been read
@@ -54,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) const = 0;
+ virtual int readByte(uint64_t address, uint8_t *ptr) const LLVM_OVERRIDE = 0;
/// readBytes - Tries to read a contiguous range of bytes from the
/// region, up to the end of the region.
@@ -65,17 +65,14 @@ class StreamableMemoryObject : public MemoryObject {
///
/// @param address - The address of the first byte, in the same space as
/// getBase().
- /// @param size - The maximum number of bytes to copy.
+ /// @param size - The number of bytes to copy.
/// @param buf - A pointer to a buffer to be filled in. Must be non-NULL
/// and large enough to hold size bytes.
- /// @param copied - A pointer to a nunber that is filled in with the number
- /// of bytes actually read. May be NULL.
/// @result - 0 if successful; -1 if not. Failure may be due to a
/// bounds violation or an implementation-specific error.
virtual int readBytes(uint64_t address,
uint64_t size,
- uint8_t* buf,
- uint64_t* copied) const = 0;
+ uint8_t *buf) const LLVM_OVERRIDE = 0;
/// getPointer - Ensures that the requested data is in memory, and returns
/// A pointer to it. More efficient than using readBytes if the
@@ -110,11 +107,10 @@ public:
StreamingMemoryObject(DataStreamer *streamer);
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 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) const LLVM_OVERRIDE;
+ uint8_t *buf) 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,
diff --git a/llvm/include/llvm/Support/StringRefMemoryObject.h b/llvm/include/llvm/Support/StringRefMemoryObject.h
index a0ef35a9e1d..994fa34b74b 100644
--- a/llvm/include/llvm/Support/StringRefMemoryObject.h
+++ b/llvm/include/llvm/Support/StringRefMemoryObject.h
@@ -16,6 +16,7 @@
#define LLVM_SUPPORT_STRINGREFMEMORYOBJECT_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryObject.h"
namespace llvm {
@@ -28,13 +29,11 @@ public:
StringRefMemoryObject(StringRef Bytes, uint64_t Base = 0)
: Bytes(Bytes), Base(Base) {}
- uint64_t getBase() const { return Base; }
- uint64_t getExtent() const { return Bytes.size(); }
-
- int readByte(uint64_t Addr, uint8_t *Byte) const;
- int readBytes(uint64_t Addr, uint64_t Size,
- uint8_t *Buf, uint64_t *Copied) const;
+ uint64_t getBase() const LLVM_OVERRIDE { return Base; }
+ uint64_t getExtent() const LLVM_OVERRIDE { return Bytes.size(); }
+ int readByte(uint64_t Addr, uint8_t *Byte) const LLVM_OVERRIDE;
+ int readBytes(uint64_t Addr, uint64_t Size, uint8_t *Buf) const LLVM_OVERRIDE;
};
}
OpenPOWER on IntegriCloud