[PATCH] D91947: [clangd] testPath's final result agrees with the passed in Style

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 03:45:34 PST 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8cec8de2a4e6: [clangd] testPath's final result agrees with the passed in Style (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91947/new/

https://reviews.llvm.org/D91947

Files:
  clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
  clang-tools-extra/clangd/unittests/TestFS.cpp


Index: clang-tools-extra/clangd/unittests/TestFS.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/TestFS.cpp
+++ clang-tools-extra/clangd/unittests/TestFS.cpp
@@ -80,12 +80,10 @@
 }
 
 std::string testPath(PathRef File, llvm::sys::path::Style Style) {
-  assert(llvm::sys::path::is_relative(File) && "FileName should be relative");
-
-  llvm::SmallString<32> NativeFile = File;
-  llvm::sys::path::native(NativeFile, Style);
+  assert(llvm::sys::path::is_relative(File, Style));
   llvm::SmallString<32> Path;
-  llvm::sys::path::append(Path, Style, testRoot(), NativeFile);
+  llvm::sys::path::append(Path, testRoot(), File);
+  llvm::sys::path::native(Path, Style);
   return std::string(Path.str());
 }
 
Index: clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
@@ -255,7 +255,6 @@
   };
 
   auto BarPath = testPath("foo/bar.h", llvm::sys::path::Style::posix);
-  BarPath = llvm::sys::path::convert_to_slash(BarPath);
   Parm.Path = BarPath;
   // Non-absolute MountPoint without a directory raises an error.
   Frag = GetFrag("", "foo");
@@ -269,7 +268,6 @@
   ASSERT_FALSE(Conf.Index.External);
 
   auto FooPath = testPath("foo/", llvm::sys::path::Style::posix);
-  FooPath = llvm::sys::path::convert_to_slash(FooPath);
   // Ok when relative.
   Frag = GetFrag(testRoot(), "foo/");
   compileAndApply();
@@ -293,7 +291,6 @@
 
   // File outside MountPoint, no index.
   auto BazPath = testPath("bar/baz.h", llvm::sys::path::Style::posix);
-  BazPath = llvm::sys::path::convert_to_slash(BazPath);
   Parm.Path = BazPath;
   Frag = GetFrag("", FooPath.c_str());
   compileAndApply();
@@ -302,7 +299,6 @@
 
   // File under MountPoint, index should be set.
   BazPath = testPath("foo/baz.h", llvm::sys::path::Style::posix);
-  BazPath = llvm::sys::path::convert_to_slash(BazPath);
   Parm.Path = BazPath;
   Frag = GetFrag("", FooPath.c_str());
   compileAndApply();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91947.307031.patch
Type: text/x-patch
Size: 2134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201123/885be9a4/attachment.bin>


More information about the cfe-commits mailing list