diff options
author | Jinsong Ji <jinsong.ji@intel.com> | 2025-01-02 12:32:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-02 12:32:42 -0500 |
commit | 5de7af4b9f05c7a9fb3775f45627b50aba47869b (patch) | |
tree | d78cfb43f9d2bec8fe29b9744992e415e5967e4c /llvm/unittests/Support/Path.cpp | |
parent | 1849244685bc42b07b1b14e3f62e15c535e74c39 (diff) | |
download | llvm-5de7af4b9f05c7a9fb3775f45627b50aba47869b.zip llvm-5de7af4b9f05c7a9fb3775f45627b50aba47869b.tar.gz llvm-5de7af4b9f05c7a9fb3775f45627b50aba47869b.tar.bz2 |
[llvm][Support][Windows] Fix slash in path for remove_directories (#121448)
Before 925471ed903dad871042d7ed0bab89ab6566a564 remove_directories
supports path with slash (instead of backslash).
The ILCreateFromPathW in new implementation requires backslash path,
so the call to remove_directories will fail if the path contains slash.
This is to normalize the path to make sure remove_directories still
support path with slash as well.
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 8dde2fb..187f47d 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -1326,6 +1326,9 @@ TEST_F(FileSystemTest, Remove) { ASSERT_NO_ERROR(fs::remove_directories("D:/footest")); + ASSERT_NO_ERROR(fs::remove_directories(Twine(BaseDir) + "/foo/bar/baz")); + ASSERT_FALSE(fs::exists(Twine(BaseDir) + "/foo/bar/baz")); + ASSERT_NO_ERROR(fs::remove_directories(BaseDir)); ASSERT_FALSE(fs::exists(BaseDir)); } |