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/misc-unconventional-assign-operator.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/misc-unconventional-assign-operator.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-unconventional-assign-operator.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-unconventional-assign-operator.cpp b/clang-tools-extra/test/clang-tidy/misc-unconventional-assign-operator.cpp deleted file mode 100644 index a0a37c0ff1c..00000000000 --- a/clang-tools-extra/test/clang-tidy/misc-unconventional-assign-operator.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// RUN: %check_clang_tidy %s misc-unconventional-assign-operator %t -- -- -isystem %S/Inputs/Headers -fno-delayed-template-parsing - -namespace std { -template <typename T> -struct remove_reference { typedef T type; }; -template <typename T> -struct remove_reference<T &> { typedef T type; }; -template <typename T> -struct remove_reference<T &&> { typedef T type; }; -template <typename T> -typename remove_reference<T>::type &&move(T &&t); -} - - -struct Good { - Good& operator=(const Good&); - Good& operator=(Good&&); - - // Assign from other types is fine too. - Good& operator=(int); -}; - -struct AlsoGood { - // By value is also fine. - AlsoGood& operator=(AlsoGood); -}; - -struct BadReturnType { - void operator=(const BadReturnType&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'BadReturnType&' [misc-unconventional-assign-operator] - const BadReturnType& operator=(BadReturnType&&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad - void operator=(int); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad -}; - -struct BadReturnType2 { - BadReturnType2&& operator=(const BadReturnType2&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad - int operator=(BadReturnType2&&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad -}; - -struct BadArgument { - BadArgument& operator=(BadArgument&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should take 'BadArgument const&', 'BadArgument&&' or 'BadArgument' - BadArgument& operator=(const BadArgument&&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should take 'BadAr -}; - -struct BadModifier { - BadModifier& operator=(const BadModifier&) const; - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should not be marked 'const' -}; - -struct Deleted { - // We don't check the return value of deleted operators. - void operator=(const Deleted&) = delete; - void operator=(Deleted&&) = delete; -}; - -class Private { - // We don't check the return value of private operators. - // Pre-C++11 way of disabling assignment. - void operator=(const Private &); -}; - -struct Virtual { - virtual Virtual& operator=(const Virtual &); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should not be marked 'virtual' -}; - -class BadReturnStatement { - int n; - -public: - BadReturnStatement& operator=(BadReturnStatement&& rhs) { - n = std::move(rhs.n); - return rhs; -// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: operator=() should always return '*this' - } - - // Do not check if return type is different from '&BadReturnStatement' - int operator=(int i) { - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad - n = i; - return n; - } -}; - -namespace pr31531 { -enum E { e }; -// This declaration makes the 'return *this' below have an unresolved operator -// in the class template, but not in an instantiation. -E operator*(E, E); - -template <typename> -struct UnresolvedOperator { - UnresolvedOperator &operator=(const UnresolvedOperator &) { return *this; } -}; - -UnresolvedOperator<int> UnresolvedOperatorInt; - -template <typename> -struct Template { - Template &operator=(const Template &) { return this; } - // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: operator=() should always return '*this' -}; - -Template<int> TemplateInt; -} |