From 4b6eb0e63c698094db5506763df44cc83c19f643 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 20 Mar 2022 12:40:34 +0100 Subject: Merge llvm-project main llvmorg-14-init-10186-gff7f2cfa959b This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-14-init-10186-gff7f2cfa959b. PR: 261742 MFC after: 2 weeks (cherry picked from commit 349cc55c9796c4596a5b9904cd3281af295f878f) --- .../llvm/lib/Support/BinaryStreamRef.cpp | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/Support/BinaryStreamRef.cpp') diff --git a/contrib/llvm-project/llvm/lib/Support/BinaryStreamRef.cpp b/contrib/llvm-project/llvm/lib/Support/BinaryStreamRef.cpp index 53e71baad57a..6d79d95e1bf0 100644 --- a/contrib/llvm-project/llvm/lib/Support/BinaryStreamRef.cpp +++ b/contrib/llvm-project/llvm/lib/Support/BinaryStreamRef.cpp @@ -21,15 +21,15 @@ public: llvm::support::endianness getEndian() const override { return BBS.getEndian(); } - Error readBytes(uint32_t Offset, uint32_t Size, + Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef &Buffer) override { return BBS.readBytes(Offset, Size, Buffer); } - Error readLongestContiguousChunk(uint32_t Offset, + Error readLongestContiguousChunk(uint64_t Offset, ArrayRef &Buffer) override { return BBS.readLongestContiguousChunk(Offset, Buffer); } - uint32_t getLength() override { return BBS.getLength(); } + uint64_t getLength() override { return BBS.getLength(); } private: BinaryByteStream BBS; @@ -44,17 +44,17 @@ public: llvm::support::endianness getEndian() const override { return BBS.getEndian(); } - Error readBytes(uint32_t Offset, uint32_t Size, + Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef &Buffer) override { return BBS.readBytes(Offset, Size, Buffer); } - Error readLongestContiguousChunk(uint32_t Offset, + Error readLongestContiguousChunk(uint64_t Offset, ArrayRef &Buffer) override { return BBS.readLongestContiguousChunk(Offset, Buffer); } - uint32_t getLength() override { return BBS.getLength(); } + uint64_t getLength() override { return BBS.getLength(); } - Error writeBytes(uint32_t Offset, ArrayRef Data) override { + Error writeBytes(uint64_t Offset, ArrayRef Data) override { return BBS.writeBytes(Offset, Data); } Error commit() override { return BBS.commit(); } @@ -66,8 +66,8 @@ private: BinaryStreamRef::BinaryStreamRef(BinaryStream &Stream) : BinaryStreamRefBase(Stream) {} -BinaryStreamRef::BinaryStreamRef(BinaryStream &Stream, uint32_t Offset, - Optional Length) +BinaryStreamRef::BinaryStreamRef(BinaryStream &Stream, uint64_t Offset, + Optional Length) : BinaryStreamRefBase(Stream, Offset, Length) {} BinaryStreamRef::BinaryStreamRef(ArrayRef Data, endianness Endian) : BinaryStreamRefBase(std::make_shared(Data, Endian), 0, @@ -76,7 +76,7 @@ BinaryStreamRef::BinaryStreamRef(StringRef Data, endianness Endian) : BinaryStreamRef(makeArrayRef(Data.bytes_begin(), Data.bytes_end()), Endian) {} -Error BinaryStreamRef::readBytes(uint32_t Offset, uint32_t Size, +Error BinaryStreamRef::readBytes(uint64_t Offset, uint64_t Size, ArrayRef &Buffer) const { if (auto EC = checkOffsetForRead(Offset, Size)) return EC; @@ -84,7 +84,7 @@ Error BinaryStreamRef::readBytes(uint32_t Offset, uint32_t Size, } Error BinaryStreamRef::readLongestContiguousChunk( - uint32_t Offset, ArrayRef &Buffer) const { + uint64_t Offset, ArrayRef &Buffer) const { if (auto EC = checkOffsetForRead(Offset, 1)) return EC; @@ -94,7 +94,7 @@ Error BinaryStreamRef::readLongestContiguousChunk( // This StreamRef might refer to a smaller window over a larger stream. In // that case we will have read out more bytes than we should return, because // we should not read past the end of the current view. - uint32_t MaxLength = getLength() - Offset; + uint64_t MaxLength = getLength() - Offset; if (Buffer.size() > MaxLength) Buffer = Buffer.slice(0, MaxLength); return Error::success(); @@ -104,8 +104,8 @@ WritableBinaryStreamRef::WritableBinaryStreamRef(WritableBinaryStream &Stream) : BinaryStreamRefBase(Stream) {} WritableBinaryStreamRef::WritableBinaryStreamRef(WritableBinaryStream &Stream, - uint32_t Offset, - Optional Length) + uint64_t Offset, + Optional Length) : BinaryStreamRefBase(Stream, Offset, Length) {} WritableBinaryStreamRef::WritableBinaryStreamRef(MutableArrayRef Data, @@ -113,8 +113,7 @@ WritableBinaryStreamRef::WritableBinaryStreamRef(MutableArrayRef Data, : BinaryStreamRefBase(std::make_shared(Data, Endian), 0, Data.size()) {} - -Error WritableBinaryStreamRef::writeBytes(uint32_t Offset, +Error WritableBinaryStreamRef::writeBytes(uint64_t Offset, ArrayRef Data) const { if (auto EC = checkOffsetForWrite(Offset, Data.size())) return EC; -- cgit v1.2.3