[PATCH] D83826: [clangd] Don't send invalid messages from remote index

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 20 08:23:40 PDT 2020


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/index/remote/Client.cpp:68
+        DeadlineWaitingTime(DeadlineTime) {
+    ProtobufMarshaller = std::unique_ptr<Marshaller>(
+        new Marshaller(/*RemoteIndexRoot=*/"", /*LocalIndexRoot=*/ProjectRoot));
----------------
this is PratabufMarshaller.reset(new...) or just initialize it in the init list


================
Comment at: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp:199
   Result.set_name(From.Name.str());
-  auto Definition = toProtobuf(From.Definition, IndexRoot);
-  if (Definition)
+  if (std::strlen(From.Definition.FileURI)) {
+    auto Definition = toProtobuf(From.Definition);
----------------
nit: just if (*From.Definition.FileURI)?


================
Comment at: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp:244
+  if (!Location) {
+    elog("Can not convert Reference to potobuf (invalid location) {0}: {1}",
+         From, From.Location);
----------------
potobuf -> protobuf


================
Comment at: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.h:67
 
-LookupRequest toProtobuf(const clangd::LookupRequest &From);
-FuzzyFindRequest toProtobuf(const clangd::FuzzyFindRequest &From,
-                            llvm::StringRef IndexRoot);
-RefsRequest toProtobuf(const clangd::RefsRequest &From);
+  void setLocalIndexRoot(llvm::StringRef NewRoot);
+  void setRemoteIndexRoot(llvm::StringRef NewRoot);
----------------
why are these needed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83826/new/

https://reviews.llvm.org/D83826





More information about the cfe-commits mailing list