Added test for the matcher.
http://reviews.llvm.org/D9551
Files:
include/clang/ASTMatchers/ASTMatchers.h
unittests/ASTMatchers/ASTMatchersTest.cpp
Index: include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -1441,6 +1441,11 @@
Stmt,
CXXNullPtrLiteralExpr> nullPtrLiteralExpr;
+/// \brief Matches GNU __null expression.
+const internal::VariadicDynCastAllOfMatcher<
+ Stmt,
+ GNUNullExpr> gnuNullExpr;
+
/// \brief Matches binary operator expressions.
///
/// Example matches a || b
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===================================================================
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2144,6 +2144,10 @@
EXPECT_TRUE(matches("int* i = nullptr;", nullPtrLiteralExpr()));
}
+TEST(Matcher, GNUNullExpr) {
+ EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr()));
+}
+
TEST(Matcher, AsmStatement) {
EXPECT_TRUE(matches("void foo() { __asm(\"mov al, 2\"); }", asmStmt()));
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -1441,6 +1441,11 @@
Stmt,
CXXNullPtrLiteralExpr> nullPtrLiteralExpr;
+/// \brief Matches GNU __null expression.
+const internal::VariadicDynCastAllOfMatcher<
+ Stmt,
+ GNUNullExpr> gnuNullExpr;
+
/// \brief Matches binary operator expressions.
///
/// Example matches a || b
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===================================================================
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2144,6 +2144,10 @@
EXPECT_TRUE(matches("int* i = nullptr;", nullPtrLiteralExpr()));
}
+TEST(Matcher, GNUNullExpr) {
+ EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr()));
+}
+
TEST(Matcher, AsmStatement) {
EXPECT_TRUE(matches("void foo() { __asm(\"mov al, 2\"); }", asmStmt()));
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits