diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-06 15:46:45 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-06 15:46:45 +0000 |
commit | cb6f2646fd44c5274312c8fa782c4f339dfadad7 (patch) | |
tree | e3b80d3a426d7e65127df170b4c94f093ec812db /llvm/unittests/Support/Path.cpp | |
parent | 4b03364d72a5f4e372e631178bd32e0d4f531241 (diff) | |
download | bcm5719-llvm-cb6f2646fd44c5274312c8fa782c4f339dfadad7.tar.gz bcm5719-llvm-cb6f2646fd44c5274312c8fa782c4f339dfadad7.zip |
[Path] Fix bug in make_absolute logic
This fixes a bug for making path with a //net style root absolute. I
discovered the bug while writing a test case for the VFS, which uses
these paths because they're both legal absolute paths on Windows and
Unix.
Differential revision: https://reviews.llvm.org/D65675
llvm-svn: 368053
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 5e0581c945b..1802b0031ad 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -185,10 +185,19 @@ TEST(Support, Path) { path::native(*i, temp_store); } - SmallString<32> Relative("foo.cpp"); - sys::fs::make_absolute("/root", Relative); - Relative[5] = '/'; // Fix up windows paths. - ASSERT_EQ("/root/foo.cpp", Relative); + { + SmallString<32> Relative("foo.cpp"); + sys::fs::make_absolute("/root", Relative); + Relative[5] = '/'; // Fix up windows paths. + ASSERT_EQ("/root/foo.cpp", Relative); + } + + { + SmallString<32> Relative("foo.cpp"); + sys::fs::make_absolute("//root", Relative); + Relative[6] = '/'; // Fix up windows paths. + ASSERT_EQ("//root/foo.cpp", Relative); + } } TEST(Support, FilenameParent) { |