Remove a convoluted way of calling close by moving the call to the only caller.
As a bonus we can actually check the return value.
llvm-svn: 224046
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index d1f4e24..81d9234 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -649,11 +649,7 @@
StringRef Val("hello there");
{
fs::mapped_file_region mfr(FileDescriptor,
- true,
- fs::mapped_file_region::readwrite,
- 4096,
- 0,
- EC);
+ fs::mapped_file_region::readwrite, 4096, 0, EC);
ASSERT_NO_ERROR(EC);
std::copy(Val.begin(), Val.end(), mfr.data());
// Explicitly add a 0.
@@ -665,21 +661,16 @@
int FD;
EC = fs::openFileForRead(Twine(TempPath), FD);
ASSERT_NO_ERROR(EC);
- fs::mapped_file_region mfr(FD, false, fs::mapped_file_region::readonly, 0, 0,
- EC);
+ fs::mapped_file_region mfr(FD, fs::mapped_file_region::readonly, 0, 0, EC);
ASSERT_NO_ERROR(EC);
// Verify content
EXPECT_EQ(StringRef(mfr.const_data()), Val);
// Unmap temp file
- fs::mapped_file_region m(FD, false, fs::mapped_file_region::readonly, 0, 0,
- EC);
+ fs::mapped_file_region m(FD, fs::mapped_file_region::readonly, 0, 0, EC);
ASSERT_NO_ERROR(EC);
ASSERT_EQ(close(FD), 0);
- const char *Data = m.const_data();
- fs::mapped_file_region mfrrv(std::move(m));
- EXPECT_EQ(mfrrv.const_data(), Data);
}
TEST(Support, NormalizePath) {