diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2019-10-11 12:05:42 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2019-10-11 12:05:42 +0000 |
commit | 885c559369fe3d6323898c17787bd0454065fc34 (patch) | |
tree | ba43b987e078f4c2a033acc71ad3d7f1ee385a11 /clang-tools-extra/test/clang-tidy/performance-move-constructor-init.cpp | |
parent | 9f6a873268e1ad9855873d9d8007086c0d01cf4f (diff) | |
download | bcm5719-llvm-885c559369fe3d6323898c17787bd0454065fc34.tar.gz bcm5719-llvm-885c559369fe3d6323898c17787bd0454065fc34.zip |
[ClangTidy] Separate tests for infrastructure and checkers
Summary:
This change moves tests for checkers and infrastructure into separate
directories, making it easier to find infrastructure tests. Tests for
checkers are already easy to find because they are named after the
checker. Tests for infrastructure were difficult to find because they
were outnumbered by tests for checkers. Now they are in a separate
directory.
Reviewers: jfb, jdoerfert, lebedev.ri
Subscribers: srhines, nemanjai, aheejin, kbarton, christof, mgrang, arphaman, jfb, lebedev.ri, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68807
llvm-svn: 374540
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/performance-move-constructor-init.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/performance-move-constructor-init.cpp | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/clang-tools-extra/test/clang-tidy/performance-move-constructor-init.cpp b/clang-tools-extra/test/clang-tidy/performance-move-constructor-init.cpp deleted file mode 100644 index ddc1107d14c..00000000000 --- a/clang-tools-extra/test/clang-tidy/performance-move-constructor-init.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// RUN: %check_clang_tidy %s performance-move-constructor-init,modernize-pass-by-value %t -- \ -// RUN: -config='{CheckOptions: \ -// RUN: [{key: modernize-pass-by-value.ValuesOnly, value: 1}]}' \ -// RUN: -- -isystem %S/Inputs/Headers - -#include <s.h> - -// CHECK-FIXES: #include <utility> - -template <class T> struct remove_reference {typedef T type;}; -template <class T> struct remove_reference<T&> {typedef T type;}; -template <class T> struct remove_reference<T&&> {typedef T type;}; - -template <typename T> -typename remove_reference<T>::type&& move(T&& arg) { - return static_cast<typename remove_reference<T>::type&&>(arg); -} - -struct C { - C() = default; - C(const C&) = default; -}; - -struct B { - B() {} - B(const B&) {} - B(B &&) {} -}; - -struct D : B { - D() : B() {} - D(const D &RHS) : B(RHS) {} - // CHECK-NOTES: :[[@LINE+3]]:16: warning: move constructor initializes base class by calling a copy constructor [performance-move-constructor-init] - // CHECK-NOTES: 26:3: note: copy constructor being called - // CHECK-NOTES: 27:3: note: candidate move constructor here - D(D &&RHS) : B(RHS) {} -}; - -struct E : B { - E() : B() {} - E(const E &RHS) : B(RHS) {} - E(E &&RHS) : B(move(RHS)) {} // ok -}; - -struct F { - C M; - - F(F &&) : M(C()) {} // ok -}; - -struct G { - G() = default; - G(const G&) = default; - G(G&&) = delete; -}; - -struct H : G { - H() = default; - H(const H&) = default; - H(H &&RHS) : G(RHS) {} // ok -}; - -struct I { - I(const I &) = default; // suppresses move constructor creation -}; - -struct J : I { - J(J &&RHS) : I(RHS) {} // ok -}; - -struct K {}; // Has implicit copy and move constructors, is trivially copyable -struct L : K { - L(L &&RHS) : K(RHS) {} // ok -}; - -struct M { - B Mem; - // CHECK-NOTES: :[[@LINE+1]]:16: warning: move constructor initializes class member by calling a copy constructor [performance-move-constructor-init] - M(M &&RHS) : Mem(RHS.Mem) {} - // CHECK-NOTES: 26:3: note: copy constructor being called - // CHECK-NOTES: 27:3: note: candidate move constructor here -}; - -struct N { - B Mem; - N(N &&RHS) : Mem(move(RHS.Mem)) {} -}; - -struct O { - O(O&& other) : b(other.b) {} // ok - const B b; -}; - -struct P { - P(O&& other) : b(other.b) {} // ok - B b; -}; - -struct Movable { - Movable(Movable &&) = default; - Movable(const Movable &) = default; - Movable &operator=(const Movable &) = default; - ~Movable() {} -}; - -struct TriviallyCopyable { - TriviallyCopyable() = default; - TriviallyCopyable(TriviallyCopyable &&) = default; - TriviallyCopyable(const TriviallyCopyable &) = default; -}; - -struct Positive { - Positive(Movable M) : M_(M) {} - // CHECK-NOTES: [[@LINE-1]]:12: warning: pass by value and use std::move [modernize-pass-by-value] - // CHECK-FIXES: Positive(Movable M) : M_(std::move(M)) {} - Movable M_; -}; - -struct NegativeMultipleInitializerReferences { - NegativeMultipleInitializerReferences(Movable M) : M_(M), n_(M) {} - Movable M_; - Movable n_; -}; - -struct NegativeReferencedInConstructorBody { - NegativeReferencedInConstructorBody(Movable M) : M_(M) { M_ = M; } - Movable M_; -}; - -struct NegativeParamTriviallyCopyable { - NegativeParamTriviallyCopyable(TriviallyCopyable T) : T_(T) {} - NegativeParamTriviallyCopyable(int I) : I_(I) {} - - TriviallyCopyable T_; - int I_; -}; - -struct NegativeNotPassedByValue { - // This const ref constructor isn't warned about because the ValuesOnly option is set. - NegativeNotPassedByValue(const Movable &M) : M_(M) {} - NegativeNotPassedByValue(const Movable M) : M_(M) {} - NegativeNotPassedByValue(Movable &M) : M_(M) {} - NegativeNotPassedByValue(Movable *M) : M_(*M) {} - NegativeNotPassedByValue(const Movable *M) : M_(*M) {} - Movable M_; -}; - -struct Immovable { - Immovable(const Immovable &) = default; - Immovable(Immovable &&) = delete; -}; - -struct NegativeImmovableParameter { - NegativeImmovableParameter(Immovable I) : I_(I) {} - Immovable I_; -}; |