alexfh created this revision.
Herald added subscribers: xazax.hun, mgorny.

rename_check.py misc-move-const-arg performance-move-const-arg
rename_check.py misc-noexcept-move-constructor 
performance-noexcept-move-constructor


https://reviews.llvm.org/D40507

Files:
  clang-tidy/hicpp/HICPPTidyModule.cpp
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/MoveConstantArgumentCheck.cpp
  clang-tidy/misc/MoveConstantArgumentCheck.h
  clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
  clang-tidy/misc/NoexceptMoveConstructorCheck.h
  clang-tidy/modernize/PassByValueCheck.cpp
  clang-tidy/performance/CMakeLists.txt
  clang-tidy/performance/MoveConstArgCheck.cpp
  clang-tidy/performance/MoveConstArgCheck.h
  clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
  clang-tidy/performance/NoexceptMoveConstructorCheck.h
  clang-tidy/performance/PerformanceTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/hicpp-move-const-arg.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-move-const-arg.rst
  docs/clang-tidy/checks/misc-noexcept-move-constructor.rst
  docs/clang-tidy/checks/performance-move-const-arg.rst
  docs/clang-tidy/checks/performance-noexcept-move-constructor.rst
  test/clang-tidy/misc-move-const-arg.cpp
  test/clang-tidy/misc-noexcept-move-constructor.cpp
  test/clang-tidy/modernize-pass-by-value.cpp
  test/clang-tidy/performance-move-const-arg.cpp
  test/clang-tidy/performance-noexcept-move-constructor.cpp

Index: test/clang-tidy/performance-noexcept-move-constructor.cpp
===================================================================
--- test/clang-tidy/performance-noexcept-move-constructor.cpp
+++ test/clang-tidy/performance-noexcept-move-constructor.cpp
@@ -1,16 +1,18 @@
-// RUN: %check_clang_tidy %s misc-noexcept-move-constructor %t
+// RUN: %check_clang_tidy %s performance-noexcept-move-constructor %t
 
 class A {
   A(A &&);
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: move constructors should be marked noexcept [misc-noexcept-move-constructor]
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: move constructors should be marked
+  // noexcept [performance-noexcept-move-constructor]
   A &operator=(A &&);
   // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: move assignment operators should
 };
 
 struct B {
   static constexpr bool kFalse = false;
   B(B &&) noexcept(kFalse);
-  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: noexcept specifier on the move constructor evaluates to 'false' [misc-noexcept-move-constructor]
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: noexcept specifier on the move
+  // constructor evaluates to 'false' [performance-noexcept-move-constructor]
 };
 
 class OK {};
@@ -24,16 +26,16 @@
  public:
   OK1();
   OK1(const OK1 &);
-  OK1(OK1&&) noexcept;
+  OK1(OK1 &&) noexcept;
   OK1 &operator=(OK1 &&) noexcept;
   void f();
   void g() noexcept;
 };
 
 class OK2 {
   static constexpr bool kTrue = true;
 
-public:
+ public:
   OK2(OK2 &&) noexcept(true) {}
   OK2 &operator=(OK2 &&) noexcept(kTrue) { return *this; }
 };
Index: test/clang-tidy/performance-move-const-arg.cpp
===================================================================
--- test/clang-tidy/performance-move-const-arg.cpp
+++ test/clang-tidy/performance-move-const-arg.cpp
@@ -1,73 +1,91 @@
-// RUN: %check_clang_tidy %s misc-move-const-arg %t
+// RUN: %check_clang_tidy %s performance-move-const-arg %t
 
 namespace std {
-template <typename> struct remove_reference;
+template <typename>
+struct remove_reference;
 
-template <typename _Tp> struct remove_reference { typedef _Tp type; };
+template <typename _Tp>
+struct remove_reference {
+  typedef _Tp type;
+};
 
-template <typename _Tp> struct remove_reference<_Tp &> { typedef _Tp type; };
+template <typename _Tp>
+struct remove_reference<_Tp &> {
+  typedef _Tp type;
+};
 
-template <typename _Tp> struct remove_reference<_Tp &&> { typedef _Tp type; };
+template <typename _Tp>
+struct remove_reference<_Tp &&> {
+  typedef _Tp type;
+};
 
 template <typename _Tp>
 constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) {
   return static_cast<typename std::remove_reference<_Tp>::type &&>(__t);
 }
 
