Author: Kirill Bobyrev Date: 2020-10-27T11:46:16+01:00 New Revision: d26dd743084a886382204ede5eeed146cd29fcd6
URL: https://github.com/llvm/llvm-project/commit/d26dd743084a886382204ede5eeed146cd29fcd6 DIFF: https://github.com/llvm/llvm-project/commit/d26dd743084a886382204ede5eeed146cd29fcd6.diff LOG: [clangd] Separate final_result into a different message This is a breaking change in remote index protocol. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D89851 Added: Modified: clang-tools-extra/clangd/index/remote/Client.cpp clang-tools-extra/clangd/index/remote/Index.proto clang-tools-extra/clangd/index/remote/server/Server.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/index/remote/Client.cpp b/clang-tools-extra/clangd/index/remote/Client.cpp index a134d9c72932..ff6f1b2898d7 100644 --- a/clang-tools-extra/clangd/index/remote/Client.cpp +++ b/clang-tools-extra/clangd/index/remote/Client.cpp @@ -52,7 +52,7 @@ class IndexClient : public clangd::SymbolIndex { unsigned FailedToParse = 0; while (Reader->Read(&Reply)) { if (!Reply.has_stream_result()) { - FinalResult = Reply.final_result(); + FinalResult = Reply.final_result().has_more(); continue; } auto Response = ProtobufMarshaller->fromProtobuf(Reply.stream_result()); diff --git a/clang-tools-extra/clangd/index/remote/Index.proto b/clang-tools-extra/clangd/index/remote/Index.proto index 7619d0cb2ef3..27d17c77192b 100644 --- a/clang-tools-extra/clangd/index/remote/Index.proto +++ b/clang-tools-extra/clangd/index/remote/Index.proto @@ -10,6 +10,9 @@ syntax = "proto2"; package clang.clangd.remote; +// Common final result for streaming requests. +message FinalResult { optional bool has_more = 1; } + message LookupRequest { repeated string ids = 1; } // The response is a stream of symbol messages and the terminating message @@ -17,7 +20,7 @@ message LookupRequest { repeated string ids = 1; } message LookupReply { oneof kind { Symbol stream_result = 1; - bool final_result = 2; + FinalResult final_result = 2; } } @@ -36,7 +39,7 @@ message FuzzyFindRequest { message FuzzyFindReply { oneof kind { Symbol stream_result = 1; - bool final_result = 2; // HasMore + FinalResult final_result = 2; } } @@ -51,7 +54,7 @@ message RefsRequest { message RefsReply { oneof kind { Ref stream_result = 1; - bool final_result = 2; // HasMore + FinalResult final_result = 2; } } @@ -116,7 +119,7 @@ message RelationsRequest { message RelationsReply { oneof kind { Relation stream_result = 1; - bool final_result = 2; // HasMore + FinalResult final_result = 2; } } diff --git a/clang-tools-extra/clangd/index/remote/server/Server.cpp b/clang-tools-extra/clangd/index/remote/server/Server.cpp index 7b68549a4afd..38bb754e17cf 100644 --- a/clang-tools-extra/clangd/index/remote/server/Server.cpp +++ b/clang-tools-extra/clangd/index/remote/server/Server.cpp @@ -109,7 +109,7 @@ class RemoteIndexServer final : public v1::SymbolIndex::Service { ++Sent; }); LookupReply LastMessage; - LastMessage.set_final_result(true); + LastMessage.mutable_final_result()->set_has_more(true); Reply->Write(LastMessage); SPAN_ATTACH(Tracer, "Sent", Sent); SPAN_ATTACH(Tracer, "Failed to send", FailedToSend); @@ -142,7 +142,7 @@ class RemoteIndexServer final : public v1::SymbolIndex::Service { ++Sent; }); FuzzyFindReply LastMessage; - LastMessage.set_final_result(HasMore); + LastMessage.mutable_final_result()->set_has_more(HasMore); Reply->Write(LastMessage); SPAN_ATTACH(Tracer, "Sent", Sent); SPAN_ATTACH(Tracer, "Failed to send", FailedToSend); @@ -173,7 +173,7 @@ class RemoteIndexServer final : public v1::SymbolIndex::Service { ++Sent; }); RefsReply LastMessage; - LastMessage.set_final_result(HasMore); + LastMessage.mutable_final_result()->set_has_more(HasMore); Reply->Write(LastMessage); SPAN_ATTACH(Tracer, "Sent", Sent); SPAN_ATTACH(Tracer, "Failed to send", FailedToSend); @@ -207,7 +207,7 @@ class RemoteIndexServer final : public v1::SymbolIndex::Service { ++Sent; }); RelationsReply LastMessage; - LastMessage.set_final_result(true); + LastMessage.mutable_final_result()->set_has_more(true); Reply->Write(LastMessage); SPAN_ATTACH(Tracer, "Sent", Sent); SPAN_ATTACH(Tracer, "Failed to send", FailedToSend); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits