[PATCH] D83831: [clangd] Add more logs and attach tracers to remote index server routines

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 03:19:28 PDT 2020


kbobyrev updated this revision to Diff 280383.
kbobyrev added a comment.

Reset D83831 <https://reviews.llvm.org/D83831> to master.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83831

Files:
  clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
  clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp


Index: clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
+++ clang-tools-extra/clangd/unittests/remote/MarshallingTests.cpp
@@ -282,10 +282,17 @@
 
 TEST(RemoteMarshallingTest, FuzzyFindRequestSerialization) {
   clangd::FuzzyFindRequest Request;
+<<<<<<< HEAD
   Request.ProximityPaths = {testPath("local/Header.h"),
                             testPath("local/subdir/OtherHeader.h"),
                             testPath("remote/File.h"), "Not a Path."};
   Marshaller ProtobufMarshaller(testPath("remote/"), testPath("local/"));
+=======
+  Request.ProximityPaths = {testPath("remote/Header.h"),
+                            testPath("remote/subdir/OtherHeader.h"),
+                            testPath("notremote/File.h"), "Not a Path."};
+  Marshaller ProtobufMarshaller(testPath("remote/"), testPath("home/"));
+>>>>>>> 529b83e6cf3... [clangd] Don't send invalid messages from remote index
   auto Serialized = ProtobufMarshaller.toProtobuf(Request);
   EXPECT_EQ(Serialized.proximity_paths_size(), 2);
   auto Deserialized = ProtobufMarshaller.fromProtobuf(&Serialized);
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
@@ -51,7 +51,11 @@
 
 clangd::FuzzyFindRequest
 Marshaller::fromProtobuf(const FuzzyFindRequest *Request) {
+<<<<<<< HEAD
   assert(RemoteIndexRoot);
+=======
+  assert(LocalIndexRoot);
+>>>>>>> 529b83e6cf3... [clangd] Don't send invalid messages from remote index
   clangd::FuzzyFindRequest Result;
   Result.Query = Request->query();
   for (const auto &Scope : Request->scopes())
@@ -61,7 +65,11 @@
     Result.Limit = Request->limit();
   Result.RestrictForCodeCompletion = Request->restricted_for_code_completion();
   for (const auto &Path : Request->proximity_paths()) {
+<<<<<<< HEAD
     llvm::SmallString<256> LocalPath = llvm::StringRef(*RemoteIndexRoot);
+=======
+    llvm::SmallString<256> LocalPath = llvm::StringRef(*LocalIndexRoot);
+>>>>>>> 529b83e6cf3... [clangd] Don't send invalid messages from remote index
     llvm::sys::path::append(LocalPath, Path);
     Result.ProximityPaths.push_back(std::string(LocalPath));
   }
@@ -146,7 +154,11 @@
 }
 
 FuzzyFindRequest Marshaller::toProtobuf(const clangd::FuzzyFindRequest &From) {
+<<<<<<< HEAD
   assert(LocalIndexRoot);
+=======
+  assert(RemoteIndexRoot);
+>>>>>>> 529b83e6cf3... [clangd] Don't send invalid messages from remote index
   FuzzyFindRequest RPCRequest;
   RPCRequest.set_query(From.Query);
   for (const auto &Scope : From.Scopes)
@@ -157,7 +169,11 @@
   RPCRequest.set_restricted_for_code_completion(From.RestrictForCodeCompletion);
   for (const auto &Path : From.ProximityPaths) {
     llvm::SmallString<256> RelativePath = llvm::StringRef(Path);
+<<<<<<< HEAD
     if (llvm::sys::path::replace_path_prefix(RelativePath, *LocalIndexRoot,
+=======
+    if (llvm::sys::path::replace_path_prefix(RelativePath, *RemoteIndexRoot,
+>>>>>>> 529b83e6cf3... [clangd] Don't send invalid messages from remote index
                                              ""))
       RPCRequest.add_proximity_paths(llvm::sys::path::convert_to_slash(
           RelativePath, llvm::sys::path::Style::posix));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83831.280383.patch
Type: text/x-patch
Size: 3486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200724/20733d46/attachment-0001.bin>


More information about the cfe-commits mailing list