[clang-tools-extra] e96f9cc - [clang-tidy] Remove IncludeInserter from MoveConstructorInit check.

Nathan James via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 05:48:18 PST 2021


Author: Nathan James
Date: 2021-02-23T13:48:07Z
New Revision: e96f9cca3b1b346cf9764c4a3b7417a46ef59f12

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

LOG: [clang-tidy] Remove IncludeInserter from MoveConstructorInit check.

This check registers an IncludeInserter, however the check itself doesn't actually emit any fixes or includes, so the inserter is redundant.

>From what I can tell the fixes were removed in D26453(rL290051) but the inserter was left in, probably an oversight.

Reviewed By: aaron.ballman

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

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
    clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h
    clang-tools-extra/docs/clang-tidy/checks/list.rst
    clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
index 35afa31746df..34d8e7206290 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
@@ -10,9 +10,6 @@
 #include "../utils/Matchers.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Lex/Lexer.h"
-#include "clang/Lex/Preprocessor.h"
 
 using namespace clang::ast_matchers;
 
@@ -22,9 +19,7 @@ namespace performance {
 
 MoveConstructorInitCheck::MoveConstructorInitCheck(StringRef Name,
                                                    ClangTidyContext *Context)
-    : ClangTidyCheck(Name, Context),
-      Inserter(Options.getLocalOrGlobal("IncludeStyle",
-                                        utils::IncludeSorter::IS_LLVM)) {}
+    : ClangTidyCheck(Name, Context) {}
 
 void MoveConstructorInitCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
@@ -68,7 +63,7 @@ void MoveConstructorInitCheck::check(const MatchFinder::MatchResult &Result) {
       // initializer.
       //
       // FIXME: Determine whether the move constructor is a viable candidate
-      // for the ctor-initializer, perhaps provide a fixit that suggests
+      // for the ctor-initializer, perhaps provide a fix-it that suggests
       // using std::move().
       Candidate = Ctor;
       break;
@@ -88,15 +83,6 @@ void MoveConstructorInitCheck::check(const MatchFinder::MatchResult &Result) {
   }
 }
 
-void MoveConstructorInitCheck::registerPPCallbacks(
-    const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
-  Inserter.registerPreprocessor(PP);
-}
-
-void MoveConstructorInitCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
-  Options.store(Opts, "IncludeStyle", Inserter.getStyle());
-}
-
 } // namespace performance
 } // namespace tidy
 } // namespace clang

diff  --git a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h
index 0b637b617782..fae4c08954b1 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h
@@ -10,9 +10,6 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H
 
 #include "../ClangTidyCheck.h"
-#include "../utils/IncludeInserter.h"
-
-#include <memory>
 
 namespace clang {
 namespace tidy {
@@ -31,12 +28,6 @@ class MoveConstructorInitCheck : public ClangTidyCheck {
   }
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
-  void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
-                           Preprocessor *ModuleExpanderPP) override;
-  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
-
-private:
-  utils::IncludeInserter Inserter;
 };
 
 } // namespace performance

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index 23365e417f71..e53c0e704963 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -264,7 +264,7 @@ Clang-Tidy Checks
    `performance-inefficient-string-concatenation <performance-inefficient-string-concatenation.html>`_,
    `performance-inefficient-vector-operation <performance-inefficient-vector-operation.html>`_, "Yes"
    `performance-move-const-arg <performance-move-const-arg.html>`_, "Yes"
-   `performance-move-constructor-init <performance-move-constructor-init.html>`_, "Yes"
+   `performance-move-constructor-init <performance-move-constructor-init.html>`_,
    `performance-no-automatic-move <performance-no-automatic-move.html>`_,
    `performance-no-int-to-ptr <performance-no-int-to-ptr.html>`_,
    `performance-noexcept-move-constructor <performance-noexcept-move-constructor.html>`_, "Yes"
@@ -331,7 +331,7 @@ Clang-Tidy Checks
    `cert-fio38-c <cert-fio38-c.html>`_, `misc-non-copyable-objects <misc-non-copyable-objects.html>`_,
    `cert-msc30-c <cert-msc30-c.html>`_, `cert-msc50-cpp <cert-msc50-cpp.html>`_,
    `cert-msc32-c <cert-msc32-c.html>`_, `cert-msc51-cpp <cert-msc51-cpp.html>`_,
-   `cert-oop11-cpp <cert-oop11-cpp.html>`_, `performance-move-constructor-init <performance-move-constructor-init.html>`_, "Yes"
+   `cert-oop11-cpp <cert-oop11-cpp.html>`_, `performance-move-constructor-init <performance-move-constructor-init.html>`_,
    `cert-oop54-cpp <cert-oop54-cpp.html>`_, `bugprone-unhandled-self-assignment <bugprone-unhandled-self-assignment.html>`_,
    `cert-pos44-c <cert-pos44-c.html>`_, `bugprone-bad-signal-to-kill-thread <bugprone-bad-signal-to-kill-thread.html>`_,
    `cert-pos47-c <cert-pos47-c.html>`_, `concurrency-thread-canceltype-asynchronous <concurrency-thread-canceltype-asynchronous.html>`_,

diff  --git a/clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst b/clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst
index a193b9ee85a8..9dc0761d2c34 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst
@@ -8,11 +8,3 @@ performance-move-constructor-init
 The check flags user-defined move constructors that have a ctor-initializer
 initializing a member or base class through a copy constructor instead of a
 move constructor.
-
-Options
--------
-
-.. option:: IncludeStyle
-
-   A string specifying which include-style is used, `llvm` or `google`. Default
-   is `llvm`.


        


More information about the cfe-commits mailing list