[PATCH] D101616: [clangd] Fix data type of WorkDoneProgressReport::percentage

Christian Kandeler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 05:23:08 PDT 2021


ckandeler created this revision.
ckandeler added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman.
ckandeler requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

According to the specification, this should be an unsigned integer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101616

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/Protocol.h


Index: clang-tools-extra/clangd/Protocol.h
===================================================================
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -631,7 +631,7 @@
   ///
   /// The value should be steadily rising. Clients are free to ignore values
   /// that are not following this rule.
-  llvm::Optional<double> percentage;
+  llvm::Optional<unsigned> percentage;
 };
 llvm::json::Value toJSON(const WorkDoneProgressReport &);
 //
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -1604,7 +1604,7 @@
     if (Stats.Completed < Stats.Enqueued) {
       assert(Stats.Enqueued > Stats.LastIdle);
       WorkDoneProgressReport Report;
-      Report.percentage = 100.0 * (Stats.Completed - Stats.LastIdle) /
+      Report.percentage = 100 * (Stats.Completed - Stats.LastIdle) /
                           (Stats.Enqueued - Stats.LastIdle);
       Report.message =
           llvm::formatv("{0}/{1}", Stats.Completed - Stats.LastIdle,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101616.341852.patch
Type: text/x-patch
Size: 1151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210430/ccad674f/attachment.bin>


More information about the cfe-commits mailing list