[PATCH] D85711: [clangd] Enforce trailing slash for remote index's project root
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 11 01:46:41 PDT 2020
kbobyrev updated this revision to Diff 284609.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.
Handle slash appending in Marshaller.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85711/new/
https://reviews.llvm.org/D85711
Files:
clang-tools-extra/clangd/index/remote/Client.cpp
clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
Index: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
===================================================================
--- clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -59,14 +59,16 @@
assert(llvm::sys::path::is_absolute(RemoteIndexRoot));
assert(RemoteIndexRoot ==
llvm::sys::path::convert_to_slash(RemoteIndexRoot));
- assert(RemoteIndexRoot.endswith(llvm::sys::path::get_separator()));
this->RemoteIndexRoot = RemoteIndexRoot.str();
+ if (!RemoteIndexRoot.endswith(llvm::sys::path::get_separator()))
+ *this->RemoteIndexRoot += llvm::sys::path::get_separator().str();
}
if (!LocalIndexRoot.empty()) {
assert(llvm::sys::path::is_absolute(LocalIndexRoot));
assert(LocalIndexRoot == llvm::sys::path::convert_to_slash(LocalIndexRoot));
- assert(LocalIndexRoot.endswith(llvm::sys::path::get_separator()));
this->LocalIndexRoot = LocalIndexRoot.str();
+ if (!LocalIndexRoot.endswith(llvm::sys::path::get_separator()))
+ *this->LocalIndexRoot += llvm::sys::path::get_separator().str();
}
assert(!RemoteIndexRoot.empty() || !LocalIndexRoot.empty());
}
Index: clang-tools-extra/clangd/index/remote/Client.cpp
===================================================================
--- clang-tools-extra/clangd/index/remote/Client.cpp
+++ clang-tools-extra/clangd/index/remote/Client.cpp
@@ -76,7 +76,9 @@
: Stub(remote::SymbolIndex::NewStub(Channel)),
ProtobufMarshaller(new Marshaller(/*RemoteIndexRoot=*/"",
/*LocalIndexRoot=*/ProjectRoot)),
- DeadlineWaitingTime(DeadlineTime) {}
+ DeadlineWaitingTime(DeadlineTime) {
+ assert(!ProjectRoot.empty());
+ }
void lookup(const clangd::LookupRequest &Request,
llvm::function_ref<void(const clangd::Symbol &)> Callback) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85711.284609.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200811/6fb0c5b1/attachment.bin>
More information about the cfe-commits
mailing list