-} // namespace std
+}  // namespace std
 
 class A {
-public:
+ public:
   A() {}
   A(const A &rhs) {}
   A(A &&rhs) {}
 };
 
 int f1() {
   return std::move(42);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the expression of the trivially-copyable type 'int' has no effect; remove std::move() [misc-move-const-arg]
-  // CHECK-FIXES: return 42;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the expression of
+  // the trivially-copyable type 'int' has no effect; remove std::move()
+  // [performance-move-const-arg] CHECK-FIXES: return 42;
 }
 
 int f2(int x2) {
   return std::move(x2);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable 'x2' of the trivially-copyable type 'int'
-  // CHECK-FIXES: return x2;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable 'x2' of
+  // the trivially-copyable type 'int' CHECK-FIXES: return x2;
 }
 
 int *f3(int *x3) {
   return std::move(x3);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable 'x3' of the trivially-copyable type 'int *'
-  // CHECK-FIXES: return x3;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable 'x3' of
+  // the trivially-copyable type 'int *' CHECK-FIXES: return x3;
 }
 
 A f4(A x4) { return std::move(x4); }
 
 A f5(const A x5) {
   return std::move(x5);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable 'x5' has no effect; remove std::move() or make the variable non-const [misc-move-const-arg]
-  // CHECK-FIXES: return x5;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable
+  // 'x5' has no effect; remove std::move() or make the variable non-const
+  // [performance-move-const-arg] CHECK-FIXES: return x5;
 }
 
-template <typename T> T f6(const T x6) { return std::move(x6); }
+template <typename T>
+T f6(const T x6) {
+  return std::move(x6);
+}
 
 void f7() { int a = f6(10); }
 
 #define M1(x) x
 void f8() {
   const A a;
   M1(A b = std::move(a);)
-  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: std::move of the const variable 'a' has no effect; remove std::move() or make the variable non-const
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: std::move of the const variable
+  // 'a' has no effect; remove std::move() or make the variable non-const
   // CHECK-FIXES: M1(A b = a;)
 }
 
 #define M2(x) std::move(x)
 int f9() { return M2(1); }
 
