diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2014-02-24 09:27:46 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2014-02-24 09:27:46 +0000 |
commit | 51c1b55bc2ff3dafde49f40306262aee4e662375 (patch) | |
tree | 44a4001d3c696ca27fe5157c4e63d6cfe809f04c /clang/unittests/ASTMatchers/ASTMatchersTest.cpp | |
parent | cf5d8e4f29227f6124e4b7aa5c24f16667cf5c78 (diff) | |
download | bcm5719-llvm-51c1b55bc2ff3dafde49f40306262aee4e662375.tar.gz bcm5719-llvm-51c1b55bc2ff3dafde49f40306262aee4e662375.zip |
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.
llvm-svn: 202012
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index cf77f2f4dd5..aa3c795b57d 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/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()))); |