diff options
author | Haojian Wu <hokein@google.com> | 2019-07-12 08:50:20 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2019-07-12 08:50:20 +0000 |
commit | 7eeb82b58554163962d2696ce9be7d021d5b25d4 (patch) | |
tree | 1f2bec1621a6248db3bf0dfea1f7fc3d502dd6d0 /clang-tools-extra/clangd/refactor/Tweak.h | |
parent | fafec5155e39f5dad098376c1beb4a56604aa655 (diff) | |
download | bcm5719-llvm-7eeb82b58554163962d2696ce9be7d021d5b25d4.tar.gz bcm5719-llvm-7eeb82b58554163962d2696ce9be7d021d5b25d4.zip |
[clangd] Don't run the prepare for tweaks that are disabled.
Summary: Previously, we ran the prepare, even for the tweaks that are disabled.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64565
llvm-svn: 365882
Diffstat (limited to 'clang-tools-extra/clangd/refactor/Tweak.h')
-rw-r--r-- | clang-tools-extra/clangd/refactor/Tweak.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/refactor/Tweak.h b/clang-tools-extra/clangd/refactor/Tweak.h index 883ad7c3699..79e0f3eceee 100644 --- a/clang-tools-extra/clangd/refactor/Tweak.h +++ b/clang-tools-extra/clangd/refactor/Tweak.h @@ -110,9 +110,11 @@ public: TweakRegistrationFor##Subclass(#Subclass, /*Description=*/""); \ const char *Subclass::id() const { return #Subclass; } -/// Calls prepare() on all tweaks, returning those that can run on the -/// selection. -std::vector<std::unique_ptr<Tweak>> prepareTweaks(const Tweak::Selection &S); +/// Calls prepare() on all tweaks that satisfy the filter, returning those that +/// can run on the selection. +std::vector<std::unique_ptr<Tweak>> +prepareTweaks(const Tweak::Selection &S, + llvm::function_ref<bool(const Tweak &)> Filter); // Calls prepare() on the tweak with a given ID. // If prepare() returns false, returns an error. |