diff options
| author | Gabor Horvath <xazax.hun@gmail.com> | 2016-05-04 12:02:22 +0000 |
|---|---|---|
| committer | Gabor Horvath <xazax.hun@gmail.com> | 2016-05-04 12:02:22 +0000 |
| commit | 112d1e80c061e35c61c4d2f4da5b8b3c624812b2 (patch) | |
| tree | 5b3bc6fd13c711d3b8a2c7d8aed46a0ccc26d060 /clang-tools-extra/test/clang-tidy/misc-assign-operator-signature.cpp | |
| parent | 4807f829b4457a35ce5b9e2fd780cbf748612944 (diff) | |
| download | bcm5719-llvm-112d1e80c061e35c61c4d2f4da5b8b3c624812b2.tar.gz bcm5719-llvm-112d1e80c061e35c61c4d2f4da5b8b3c624812b2.zip | |
[clang-tidy] New: checker misc-unconventional-assign-operator replacing misc-assign-operator-signature
Summary: Finds return statements in assign operator bodies where the return value is different from '*this'. Only assignment operators with correct return value Class& are checked.
Reviewers: aaron.ballman, alexfh, sbenza
Subscribers: o.gyorgy, baloghadamsoftware, LegalizeAdulthood, aaron.ballman, Eugene.Zelenko, xazax.hun, cfe-commits
Differential Revision: http://reviews.llvm.org/D18265
llvm-svn: 268492
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-assign-operator-signature.cpp')
| -rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-assign-operator-signature.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-assign-operator-signature.cpp b/clang-tools-extra/test/clang-tidy/misc-assign-operator-signature.cpp deleted file mode 100644 index 8609fb91684..00000000000 --- a/clang-tools-extra/test/clang-tidy/misc-assign-operator-signature.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// RUN: %check_clang_tidy %s misc-assign-operator-signature %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 BadReturn { - void operator=(const BadReturn&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'BadReturn&' [misc-assign-operator-signature] - const BadReturn& operator=(BadReturn&&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad - void operator=(int); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad -}; -struct BadReturn2 { - BadReturn2&& operator=(const BadReturn2&); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: operator=() should return 'Bad - int operator=(BadReturn2&&); - // 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' -}; |

