[PATCH] New AST matcher: gnuNullExpr

Szabolcs Sipos szabolcs.sipos at ericsson.com
Thu May 7 06:08:48 PDT 2015


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9551.25172.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150507/85453520/attachment.bin>


More information about the cfe-commits mailing list