-template <typename T> T f10(const int x10) {
+template <typename T>
+T f10(const int x10) {
   return std::move(x10);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable 'x10' of the trivially-copyable type 'const int' has no effect; remove std::move() [misc-move-const-arg]
-  // CHECK-FIXES: return x10;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable
+  // 'x10' of the trivially-copyable type 'const int' has no effect; remove
+  // std::move() [performance-move-const-arg] CHECK-FIXES: return x10;
 }
 void f11() {
   f10<int>(1);
@@ -165,14 +183,12 @@
 }
 
 class MoveOnly {
-public:
+ public:
   MoveOnly(const MoveOnly &other) = delete;
   MoveOnly &operator=(const MoveOnly &other) = delete;
   MoveOnly(MoveOnly &&other) = default;
   MoveOnly &operator=(MoveOnly &&other) = default;
 };
 template <class T>
 void Q(T);
-void moveOnlyNegatives(MoveOnly val) {
-  Q(std::move(val));
-}
+void moveOnlyNegatives(MoveOnly val) { Q(std::move(val)); }
Index: test/clang-tidy/modernize-pass-by-value.cpp
===================================================================
--- test/clang-tidy/modernize-pass-by-value.cpp
+++ test/clang-tidy/modernize-pass-by-value.cpp
@@ -202,7 +202,7 @@
 template <typename T, int N> struct array { T A[N]; };
 
 // Test that types that are trivially copyable will not use std::move. This will
-// cause problems with misc-move-const-arg, as it will revert it.
+// cause problems with performance-move-const-arg, as it will revert it.
 struct T {
   T(array<int, 10> a) : a_(a) {}
   // CHECK-FIXES: T(array<int, 10> a) : a_(a) {}
Index: docs/clang-tidy/checks/performance-noexcept-move-constructor.rst
===================================================================
--- docs/clang-tidy/checks/performance-noexcept-move-constructor.rst
+++ docs/clang-tidy/checks/performance-noexcept-move-constructor.rst
@@ -1,7 +1,7 @@
-.. title:: clang-tidy - misc-noexcept-move-constructor
+.. title:: clang-tidy - performance-noexcept-move-constructor
 
-misc-noexcept-move-constructor
-==============================
+performance-noexcept-move-constructor
+=====================================
 
 
 The check flags user-defined move constructors and assignment operators not
Index: docs/clang-tidy/checks/performance-move-const-arg.rst
===================================================================
--- docs/clang-tidy/checks/performance-move-const-arg.rst
+++ docs/clang-tidy/checks/performance-move-const-arg.rst
@@ -1,7 +1,7 @@
-.. title:: clang-tidy - misc-move-const-arg
+.. title:: clang-tidy - performance-move-const-arg
 
-misc-move-const-arg
-===================
+performance-move-const-arg
+==========================
 
 The check warns
 
Index: docs/clang-tidy/checks/list.rst
===================================================================
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -93,7 +93,7 @@
    hicpp-function-size (redirects to readability-function-size) <hicpp-function-size>
    hicpp-invalid-access-moved (redirects to bugprone-use-after-move) <hicpp-invalid-access-moved>
    hicpp-member-init (redirects to cppcoreguidelines-pro-type-member-init) <hicpp-member-init>
-   hicpp-move-const-arg (redirects to misc-move-const-arg) <hicpp-move-const-arg>
+   hicpp-move-const-arg (redirects to performance-move-const-arg) <hicpp-move-const-arg>
    hicpp-named-parameter (redirects to readability-named-parameter) <hicpp-named-parameter>
    hicpp-new-delete-operators (redirects to misc-new-delete-overloads) <hicpp-new-delete-operators>
    hicpp-no-array-decay (redirects to cppcoreguidelines-pro-bounds-array-to-pointer-decay) <hicpp-no-array-decay>
@@ -124,9 +124,7 @@
    misc-macro-repeated-side-effects
    misc-misplaced-const
    misc-misplaced-widening-cast
-   misc-move-const-arg
    misc-new-delete-overloads
-   misc-noexcept-move-constructor
    misc-non-copyable-objects
    misc-redundant-expression
    misc-sizeof-container
@@ -182,7 +180,9 @@
    performance-inefficient-algorithm
    performance-inefficient-string-concatenation
    performance-inefficient-vector-operation
+   performance-move-const-arg
    performance-move-constructor-init
+   performance-noexcept-move-constructor
    performance-type-promotion-in-math-fn
    performance-unnecessary-copy-initialization
    performance-unnecessary-value-param
Index: docs/clang-tidy/checks/hicpp-move-const-arg.rst
===================================================================
--- docs/clang-tidy/checks/hicpp-move-const-arg.rst
+++ docs/clang-tidy/checks/hicpp-move-const-arg.rst
@@ -1,10 +1,10 @@
 .. title:: clang-tidy - hicpp-move-const-arg
 .. meta::
-   :http-equiv=refresh: 5;URL=misc-move-const-arg.html
+   :http-equiv=refresh: 5;URL=performance-move-const-arg.html
 
 hicpp-move-const-arg
 ====================
 
 The `hicpp-move-const-arg` check is an alias, please see
-`misc-move-const-arg <misc-move-const-arg.html>`_ for more information.
+`performance-move-const-arg <performance-move-const-arg.html>`_ for more information.
 It enforces the `rule 17.3.1 <http://www.codingstandard.com/rule/17-3-1-do-not-use-stdmove-on-objects-declared-with-const-or-const-type/>`_.
Index: docs/ReleaseNotes.rst
===================================================================
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -57,6 +57,12 @@
 Improvements to clang-tidy
 --------------------------
 
+- The 'misc-move-const-arg' check was renamed to `performance-move-const-arg
+  <http://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html>`_
+
+- The 'misc-noexcept-move-constructor' check was renamed to `performance-noexcept-move-constructor
+  <http://clang.llvm.org/extra/clang-tidy/checks/performance-noexcept-move-constructor.html>`_
+
 - The 'misc-move-constructor-init' check was renamed to `performance-move-constructor-init
   <http://clang.llvm.org/extra/clang-tidy/checks/performance-move-constructor-init.html>`_
 
Index: clang-tidy/performance/PerformanceTidyModule.cpp
===================================================================
--- clang-tidy/performance/PerformanceTidyModule.cpp
+++ clang-tidy/performance/PerformanceTidyModule.cpp
@@ -16,7 +16,9 @@
 #include "InefficientAlgorithmCheck.h"
 #include "InefficientStringConcatenationCheck.h"
 #include "InefficientVectorOperationCheck.h"
+#include "MoveConstArgCheck.h"
 #include "MoveConstructorInitCheck.h"
+#include "NoexceptMoveConstructorCheck.h"
 #include "TypePromotionInMathFnCheck.h"
 #include "UnnecessaryCopyInitialization.h"
 #include "UnnecessaryValueParamCheck.h"
@@ -40,8 +42,12 @@
         "performance-inefficient-string-concatenation");
     CheckFactories.registerCheck<InefficientVectorOperationCheck>(
         "performance-inefficient-vector-operation");
+    CheckFactories.registerCheck<MoveConstArgCheck>(
+        "performance-move-const-arg");
     CheckFactories.registerCheck<MoveConstructorInitCheck>(
         "performance-move-constructor-init");
+    CheckFactories.registerCheck<NoexceptMoveConstructorCheck>(
+        "performance-noexcept-move-constructor");
     CheckFactories.registerCheck<TypePromotionInMathFnCheck>(
         "performance-type-promotion-in-math-fn");
     CheckFactories.registerCheck<UnnecessaryCopyInitialization>(
Index: clang-tidy/performance/NoexceptMoveConstructorCheck.h
===================================================================
--- clang-tidy/performance/NoexceptMoveConstructorCheck.h
+++ clang-tidy/performance/NoexceptMoveConstructorCheck.h
@@ -7,14 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_NOEXCEPTMOVECONSTRUCTORCHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_NOEXCEPTMOVECONSTRUCTORCHECK_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOEXCEPTMOVECONSTRUCTORCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOEXCEPTMOVECONSTRUCTORCHECK_H
 
 #include "../ClangTidy.h"
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace performance {
 
 /// The check flags user-defined move constructors and assignment operators not
 /// marked with `noexcept` or marked with `noexcept(expr)` where `expr`
@@ -24,15 +24,15 @@
 /// need to be declared `noexcept`. Otherwise STL will choose copy constructors
 /// instead. The same is valid for move assignment operations.
 class NoexceptMoveConstructorCheck : public ClangTidyCheck {
-public:
+ public:
   NoexceptMoveConstructorCheck(StringRef Name, ClangTidyContext *Context)
       : ClangTidyCheck(Name, Context) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace misc
-} // namespace tidy
-} // namespace clang
+}  // namespace performance
+}  // namespace tidy
+}  // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_NOEXCEPTMOVECONSTRUCTORCHECK_H
+#endif  // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOEXCEPTMOVECONSTRUCTORCHECK_H
Index: clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
===================================================================
--- clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
+++ clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
@@ -15,13 +15,12 @@
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace performance {
 
 void NoexceptMoveConstructorCheck::registerMatchers(MatchFinder *Finder) {
   // Only register the matchers for C++11; the functionality currently does not
   // provide any benefit to other languages, despite being benign.
-  if (!getLangOpts().CPlusPlus11)
-    return;
+  if (!getLangOpts().CPlusPlus11) return;
 
   Finder->addMatcher(
       cxxMethodDecl(anyOf(cxxConstructorDecl(), hasOverloadedOperatorName("=")),
@@ -35,17 +34,15 @@
   if (const auto *Decl = Result.Nodes.getNodeAs<CXXMethodDecl>("decl")) {
     StringRef MethodType = "assignment operator";
     if (const auto *Ctor = dyn_cast<CXXConstructorDecl>(Decl)) {
-      if (!Ctor->isMoveConstructor())
-        return;
+      if (!Ctor->isMoveConstructor()) return;
       MethodType = "constructor";
     } else if (!Decl->isMoveAssignmentOperator()) {
       return;
     }
 
     const auto *ProtoType = Decl->getType()->getAs<FunctionProtoType>();
 
-    if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
-      return;
+    if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType())) return;
 
     switch (ProtoType->getNoexceptSpec(*Result.Context)) {
       case FunctionProtoType::NR_NoNoexcept:
@@ -57,8 +54,7 @@
         // Don't complain about nothrow(false), but complain on nothrow(expr)
         // where expr evaluates to false.
         if (const Expr *E = ProtoType->getNoexceptExpr()) {
-          if (isa<CXXBoolLiteralExpr>(E))
-            break;
+          if (isa<CXXBoolLiteralExpr>(E)) break;
           diag(E->getExprLoc(),
                "noexcept specifier on the move %0 evaluates to 'false'")
               << MethodType;
@@ -72,6 +68,6 @@
   }
 }
 
-} // namespace misc
-} // namespace tidy
-} // namespace clang
+}  // namespace performance
+}  // namespace tidy
+}  // namespace clang
Index: clang-tidy/performance/MoveConstArgCheck.h
===================================================================
--- clang-tidy/performance/MoveConstArgCheck.h
+++ clang-tidy/performance/MoveConstArgCheck.h
@@ -1,4 +1,4 @@
-//===--- MoveConstantArgumentCheck.h - clang-tidy -------------------------===//
+//===--- MoveConstArgCheck.h - clang-tidy -------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,18 +14,18 @@
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace performance {
 
-class MoveConstantArgumentCheck : public ClangTidyCheck {
-public:
-  MoveConstantArgumentCheck(StringRef Name, ClangTidyContext *Context)
+class MoveConstArgCheck : public ClangTidyCheck {
+ public:
+  MoveConstArgCheck(StringRef Name, ClangTidyContext *Context)
       : ClangTidyCheck(Name, Context) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace misc
-} // namespace tidy
-} // namespace clang
+}  // namespace performance
+}  // namespace tidy
+}  // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTANTARGUMENTCHECK_H
+#endif  // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTANTARGUMENTCHECK_H
Index: clang-tidy/performance/MoveConstArgCheck.cpp
===================================================================
--- clang-tidy/performance/MoveConstArgCheck.cpp
+++ clang-tidy/performance/MoveConstArgCheck.cpp
@@ -1,21 +1,21 @@
-//===--- MoveConstantArgumentCheck.cpp - clang-tidy -----------------------===//
+//===--- MoveConstArgCheck.cpp - clang-tidy -----------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 
-#include "MoveConstantArgumentCheck.h"
+#include "MoveConstArgCheck.h"
 
 #include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace performance {
 
 static void ReplaceCallWithArg(const CallExpr *Call, DiagnosticBuilder &Diag,
                                const SourceManager &SM,
@@ -36,9 +36,8 @@
   }
 }
 
-void MoveConstantArgumentCheck::registerMatchers(MatchFinder *Finder) {
-  if (!getLangOpts().CPlusPlus)
-    return;
+void MoveConstArgCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus) return;
 
   auto MoveCallMatcher =
       callExpr(callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
@@ -55,7 +54,7 @@
                      this);
 }
 
-void MoveConstantArgumentCheck::check(const MatchFinder::MatchResult &Result) {
+void MoveConstArgCheck::check(const MatchFinder::MatchResult &Result) {
   const auto *CallMove = Result.Nodes.getNodeAs<CallExpr>("call-move");
   const auto *ReceivingExpr = Result.Nodes.getNodeAs<Expr>("receiving-expr");
   const Expr *Arg = CallMove->getArg(0);
@@ -65,8 +64,7 @@
       CharSourceRange::getCharRange(CallMove->getSourceRange());
   CharSourceRange FileMoveRange =
       Lexer::makeFileCharRange(MoveRange, SM, getLangOpts());
-  if (!FileMoveRange.isValid())
-    return;
+  if (!FileMoveRange.isValid()) return;
 
   bool IsConstArg = Arg->getType().isConstQualified();
   bool IsTriviallyCopyable =
@@ -77,12 +75,10 @@
       // According to [expr.prim.lambda]p3, "whether the closure type is
       // trivially copyable" property can be changed by the implementation of
       // the language, so we shouldn't rely on it when issuing diagnostics.
-      if (R->isLambda())
-        return;
+      if (R->isLambda()) return;
       // Don't warn when the type is not copyable.
       for (const auto *Ctor : R->ctors()) {
-        if (Ctor->isCopyConstructor() && Ctor->isDeleted())
-          return;
+        if (Ctor->isCopyConstructor() && Ctor->isDeleted()) return;
       }
     }
     bool IsVariable = isa<DeclRefExpr>(Arg);
@@ -108,6 +104,6 @@
   }
 }
 
-} // namespace misc
-} // namespace tidy
-} // namespace clang
+}  // namespace performance
+}  // namespace tidy
+}  // namespace clang
Index: clang-tidy/performance/CMakeLists.txt
===================================================================
--- clang-tidy/performance/CMakeLists.txt
+++ clang-tidy/performance/CMakeLists.txt
@@ -7,7 +7,9 @@
   InefficientAlgorithmCheck.cpp
   InefficientStringConcatenationCheck.cpp
   InefficientVectorOperationCheck.cpp
+  MoveConstArgCheck.cpp
   MoveConstructorInitCheck.cpp
+  NoexceptMoveConstructorCheck.cpp
   PerformanceTidyModule.cpp
   TypePromotionInMathFnCheck.cpp
   UnnecessaryCopyInitialization.cpp
Index: clang-tidy/modernize/PassByValueCheck.cpp
===================================================================
--- clang-tidy/modernize/PassByValueCheck.cpp
+++ clang-tidy/modernize/PassByValueCheck.cpp
@@ -187,7 +187,7 @@
     return;
 
   // If the parameter is trivial to copy, don't move it. Moving a trivivally
-  // copyable type will cause a problem with misc-move-const-arg
+  // copyable type will cause a problem with performance-move-const-arg
   if (ParamDecl->getType().getNonReferenceType().isTriviallyCopyableType(
           *Result.Context))
     return;
