From: Kadir Cetinkaya Date: Tue, 16 Feb 2021 19:57:00 +0000 (+0100) Subject: [clangd] Fix windows buildbots after ecea7218fb9b994b26471e9877851cdb51a5f1d4 X-Git-Tag: llvmorg-14-init~14970 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cdef5a7161767c2c4b3b7cb2542cf1d29b6d4a09;p=platform%2Fupstream%2Fllvm.git [clangd] Fix windows buildbots after ecea7218fb9b994b26471e9877851cdb51a5f1d4 --- diff --git a/clang-tools-extra/clangd/support/Path.cpp b/clang-tools-extra/clangd/support/Path.cpp index 6fc74b9..a7907cff 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 26b999d..599c7692 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