[clang-tools-extra] r323751 - [clangd] Fix windows path manipulation

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 03:23:11 PST 2018


Author: sammccall
Date: Tue Jan 30 03:23:11 2018
New Revision: 323751

URL: http://llvm.org/viewvc/llvm-project?rev=323751&view=rev
Log:
[clangd] Fix windows path manipulation

Modified:
    clang-tools-extra/trunk/clangd/Protocol.cpp

Modified: clang-tools-extra/trunk/clangd/Protocol.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Protocol.cpp?rev=323751&r1=323750&r2=323751&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/Protocol.cpp (original)
+++ clang-tools-extra/trunk/clangd/Protocol.cpp Tue Jan 30 03:23:11 2018
@@ -37,8 +37,12 @@ bool fromJSON(const json::Expr &E, URIFo
           "Clangd only supports 'file' URI scheme for workspace files: " + *S);
       return false;
     }
-    // We know that body of a file URI is absolute path.
-    R.file = U->body();
+    auto Path = URI::resolve(*U);
+    if (!Path) {
+      log(Context::empty(), llvm::toString(Path.takeError()));
+      return false;
+    }
+    R.file = *Path;
     return true;
   }
   return false;




More information about the cfe-commits mailing list