[PATCH] D89862: [clangd] Give the server information about client's remote index protocol version

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 05:21:32 PDT 2020


kbobyrev updated this revision to Diff 299932.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

Use ClientContext::AddMetadata to propagate VCS version info.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89862

Files:
  clang-tools-extra/clangd/index/remote/Client.cpp
  clang-tools-extra/clangd/index/remote/Index.proto


Index: clang-tools-extra/clangd/index/remote/Index.proto
===================================================================
--- clang-tools-extra/clangd/index/remote/Index.proto
+++ clang-tools-extra/clangd/index/remote/Index.proto
@@ -22,7 +22,9 @@
   rpc Relations(RelationsRequest) returns (stream RelationsReply) {}
 }
 
-message LookupRequest { repeated string ids = 1; }
+message LookupRequest {
+  repeated string ids = 1;
+}
 
 // The response is a stream of symbol messages and the terminating message
 // indicating the end of stream.
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
@@ -15,6 +15,7 @@
 #include "marshalling/Marshalling.h"
 #include "support/Logger.h"
 #include "support/Trace.h"
+#include "clang/Basic/Version.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 
@@ -40,6 +41,7 @@
     const auto RPCRequest = ProtobufMarshaller->toProtobuf(Request);
     SPAN_ATTACH(Tracer, "Request", RPCRequest.DebugString());
     grpc::ClientContext Context;
+    Context.AddMetadata("version", clang::getClangToolFullVersion("clangd"));
     std::chrono::system_clock::time_point Deadline =
         std::chrono::system_clock::now() + DeadlineWaitingTime;
     Context.set_deadline(Deadline);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89862.299932.patch
Type: text/x-patch
Size: 1411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201022/6831d45d/attachment.bin>


More information about the cfe-commits mailing list