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.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 3cf396a4fd9..b6983052dd8 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2028,6 +2028,16 @@ TEST(Matcher, MatchesVirtualMethod) {
EXPECT_TRUE(notMatches("class X { int f(); };", cxxMethodDecl(isVirtual())));
}
+TEST(Matcher, MatchesVirtualAsWrittenMethod) {
+ EXPECT_TRUE(matches("class A { virtual int f(); };"
+ "class B : public A { int f(); };",
+ cxxMethodDecl(isVirtualAsWritten(), hasName("::A::f"))));
+ EXPECT_TRUE(
+ notMatches("class A { virtual int f(); };"
+ "class B : public A { int f(); };",
+ cxxMethodDecl(isVirtualAsWritten(), hasName("::B::f"))));
+}
+
TEST(Matcher, MatchesPureMethod) {
EXPECT_TRUE(matches("class X { virtual int f() = 0; };",
cxxMethodDecl(isPure(), hasName("::X::f"))));
OpenPOWER on IntegriCloud