From: Michael Spencer Date: Wed, 15 Apr 2020 21:46:29 +0000 (-0700) Subject: [LLVM][SupportTests] Fix Windows build breakage X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18ee0fca8c41a5b2eaec3649423423eeb91d8da2;p=platform%2Fupstream%2Fllvm.git [LLVM][SupportTests] Fix Windows build breakage `MemoryBuffer::getOpenFile` take an OS file handle, not an int. --- diff --git a/llvm/unittests/Support/MemoryBufferTest.cpp b/llvm/unittests/Support/MemoryBufferTest.cpp index 1a424f6..ae0c5ea 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 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);