[clang-tools-extra] 64e8fd5 - [clangd][remote] Make sure relative paths are absolute with respect to posix style

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 02:09:00 PDT 2020


Author: Kadir Cetinkaya
Date: 2020-09-30T11:08:49+02:00
New Revision: 64e8fd540ecc38ee3daf942499091589785e2733

URL: https://github.com/llvm/llvm-project/commit/64e8fd540ecc38ee3daf942499091589785e2733
DIFF: https://github.com/llvm/llvm-project/commit/64e8fd540ecc38ee3daf942499091589785e2733.diff

LOG: [clangd][remote] Make sure relative paths are absolute with respect to posix style

Relative paths received from the server are always in posix style. So
we need to ensure they are relative using that style, and not the native one.

Differential Revision: https://reviews.llvm.org/D88507

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
index 31ce4a44ea55..d61848f295a3 100644
--- a/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ b/clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -299,7 +299,7 @@ Marshaller::relativePathToURI(llvm::StringRef RelativePath) {
   assert(RelativePath == llvm::sys::path::convert_to_slash(RelativePath));
   if (RelativePath.empty())
     return error("Empty relative path.");
-  if (llvm::sys::path::is_absolute(RelativePath))
+  if (llvm::sys::path::is_absolute(RelativePath, llvm::sys::path::Style::posix))
     return error("RelativePath '{0}' is absolute.", RelativePath);
   llvm::SmallString<256> FullPath = llvm::StringRef(*LocalIndexRoot);
   llvm::sys::path::append(FullPath, RelativePath);


        


More information about the cfe-commits mailing list