[PATCH] D48290: [clangd] Use workspace root path as hint path for resolving URIs in workspace/symbol

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 19 02:00:54 PDT 2018


ioeric added inline comments.


================
Comment at: clangd/ClangdServer.cpp:119
+  auto FS = FSProvider.getFileSystem();
+  auto Status = FS->status(RootPath);
+  if (!Status)
----------------
sammccall wrote:
> why validate it?
This is the current behavior, except `llvm::sys::fs::is_directory` only works for real file system.


================
Comment at: unittests/clangd/TestFS.cpp:93
     return URI(Scheme, /*Authority=*/"",
-               llvm::sys::path::convert_to_slash(Body));
+               StringRef(llvm::sys::path::convert_to_slash(Body)).ltrim('/'));
   }
----------------
sammccall wrote:
> why this change?
The `consume_front` above would not consume the second slash in `/clangd-test/x.h` which results in "/x.h" in the body, but that doesn't work with `testPath()` which requires a relative path. That's why I added a requirement that the body should be relative path.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D48290





More information about the cfe-commits mailing list