summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2021-02-16 20:57:00 +0100
committerTom Stellard <tstellar@redhat.com>2021-02-22 12:19:07 -0800
commitb60110090a942078bbacf71db166c2353c340413 (patch)
tree77d05fd29d639c9d16460f1e43057c7110cd1432
parentd8404633401509936600b60274b72fc03f11f040 (diff)
downloadllvm-b60110090a942078bbacf71db166c2353c340413.tar.gz
[clangd] Fix windows buildbots after ecea7218fb9b994b26471e9877851cdb51a5f1d4
(cherry picked from commit cdef5a7161767c2c4b3b7cb2542cf1d29b6d4a09)
-rw-r--r--clang-tools-extra/clangd/support/Path.cpp4
-rw-r--r--clang-tools-extra/clangd/unittests/support/PathTests.cpp21
2 files changed, 13 insertions, 12 deletions
diff --git a/clang-tools-extra/clangd/support/Path.cpp b/clang-tools-extra/clangd/support/Path.cpp
index 6fc74b92fc7a..a7907cffe60c 100644
--- a/clang-tools-extra/clangd/support/Path.cpp
+++ b/clang-tools-extra/clangd/support/Path.cpp
@@ -21,8 +21,8 @@ bool pathEqual(PathRef A, PathRef B) { return A == B; }
bool pathStartsWith(PathRef Ancestor, PathRef Path,
llvm::sys::path::Style Style) {
- assert(llvm::sys::path::is_absolute(Ancestor, Style) &&
- llvm::sys::path::is_absolute(Path, Style));
+ assert(llvm::sys::path::is_absolute(Ancestor) &&
+ llvm::sys::path::is_absolute(Path));
// If ancestor ends with a separator drop that, so that we can match /foo/ as
// a parent of /foo.
if (llvm::sys::path::is_separator(Ancestor.back(), Style))
diff --git a/clang-tools-extra/clangd/unittests/support/PathTests.cpp b/clang-tools-extra/clangd/unittests/support/PathTests.cpp
index 26b999d103a0..599c76926d30 100644
--- a/clang-tools-extra/clangd/unittests/support/PathTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/PathTests.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "TestFS.h"
#include "support/Path.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
@@ -14,21 +15,21 @@ namespace clang {
namespace clangd {
namespace {
TEST(PathTests, IsAncestor) {
- EXPECT_TRUE(pathStartsWith("/foo", "/foo"));
- EXPECT_TRUE(pathStartsWith("/foo/", "/foo"));
+ EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("foo")));
+ EXPECT_TRUE(pathStartsWith(testPath("foo/"), testPath("foo")));
- EXPECT_FALSE(pathStartsWith("/foo", "/fooz"));
- EXPECT_FALSE(pathStartsWith("/foo/", "/fooz"));
+ EXPECT_FALSE(pathStartsWith(testPath("foo"), testPath("fooz")));
+ EXPECT_FALSE(pathStartsWith(testPath("foo/"), testPath("fooz")));
- EXPECT_TRUE(pathStartsWith("/foo", "/foo/bar"));
- EXPECT_TRUE(pathStartsWith("/foo/", "/foo/bar"));
+ EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("foo/bar")));
+ EXPECT_TRUE(pathStartsWith(testPath("foo/"), testPath("foo/bar")));
#ifdef CLANGD_PATH_CASE_INSENSITIVE
- EXPECT_TRUE(pathStartsWith("/fOo", "/foo/bar"));
- EXPECT_TRUE(pathStartsWith("/foo", "/fOo/bar"));
+ EXPECT_TRUE(pathStartsWith(testPath("fOo"), testPath("foo/bar")));
+ EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("fOo/bar")));
#else
- EXPECT_FALSE(pathStartsWith("/fOo", "/foo/bar"));
- EXPECT_FALSE(pathStartsWith("/foo", "/fOo/bar"));
+ EXPECT_FALSE(pathStartsWith(testPath("fOo"), testPath("foo/bar")));
+ EXPECT_FALSE(pathStartsWith(testPath("foo"), testPath("fOo/bar")));
#endif
}
} // namespace