summaryrefslogtreecommitdiff
path: root/include/llvm/Support/DataExtractor.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-01-18 16:17:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-01-18 16:17:27 +0000
commit67c32a98315f785a9ec9d531c1f571a0196c7463 (patch)
tree4abb9cbeecc7901726dd0b4a37369596c852e9ef /include/llvm/Support/DataExtractor.h
parent9f61947910e6ab40de38e6b4034751ef1513200f (diff)
Diffstat (limited to 'include/llvm/Support/DataExtractor.h')
-rw-r--r--include/llvm/Support/DataExtractor.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Support/DataExtractor.h b/include/llvm/Support/DataExtractor.h
index e8a19cd773b5..48235d4145bd 100644
--- a/include/llvm/Support/DataExtractor.h
+++ b/include/llvm/Support/DataExtractor.h
@@ -348,6 +348,17 @@ public:
bool isValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const {
return offset + length >= offset && isValidOffset(offset + length - 1);
}
+
+ /// Test the availability of enough bytes of data for a pointer from
+ /// \a offset. The size of a pointer is \a getAddressSize().
+ ///
+ /// @return
+ /// \b true if \a offset is a valid offset and there are enough
+ /// bytes for a pointer available at that offset, \b false
+ /// otherwise.
+ bool isValidOffsetForAddress(uint32_t offset) const {
+ return isValidOffsetForDataOfSize(offset, AddressSize);
+ }
};
} // namespace llvm