AST Matchers tests: test that member() matches member allocation functions.

llvm-svn: 162153
This commit is contained in:
Dmitri Gribenko 2012-08-18 00:29:27 +00:00
parent 319e927ae1
commit 0696304a61
1 changed files with 13 additions and 0 deletions

View File

@ -2013,6 +2013,19 @@ TEST(Member, MatchesInMemberFunctionCall) {
memberExpression(member(hasName("first")))));
}
TEST(Member, MatchesMemberAllocationFunction) {
EXPECT_TRUE(matches("namespace std { typedef unsigned long size_t; }"
"class X { void *operator new(std::size_t); };",
method(ofClass(hasName("X")))));
EXPECT_TRUE(matches("class X { void operator delete(void*); };",
method(ofClass(hasName("X")))));
EXPECT_TRUE(matches("namespace std { typedef unsigned long size_t; }"
"class X { void operator delete[](void*, std::size_t); };",
method(ofClass(hasName("X")))));
}
TEST(HasObjectExpression, DoesNotMatchMember) {
EXPECT_TRUE(notMatches(
"class X {}; struct Z { X m; }; void f(Z z) { z.m; }",