[cfe-commits] r162153 - /cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
Dmitri Gribenko
gribozavr at gmail.com
Fri Aug 17 17:29:28 PDT 2012
Author: gribozavr
Date: Fri Aug 17 19:29:27 2012
New Revision: 162153
URL: http://llvm.org/viewvc/llvm-project?rev=162153&view=rev
Log:
AST Matchers tests: test that member() matches member allocation functions.
Modified:
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=162153&r1=162152&r2=162153&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Fri Aug 17 19:29:27 2012
@@ -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; }",
More information about the cfe-commits
mailing list