aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2021-12-08 13:24:45 +0100
committerJan Svoboda <jan_svoboda@apple.com>2021-12-09 11:32:13 +0100
commitd0262c2394f46bb7da2a75529413d625c70908e5 (patch)
tree919e5bad5211507ec4c1692813f1495aba8b0840 /llvm/lib/Object/ArchiveWriter.cpp
parente04fc2d88efa60ed5527b90c15d8fc188739e989 (diff)
downloadllvm-d0262c2394f46bb7da2a75529413d625c70908e5.zip
llvm-d0262c2394f46bb7da2a75529413d625c70908e5.tar.gz
llvm-d0262c2394f46bb7da2a75529413d625c70908e5.tar.bz2
[llvm] Add null-termination capability to SmallVectorMemoryBuffer
Most of `MemoryBuffer` interfaces expose a `RequiresNullTerminator` parameter that's being used to: * determine how to open a file (`mmap` vs `open`), * assert newly initialized buffer indeed has an implicit null terminator. This patch adds the paramater to the `SmallVectorMemoryBuffer` constructors, meaning: * null terminator can now be added to `SmallVector`s that didn't have one before, * `SmallVectors` that had a null terminator before keep it even after the move. In line with existing code, the new parameter is defaulted to `true`. This patch makes sure all calls to the `SmallVectorMemoryBuffer` constructor set it to `false` to preserve the current semantics. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D115331
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
-rw-r--r--llvm/lib/Object/ArchiveWriter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp
index ce99746..da8bcec 100644
--- a/llvm/lib/Object/ArchiveWriter.cpp
+++ b/llvm/lib/Object/ArchiveWriter.cpp
@@ -696,7 +696,7 @@ writeArchiveToBuffer(ArrayRef<NewArchiveMember> NewMembers, bool WriteSymtab,
return std::move(E);
return std::make_unique<SmallVectorMemoryBuffer>(
- std::move(ArchiveBufferVector));
+ std::move(ArchiveBufferVector), /*RequiresNullTerminator=*/false);
}
} // namespace llvm