[llvm] 18ee0fc - [LLVM][SupportTests] Fix Windows build breakage
Michael Spencer via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 14:47:45 PDT 2020
Author: Michael Spencer
Date: 2020-04-15T14:47:27-07:00
New Revision: 18ee0fca8c41a5b2eaec3649423423eeb91d8da2
URL: https://github.com/llvm/llvm-project/commit/18ee0fca8c41a5b2eaec3649423423eeb91d8da2
DIFF: https://github.com/llvm/llvm-project/commit/18ee0fca8c41a5b2eaec3649423423eeb91d8da2.diff
LOG: [LLVM][SupportTests] Fix Windows build breakage
`MemoryBuffer::getOpenFile` take an OS file handle, not an int.
Added:
Modified:
llvm/unittests/Support/MemoryBufferTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Support/MemoryBufferTest.cpp b/llvm/unittests/Support/MemoryBufferTest.cpp
index 1a424f66ad95..ae0c5eab178c 100644
--- a/llvm/unittests/Support/MemoryBufferTest.cpp
+++ b/llvm/unittests/Support/MemoryBufferTest.cpp
@@ -398,9 +398,14 @@ TEST_F(MemoryBufferTest, mmapVolatileNoNull) {
// Create a file large enough to mmap. A 32KiB file should be enough.
for (unsigned i = 0; i < 0x1000; ++i)
OF << "01234567";
- OF.flush();
+ OF.close();
+
+ Expected<sys::fs::file_t> File = sys::fs::openNativeFileForRead(TestPath);
+ ASSERT_THAT_EXPECTED(File, Succeeded());
+ auto OnExit =
+ make_scope_exit([&] { ASSERT_NO_ERROR(sys::fs::closeFile(*File)); });
- auto MBOrError = MemoryBuffer::getOpenFile(FD, TestPath,
+ auto MBOrError = MemoryBuffer::getOpenFile(*File, TestPath,
/*FileSize=*/-1, /*RequiresNullTerminator=*/false, /*IsVolatile=*/true);
ASSERT_NO_ERROR(MBOrError.getError())
OwningBuffer MB = std::move(*MBOrError);
More information about the llvm-commits
mailing list