aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Frontend
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 /clang/unittests/Frontend
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 'clang/unittests/Frontend')
-rw-r--r--clang/unittests/Frontend/TextDiagnosticTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/unittests/Frontend/TextDiagnosticTest.cpp b/clang/unittests/Frontend/TextDiagnosticTest.cpp
index 220cff6..3acd89a 100644
--- a/clang/unittests/Frontend/TextDiagnosticTest.cpp
+++ b/clang/unittests/Frontend/TextDiagnosticTest.cpp
@@ -54,7 +54,7 @@ TEST(TextDiagnostic, ShowLine) {
llvm::SmallVector<char, 64> buffer;
buffer.append(main_file_contents.begin(), main_file_contents.end());
auto file_contents = std::make_unique<llvm::SmallVectorMemoryBuffer>(
- std::move(buffer), file_path);
+ std::move(buffer), file_path, /*RequiresNullTerminator=*/false);
SrcMgr.overrideFileContents(fe, std::move(file_contents));
// Create the actual file id and use it as the main file.