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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162153 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index dcebbc9..7f1f083 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2013,6 +2013,19 @@
                       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; }",