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

View File

@@ -22,9 +22,9 @@ namespace llvm {
/// to return the right result, getExtent must also wait for all the data to
/// arrive; therefore it should not be called on objects which are actually
/// streamed (this would defeat the purpose of streaming). Instead,
/// isValidAddress and isObjectEnd can be used to test addresses without knowing
/// the exact size of the stream. Finally, getPointer can be used instead of
/// readBytes to avoid extra copying.
/// isValidAddress can be used to test addresses without knowing the exact size
/// of the stream. Finally, getPointer can be used instead of readBytes to avoid
/// extra copying.
class MemoryObject {
public:
virtual ~MemoryObject();
@@ -61,13 +61,6 @@ public:
/// @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) const = 0;
/// 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) const = 0;
};
}

View File

@@ -38,7 +38,6 @@ public:
return nullptr;
}
bool isValidAddress(uint64_t address) const override;
bool isObjectEnd(uint64_t address) const 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,