aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp b/contrib/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp
index 8c9efa0ed9a9..dc4ea200c7be 100644
--- a/contrib/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp
@@ -8,7 +8,6 @@
#include "llvm/Support/BinaryStreamWriter.h"
-#include "llvm/Support/BinaryStreamError.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/BinaryStreamRef.h"
#include "llvm/Support/LEB128.h"
@@ -94,10 +93,11 @@ BinaryStreamWriter::split(uint64_t Off) const {
Error BinaryStreamWriter::padToAlignment(uint32_t Align) {
uint64_t NewOffset = alignTo(Offset, Align);
- if (NewOffset > getLength())
- return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
+ const uint64_t ZerosSize = 64;
+ static constexpr char Zeros[ZerosSize] = {};
while (Offset < NewOffset)
- if (auto EC = writeInteger('\0'))
- return EC;
+ if (auto E = writeArray(
+ ArrayRef<char>(Zeros, std::min(ZerosSize, NewOffset - Offset))))
+ return E;
return Error::success();
}