summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2016-01-22 22:37:09 +0000
committerAaron Ballman <aaron@aaronballman.com>2016-01-22 22:37:09 +0000
commit31bde8762eb26c35a166292f42bd21694994bcc8 (patch)
treecc89d59ce70d48b9ae5bd79c62046103d84fbc4d /clang/unittests/ASTMatchers/ASTMatchersTest.cpp
parent343730c58fc6021fdde96e4a4bcd107de17e5cdd (diff)
downloadbcm5719-llvm-31bde8762eb26c35a166292f42bd21694994bcc8.tar.gz
bcm5719-llvm-31bde8762eb26c35a166292f42bd21694994bcc8.zip
Add am AST matcher for isMoveAssignmentOperator.
Patch by Jonathan Coe. llvm-svn: 258573
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