From f088af37e6b570dd070ae4e6fc14e22d21cda3be Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 10 May 2021 14:56:55 +0200 Subject: [PATCH] [clangd] Fix data type of WorkDoneProgressReport::percentage According to the specification, this should be an unsigned integer. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D101616 --- clang-tools-extra/clangd/ClangdLSPServer.cpp | 2 +- clang-tools-extra/clangd/Protocol.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index 913c5c3..c25195c 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -1606,7 +1606,7 @@ void ClangdLSPServer::onBackgroundIndexProgress( 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, diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index 2ae6091..f0d46ab 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -631,7 +631,7 @@ struct WorkDoneProgressReport { /// /// The value should be steadily rising. Clients are free to ignore values /// that are not following this rule. - llvm::Optional percentage; + llvm::Optional percentage; }; llvm::json::Value toJSON(const WorkDoneProgressReport &); // -- 2.7.4