[clang-tools-extra] 6815037 - [clangd][NFC] Remove unnecessary string captures in lambdas.

Nathan James via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 05:27:35 PDT 2021


Author: Nathan James
Date: 2021-04-30T13:27:24+01:00
New Revision: 6815037085945be8bb758c23b1a5daabe0a8667d

URL: https://github.com/llvm/llvm-project/commit/6815037085945be8bb758c23b1a5daabe0a8667d
DIFF: https://github.com/llvm/llvm-project/commit/6815037085945be8bb758c23b1a5daabe0a8667d.diff

LOG: [clangd][NFC] Remove unnecessary string captures in lambdas.

Due to a somewhat annoying, but necessary, shortfall in -Wunused-lambda-capture, These unused captures aren't warned about.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D101611

Added: 
    

Modified: 
    clang-tools-extra/clangd/ClangdLSPServer.cpp
    clang-tools-extra/clangd/ClangdServer.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index 4916dfaafd5ae..a7cc1ed42818f 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -725,8 +725,8 @@ void ClangdLSPServer::onCommandApplyEdit(const WorkspaceEdit &WE,
 
 void ClangdLSPServer::onCommandApplyTweak(const TweakArgs &Args,
                                           Callback<llvm::json::Value> Reply) {
-  auto Action = [this, Reply = std::move(Reply),
-                 File = Args.file](llvm::Expected<Tweak::Effect> R) mutable {
+  auto Action = [this, Reply = std::move(Reply)](
+                    llvm::Expected<Tweak::Effect> R) mutable {
     if (!R)
       return Reply(R.takeError());
 

diff  --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 11cd1a8fee537..3f8b95b9104ce 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -575,8 +575,7 @@ void ClangdServer::enumerateTweaks(
   // Tracks number of times a tweak has been offered.
   static constexpr trace::Metric TweakAvailable(
       "tweak_available", trace::Metric::Counter, "tweak_id");
-  auto Action = [File = File.str(), Sel, CB = std::move(CB),
-                 Filter = std::move(Filter),
+  auto Action = [Sel, CB = std::move(CB), Filter = std::move(Filter),
                  FeatureModules(this->FeatureModules)](
                     Expected<InputsAndAST> InpAST) mutable {
     if (!InpAST)
@@ -756,8 +755,7 @@ void ClangdServer::incomingCalls(
 
 void ClangdServer::inlayHints(PathRef File,
                               Callback<std::vector<InlayHint>> CB) {
-  auto Action = [File = File.str(),
-                 CB = std::move(CB)](Expected<InputsAndAST> InpAST) mutable {
+  auto Action = [CB = std::move(CB)](Expected<InputsAndAST> InpAST) mutable {
     if (!InpAST)
       return CB(InpAST.takeError());
     CB(clangd::inlayHints(InpAST->AST));


        


More information about the cfe-commits mailing list