This revision was automatically updated to reflect the committed changes. Closed by commit rGf72ae5cba1d6: [lldb] Fix windows path guessing for root paths (authored by jarin).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115104/new/ https://reviews.llvm.org/D115104 Files: lldb/source/Utility/FileSpec.cpp lldb/unittests/Utility/FileSpecTest.cpp Index: lldb/unittests/Utility/FileSpecTest.cpp =================================================================== --- lldb/unittests/Utility/FileSpecTest.cpp +++ lldb/unittests/Utility/FileSpecTest.cpp @@ -198,8 +198,10 @@ FileSpec::GuessPathStyle(R"(C:\foo.txt)")); EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(\\net\foo.txt)")); + EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(Z:\)")); EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo.txt")); EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt")); + EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("Z:")); } TEST(FileSpecTest, GetPath) { Index: lldb/source/Utility/FileSpec.cpp =================================================================== --- lldb/source/Utility/FileSpec.cpp +++ lldb/source/Utility/FileSpec.cpp @@ -310,7 +310,7 @@ return Style::posix; if (absolute_path.startswith(R"(\\)")) return Style::windows; - if (absolute_path.size() > 3 && llvm::isAlpha(absolute_path[0]) && + if (absolute_path.size() >= 3 && llvm::isAlpha(absolute_path[0]) && absolute_path.substr(1, 2) == R"(:\)") return Style::windows; return llvm::None;
Index: lldb/unittests/Utility/FileSpecTest.cpp =================================================================== --- lldb/unittests/Utility/FileSpecTest.cpp +++ lldb/unittests/Utility/FileSpecTest.cpp @@ -198,8 +198,10 @@ FileSpec::GuessPathStyle(R"(C:\foo.txt)")); EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(\\net\foo.txt)")); + EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(Z:\)")); EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo.txt")); EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt")); + EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("Z:")); } TEST(FileSpecTest, GetPath) { Index: lldb/source/Utility/FileSpec.cpp =================================================================== --- lldb/source/Utility/FileSpec.cpp +++ lldb/source/Utility/FileSpec.cpp @@ -310,7 +310,7 @@ return Style::posix; if (absolute_path.startswith(R"(\\)")) return Style::windows; - if (absolute_path.size() > 3 && llvm::isAlpha(absolute_path[0]) && + if (absolute_path.size() >= 3 && llvm::isAlpha(absolute_path[0]) && absolute_path.substr(1, 2) == R"(:\)") return Style::windows; return llvm::None;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits