[clang-tools-extra] 26f9e49 - [clangd] Delete deprecated enumerateTweaks endpoint

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 00:14:31 PDT 2023


Author: Kadir Cetinkaya
Date: 2023-09-11T09:09:12+02:00
New Revision: 26f9e49d9c92255f7e6e0420eb1d549a023bbcb5

URL: https://github.com/llvm/llvm-project/commit/26f9e49d9c92255f7e6e0420eb1d549a023bbcb5
DIFF: https://github.com/llvm/llvm-project/commit/26f9e49d9c92255f7e6e0420eb1d549a023bbcb5.diff

LOG: [clangd] Delete deprecated enumerateTweaks endpoint

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index dce6bfc04ce6dd5..13d788162817fb4 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -704,38 +704,6 @@ void ClangdServer::codeAction(const CodeActionInputs &Params,
                             Transient);
 }
 
-void ClangdServer::enumerateTweaks(
-    PathRef File, Range Sel, llvm::unique_function<bool(const Tweak &)> Filter,
-    Callback<std::vector<TweakRef>> CB) {
-  auto Action = [Sel, CB = std::move(CB), Filter = std::move(Filter),
-                 FeatureModules(this->FeatureModules)](
-                    Expected<InputsAndAST> InpAST) mutable {
-    if (!InpAST)
-      return CB(InpAST.takeError());
-    auto Selections = tweakSelection(Sel, *InpAST, /*FS=*/nullptr);
-    if (!Selections)
-      return CB(Selections.takeError());
-    std::vector<TweakRef> Res;
-    // Don't allow a tweak to fire more than once across ambiguous selections.
-    llvm::DenseSet<llvm::StringRef> PreparedTweaks;
-    auto DeduplicatingFilter = [&](const Tweak &T) {
-      return Filter(T) && !PreparedTweaks.count(T.id());
-    };
-    for (const auto &Sel : *Selections) {
-      for (auto &T : prepareTweaks(*Sel, DeduplicatingFilter, FeatureModules)) {
-        Res.push_back({T->id(), T->title(), T->kind()});
-        PreparedTweaks.insert(T->id());
-        TweakAvailable.record(1, T->id());
-      }
-    }
-
-    CB(std::move(Res));
-  };
-
-  WorkScheduler->runWithAST("EnumerateTweaks", File, std::move(Action),
-                            Transient);
-}
-
 void ClangdServer::applyTweak(PathRef File, Range Sel, StringRef TweakID,
                               Callback<Tweak::Effect> CB) {
   // Tracks number of times a tweak has been attempted.

diff  --git a/clang-tools-extra/clangd/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h
index 2bc8f02ff38a4bd..a416602251428b0 100644
--- a/clang-tools-extra/clangd/ClangdServer.h
+++ b/clang-tools-extra/clangd/ClangdServer.h
@@ -386,13 +386,6 @@ class ClangdServer {
   void codeAction(const CodeActionInputs &Inputs,
                   Callback<CodeActionResult> CB);
 
-  /// Enumerate the code tweaks available to the user at a specified point.
-  /// Tweaks where Filter returns false will not be checked or included.
-  /// Deprecated, use codeAction instead.
-  void enumerateTweaks(PathRef File, Range Sel,
-                       llvm::unique_function<bool(const Tweak &)> Filter,
-                       Callback<std::vector<TweakRef>> CB);
-
   /// Apply the code tweak with a specified \p ID.
   void applyTweak(PathRef File, Range Sel, StringRef ID,
                   Callback<Tweak::Effect> CB);


        


More information about the cfe-commits mailing list