summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index ab1997ab0f3..67d3de9f819 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2059,6 +2059,21 @@ TEST(Matcher, MatchesCopyAssignmentOperator) {
cxxMethodDecl(isCopyAssignmentOperator())));
}
+TEST(Matcher, MatchesMoveAssignmentOperator) {
+ EXPECT_TRUE(notMatches("class X { X &operator=(X); };",
+ cxxMethodDecl(isMoveAssignmentOperator())));
+ EXPECT_TRUE(matches("class X { X &operator=(X &&); };",
+ cxxMethodDecl(isMoveAssignmentOperator())));
+ EXPECT_TRUE(matches("class X { X &operator=(const X &&); };",
+ cxxMethodDecl(isMoveAssignmentOperator())));
+ EXPECT_TRUE(matches("class X { X &operator=(volatile X &&); };",
+ cxxMethodDecl(isMoveAssignmentOperator())));
+ EXPECT_TRUE(matches("class X { X &operator=(const volatile X &&); };",
+ cxxMethodDecl(isMoveAssignmentOperator())));
+ EXPECT_TRUE(notMatches("class X { X &operator=(X &); };",
+ cxxMethodDecl(isMoveAssignmentOperator())));
+}
+
TEST(Matcher, MatchesConstMethod) {
EXPECT_TRUE(
matches("struct A { void foo() const; };", cxxMethodDecl(isConst())));
OpenPOWER on IntegriCloud