diff options
author | Reid Kleckner <rnk@google.com> | 2017-08-04 17:43:49 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-08-04 17:43:49 +0000 |
commit | af3e93ac932b89f224db44ff64d64589f0508645 (patch) | |
tree | d658396367ac32fc33394e381acfc38abdff2880 /llvm/unittests/Support/Path.cpp | |
parent | 96d6008145e41095c3f027868f4edea9074561e0 (diff) | |
download | bcm5719-llvm-af3e93ac932b89f224db44ff64d64589f0508645.tar.gz bcm5719-llvm-af3e93ac932b89f224db44ff64d64589f0508645.zip |
[Support] Remove getPathFromOpenFD, it was unused
Summary:
It was added to support clang warnings about includes with case
mismatches, but it ended up not being necessary.
Reviewers: twoh, rafael
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D36328
llvm-svn: 310078
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 3e474f33ca6..f1c8e7f1bdc 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -1145,96 +1145,6 @@ TEST(Support, ReplacePathPrefix) { EXPECT_EQ(Path, "/foo"); } -TEST_F(FileSystemTest, PathFromFD) { - // Create a temp file. - int FileDescriptor; - SmallString<64> TempPath; - ASSERT_NO_ERROR( - fs::createTemporaryFile("prefix", "temp", FileDescriptor, TempPath)); - FileRemover Cleanup(TempPath); - - // Make sure it exists. - ASSERT_TRUE(sys::fs::exists(Twine(TempPath))); - - // Try to get the path from the file descriptor - SmallString<64> ResultPath; - std::error_code ErrorCode = - fs::getPathFromOpenFD(FileDescriptor, ResultPath); - - // If we succeeded, check that the paths are the same (modulo case): - if (!ErrorCode) { - // The paths returned by createTemporaryFile and getPathFromOpenFD - // should reference the same file on disk. - fs::UniqueID D1, D2; - ASSERT_NO_ERROR(fs::getUniqueID(Twine(TempPath), D1)); - ASSERT_NO_ERROR(fs::getUniqueID(Twine(ResultPath), D2)); - ASSERT_EQ(D1, D2); - } - - ::close(FileDescriptor); -} - -TEST_F(FileSystemTest, PathFromFDWin32) { - // Create a temp file. - int FileDescriptor; - SmallString<64> TempPath; - ASSERT_NO_ERROR( - fs::createTemporaryFile("prefix", "temp", FileDescriptor, TempPath)); - FileRemover Cleanup(TempPath); - - // Make sure it exists. - ASSERT_TRUE(sys::fs::exists(Twine(TempPath))); - - SmallVector<char, 8> ResultPath; - std::error_code ErrorCode = - fs::getPathFromOpenFD(FileDescriptor, ResultPath); - - if (!ErrorCode) { - // Now that we know how much space is required for the path, create a path - // buffer with exactly enough space (sans null terminator, which should not - // be present), and call getPathFromOpenFD again to ensure that the API - // properly handles exactly-sized buffers. - SmallVector<char, 8> ExactSizedPath(ResultPath.size()); - ErrorCode = fs::getPathFromOpenFD(FileDescriptor, ExactSizedPath); - ResultPath = ExactSizedPath; - } - - if (!ErrorCode) { - fs::UniqueID D1, D2; - ASSERT_NO_ERROR(fs::getUniqueID(Twine(TempPath), D1)); - ASSERT_NO_ERROR(fs::getUniqueID(Twine(ResultPath), D2)); - ASSERT_EQ(D1, D2); - } - ::close(FileDescriptor); -} - -TEST_F(FileSystemTest, PathFromFDUnicode) { - // Create a temp file. - int FileDescriptor; - SmallString<64> TempPath; - - // Test Unicode: "<temp directory>/(pi)r^2<temp rand chars>.aleth.0" - ASSERT_NO_ERROR( - fs::createTemporaryFile("\xCF\x80r\xC2\xB2", - "\xE2\x84\xB5.0", FileDescriptor, TempPath)); - FileRemover Cleanup(TempPath); - - // Make sure it exists. - ASSERT_TRUE(sys::fs::exists(Twine(TempPath))); - - SmallVector<char, 8> ResultPath; - std::error_code ErrorCode = - fs::getPathFromOpenFD(FileDescriptor, ResultPath); - - if (!ErrorCode) { - fs::UniqueID D1, D2; - ASSERT_NO_ERROR(fs::getUniqueID(Twine(TempPath), D1)); - ASSERT_NO_ERROR(fs::getUniqueID(Twine(ResultPath), D2)); - ASSERT_EQ(D1, D2); - } - ::close(FileDescriptor); -} - TEST_F(FileSystemTest, OpenFileForRead) { // Create a temp file. int FileDescriptor; |