diff options
-rw-r--r-- | clang-tools-extra/clangd/Protocol.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index 3de53ef9f16..6e3e7dd961d 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -37,8 +37,12 @@ bool fromJSON(const json::Expr &E, URIForFile &R) { "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; |