aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/include/llvm/Object/Binary.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/Object/Binary.h')
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Object/Binary.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/Object/Binary.h b/contrib/llvm-project/llvm/include/llvm/Object/Binary.h
index e95516f30a40..dd98e1143e25 100644
--- a/contrib/llvm-project/llvm/include/llvm/Object/Binary.h
+++ b/contrib/llvm-project/llvm/include/llvm/Object/Binary.h
@@ -91,6 +91,8 @@ public:
Binary(const Binary &other) = delete;
virtual ~Binary();
+ virtual Error initContent() { return Error::success(); };
+
StringRef getData() const;
StringRef getFileName() const;
MemoryBufferRef getMemoryBufferRef() const;
@@ -163,8 +165,8 @@ public:
static Error checkOffset(MemoryBufferRef M, uintptr_t Addr,
const uint64_t Size) {
if (Addr + Size < Addr || Addr + Size < Size ||
- Addr + Size > uintptr_t(M.getBufferEnd()) ||
- Addr < uintptr_t(M.getBufferStart())) {
+ Addr + Size > reinterpret_cast<uintptr_t>(M.getBufferEnd()) ||
+ Addr < reinterpret_cast<uintptr_t>(M.getBufferStart())) {
return errorCodeToError(object_error::unexpected_eof);
}
return Error::success();
@@ -178,7 +180,8 @@ DEFINE_ISA_CONVERSION_FUNCTIONS(Binary, LLVMBinaryRef)
///
/// @param Source The data to create the Binary from.
Expected<std::unique_ptr<Binary>> createBinary(MemoryBufferRef Source,
- LLVMContext *Context = nullptr);
+ LLVMContext *Context = nullptr,
+ bool InitContent = true);
template <typename T> class OwningBinary {
std::unique_ptr<T> Bin;
@@ -228,7 +231,9 @@ template <typename T> const T* OwningBinary<T>::getBinary() const {
return Bin.get();
}
-Expected<OwningBinary<Binary>> createBinary(StringRef Path);
+Expected<OwningBinary<Binary>> createBinary(StringRef Path,
+ LLVMContext *Context = nullptr,
+ bool InitContent = true);
} // end namespace object