r236731 - Adding new AST matcher: gnuNullExpr

Szabolcs Sipos szabolcs.sipos at ericsson.com
Thu May 7 07:24:22 PDT 2015


Author: eszasip
Date: Thu May  7 09:24:22 2015
New Revision: 236731

URL: http://llvm.org/viewvc/llvm-project?rev=236731&view=rev
Log:
Adding new AST matcher: gnuNullExpr

It matches GNU __null expression.

Modified:
    cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
    cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=236731&r1=236730&r2=236731&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Thu May  7 09:24:22 2015
@@ -1441,6 +1441,11 @@ const internal::VariadicDynCastAllOfMatc
   Stmt,
   CXXNullPtrLiteralExpr> nullPtrLiteralExpr;
 
+/// \brief Matches GNU __null expression.
+const internal::VariadicDynCastAllOfMatcher<
+  Stmt,
+  GNUNullExpr> gnuNullExpr;
+
 /// \brief Matches binary operator expressions.
 ///
 /// Example matches a || b

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=236731&r1=236730&r2=236731&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Thu May  7 09:24:22 2015
@@ -2144,6 +2144,10 @@ TEST(Matcher, NullPtrLiteral) {
   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()));
 }





More information about the cfe-commits mailing list