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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 17:33:57 PST 2021


njames93 created this revision.
njames93 added reviewers: alexfh, aaron.ballman.
Herald added a subscriber: xazax.hun.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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 <https://reviews.llvm.org/D26453>(rL290051 <https://reviews.llvm.org/rL290051>) but the inserter was left in, probably an oversight.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97243

Files:
  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


Index: clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst
+++ clang-tools-extra/docs/clang-tidy/checks/performance-move-constructor-init.rst
@@ -8,11 +8,3 @@
 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`.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -265,7 +265,7 @@
    `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"
@@ -332,7 +332,7 @@
    `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>`_,
Index: clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h
===================================================================
--- clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h
+++ clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.h
@@ -31,12 +31,6 @@
   }
   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
Index: clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
+++ clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
@@ -22,9 +22,7 @@
 
 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(
@@ -88,15 +86,6 @@
   }
 }
 
-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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97243.325625.patch
Type: text/x-patch
Size: 4473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210223/6f249cfa/attachment.bin>


More information about the cfe-commits mailing list