Index: clang-tidy/misc/MiscTidyModule.cpp
===================================================================
--- clang-tidy/misc/MiscTidyModule.cpp
+++ clang-tidy/misc/MiscTidyModule.cpp
@@ -18,9 +18,7 @@
 #include "MacroRepeatedSideEffectsCheck.h"
 #include "MisplacedConstCheck.h"
 #include "MisplacedWideningCastCheck.h"
-#include "MoveConstantArgumentCheck.h"
 #include "NewDeleteOverloadsCheck.h"
-#include "NoexceptMoveConstructorCheck.h"
 #include "NonCopyableObjects.h"
 #include "RedundantExpressionCheck.h"
 #include "SizeofContainerCheck.h"
@@ -67,12 +65,8 @@
         "misc-macro-repeated-side-effects");
     CheckFactories.registerCheck<MisplacedWideningCastCheck>(
         "misc-misplaced-widening-cast");
-    CheckFactories.registerCheck<MoveConstantArgumentCheck>(
-        "misc-move-const-arg");
     CheckFactories.registerCheck<NewDeleteOverloadsCheck>(
         "misc-new-delete-overloads");
-    CheckFactories.registerCheck<NoexceptMoveConstructorCheck>(
-        "misc-noexcept-move-constructor");
     CheckFactories.registerCheck<NonCopyableObjectsCheck>(
         "misc-non-copyable-objects");
     CheckFactories.registerCheck<RedundantExpressionCheck>(
Index: clang-tidy/misc/CMakeLists.txt
===================================================================
--- clang-tidy/misc/CMakeLists.txt
+++ clang-tidy/misc/CMakeLists.txt
@@ -11,9 +11,7 @@
   MacroRepeatedSideEffectsCheck.cpp
   MiscTidyModule.cpp
   MisplacedWideningCastCheck.cpp
-  MoveConstantArgumentCheck.cpp
   NewDeleteOverloadsCheck.cpp
-  NoexceptMoveConstructorCheck.cpp
   NonCopyableObjects.cpp
   RedundantExpressionCheck.cpp
   SizeofContainerCheck.cpp
Index: clang-tidy/hicpp/HICPPTidyModule.cpp
===================================================================
--- clang-tidy/hicpp/HICPPTidyModule.cpp
+++ clang-tidy/hicpp/HICPPTidyModule.cpp
@@ -18,9 +18,7 @@
 #include "../cppcoreguidelines/SpecialMemberFunctionsCheck.h"
 #include "../google/DefaultArgumentsCheck.h"
 #include "../google/ExplicitConstructorCheck.h"
-#include "../misc/MoveConstantArgumentCheck.h"
 #include "../misc/NewDeleteOverloadsCheck.h"
-#include "../misc/NoexceptMoveConstructorCheck.h"
 #include "../misc/StaticAssertCheck.h"
 #include "../misc/UndelegatedConstructor.h"
 #include "../modernize/DeprecatedHeadersCheck.h"
@@ -31,6 +29,8 @@
 #include "../modernize/UseNoexceptCheck.h"
 #include "../modernize/UseNullptrCheck.h"
 #include "../modernize/UseOverrideCheck.h"
+#include "../performance/MoveConstArgCheck.h"
+#include "../performance/NoexceptMoveConstructorCheck.h"
 #include "../readability/BracesAroundStatementsCheck.h"
 #include "../readability/FunctionSizeCheck.h"
 #include "../readability/IdentifierNamingCheck.h"
@@ -63,11 +63,11 @@
         "hicpp-invalid-access-moved");
     CheckFactories.registerCheck<cppcoreguidelines::ProTypeMemberInitCheck>(
         "hicpp-member-init");
-    CheckFactories.registerCheck<misc::MoveConstantArgumentCheck>(
+    CheckFactories.registerCheck<performance::MoveConstArgCheck>(
         "hicpp-move-const-arg");
     CheckFactories.registerCheck<misc::NewDeleteOverloadsCheck>(
         "hicpp-new-delete-operators");
-    CheckFactories.registerCheck<misc::NoexceptMoveConstructorCheck>(
+    CheckFactories.registerCheck<performance::NoexceptMoveConstructorCheck>(
         "hicpp-noexcept-move");
     CheckFactories
         .registerCheck<cppcoreguidelines::ProBoundsArrayToPointerDecayCheck>(
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to