Use the return of readBytes to find out if we are at the end of the stream.

This allows the removal of isObjectEnd and opens the way for reading 64 bits
at a time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221804 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-11-12 18:37:00 +00:00
parent bc8114f733
commit ea3c2111f4
4 changed files with 53 additions and 62 deletions
-12
View File
@@ -34,9 +34,6 @@ public:
bool isValidAddress(uint64_t address) const override {
return validAddress(address);
}
bool isObjectEnd(uint64_t address) const override {
return objectEnd(address);
}
private:
const uint8_t* const FirstChar;
@@ -47,9 +44,6 @@ private:
bool validAddress(uint64_t address) const {
return static_cast<std::ptrdiff_t>(address) < LastChar - FirstChar;
}
bool objectEnd(uint64_t address) const {
return static_cast<std::ptrdiff_t>(address) == LastChar - FirstChar;
}
RawMemoryObject(const RawMemoryObject&) LLVM_DELETED_FUNCTION;
void operator=(const RawMemoryObject&) LLVM_DELETED_FUNCTION;
@@ -85,12 +79,6 @@ bool StreamingMemoryObject::isValidAddress(uint64_t address) const {
return fetchToPos(address);
}
bool StreamingMemoryObject::isObjectEnd(uint64_t address) const {
if (ObjectSize) return address == ObjectSize;
fetchToPos(address);
return address == ObjectSize && address != 0;
}
uint64_t StreamingMemoryObject::getExtent() const {
if (ObjectSize) return ObjectSize;
size_t pos = BytesRead + kChunkSize;