summaryrefslogtreecommitdiff
path: root/unittests/ASTMatchers
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2014-02-24 09:27:46 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2014-02-24 09:27:46 +0000
commit3790613579db81a9f78a7ddad5382dbeec43a07a (patch)
treeb04c9e0764cdcadd3a815daaf1ac81dec6056f54 /unittests/ASTMatchers
parent5e8440c0e59675badba925a26191b0d38189d7fb (diff)
downloadclang-3790613579db81a9f78a7ddad5382dbeec43a07a.tar.gz
clang-3790613579db81a9f78a7ddad5382dbeec43a07a.tar.bz2
clang-3790613579db81a9f78a7ddad5382dbeec43a07a.tar.xz
ASTMatchers: added CXXMethodDecl matcher isPure()
The isPure() CXXMethodDecl matcher matches pure method declaration like "A::x" in this example: class A { virtual void x() = 0; } Patch by Konrad Kleine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202012 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers')
-rw-r--r--unittests/ASTMatchers/ASTMatchersTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index cf77f2f4dd..aa3c795b57 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1588,6 +1588,13 @@ TEST(Matcher, MatchesVirtualMethod) {
methodDecl(isVirtual())));
}
+TEST(Matcher, MatchesPureMethod) {
+ EXPECT_TRUE(matches("class X { virtual int f() = 0; };",
+ methodDecl(isPure(), hasName("::X::f"))));
+ EXPECT_TRUE(notMatches("class X { int f(); };",
+ methodDecl(isPure())));
+}
+
TEST(Matcher, MatchesConstMethod) {
EXPECT_TRUE(matches("struct A { void foo() const; };",
methodDecl(isConst())));