This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG888307ee625b: [clangd][remote-client] Set HasMore to true 
for failure (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101915

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


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
@@ -64,7 +64,10 @@
                  StreamingCall<RequestT, ReplyT> RPCCall,
                  CallbackT Callback) const {
     updateConnectionStatus();
-    bool FinalResult = false;
+    // We initialize to true because stream might be broken before we see the
+    // final message. In such a case there are actually more results on the
+    // stream, but we couldn't get to them.
+    bool HasMore = true;
     trace::Span Tracer(RequestT::descriptor()->name());
     const auto RPCRequest = ProtobufMarshaller->toProtobuf(Request);
     SPAN_ATTACH(Tracer, "Request", RPCRequest.DebugString());
@@ -82,7 +85,7 @@
     unsigned FailedToParse = 0;
     while (Reader->Read(&Reply)) {
       if (!Reply.has_stream_result()) {
-        FinalResult = Reply.final_result().has_more();
+        HasMore = Reply.final_result().has_more();
         continue;
       }
       auto Response = ProtobufMarshaller->fromProtobuf(Reply.stream_result());
@@ -105,7 +108,7 @@
     SPAN_ATTACH(Tracer, "Successful", Successful);
     SPAN_ATTACH(Tracer, "Failed to parse", FailedToParse);
     updateConnectionStatus();
-    return FinalResult;
+    return HasMore;
   }
 
 public:


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
@@ -64,7 +64,10 @@
                  StreamingCall<RequestT, ReplyT> RPCCall,
                  CallbackT Callback) const {
     updateConnectionStatus();
-    bool FinalResult = false;
+    // We initialize to true because stream might be broken before we see the
+    // final message. In such a case there are actually more results on the
+    // stream, but we couldn't get to them.
+    bool HasMore = true;
     trace::Span Tracer(RequestT::descriptor()->name());
     const auto RPCRequest = ProtobufMarshaller->toProtobuf(Request);
     SPAN_ATTACH(Tracer, "Request", RPCRequest.DebugString());
@@ -82,7 +85,7 @@
     unsigned FailedToParse = 0;
     while (Reader->Read(&Reply)) {
       if (!Reply.has_stream_result()) {
-        FinalResult = Reply.final_result().has_more();
+        HasMore = Reply.final_result().has_more();
         continue;
       }
       auto Response = ProtobufMarshaller->fromProtobuf(Reply.stream_result());
@@ -105,7 +108,7 @@
     SPAN_ATTACH(Tracer, "Successful", Successful);
     SPAN_ATTACH(Tracer, "Failed to parse", FailedToParse);
     updateConnectionStatus();
-    return FinalResult;
+    return HasMore;
   }
 
 public:
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to