steveire created this revision.
steveire added reviewers: aaron.ballman, njames93.
steveire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97158

Files:
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===================================================================
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -3660,10 +3660,10 @@
 TEST_P(ASTMatchersTest, NullPointerConstant) {
   EXPECT_TRUE(matches("#define NULL ((void *)0)\n"
                       "void *v1 = NULL;",
-                      expr(nullPointerConstant())));
-  EXPECT_TRUE(matches("char *cp = (char *)0;", expr(nullPointerConstant())));
-  EXPECT_TRUE(matches("int *ip = 0;", expr(nullPointerConstant())));
-  EXPECT_FALSE(matches("int i = 0;", expr(nullPointerConstant())));
+                      nullPointerConstant()));
+  EXPECT_TRUE(matches("char *cp = (char *)0;", nullPointerConstant()));
+  EXPECT_TRUE(matches("int *ip = 0;", nullPointerConstant()));
+  EXPECT_FALSE(matches("int i = 0;", nullPointerConstant()));
 }
 
 TEST_P(ASTMatchersTest, NullPointerConstant_GNUNull) {
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -7379,10 +7379,10 @@
 /// expr(nullPointerConstant())
 ///   matches the initializer for v1, v2, v3, cp, and ip. Does not match the
 ///   initializer for i.
-AST_MATCHER_FUNCTION(internal::Matcher<Expr>, nullPointerConstant) {
-  return anyOf(
+AST_MATCHER_FUNCTION(internal::BindableMatcher<Stmt>, nullPointerConstant) {
+  return stmt(anyOf(
       gnuNullExpr(), cxxNullPtrLiteralExpr(),
-      integerLiteral(equals(0), hasParent(expr(hasType(pointerType())))));
+      integerLiteral(equals(0), hasParent(expr(hasType(pointerType()))))));
 }
 
 /// Matches the DecompositionDecl the binding belongs to.


Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===================================================================
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -3660,10 +3660,10 @@
 TEST_P(ASTMatchersTest, NullPointerConstant) {
   EXPECT_TRUE(matches("#define NULL ((void *)0)\n"
                       "void *v1 = NULL;",
-                      expr(nullPointerConstant())));
-  EXPECT_TRUE(matches("char *cp = (char *)0;", expr(nullPointerConstant())));
-  EXPECT_TRUE(matches("int *ip = 0;", expr(nullPointerConstant())));
-  EXPECT_FALSE(matches("int i = 0;", expr(nullPointerConstant())));
+                      nullPointerConstant()));
+  EXPECT_TRUE(matches("char *cp = (char *)0;", nullPointerConstant()));
+  EXPECT_TRUE(matches("int *ip = 0;", nullPointerConstant()));
+  EXPECT_FALSE(matches("int i = 0;", nullPointerConstant()));
 }
 
 TEST_P(ASTMatchersTest, NullPointerConstant_GNUNull) {
Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -7379,10 +7379,10 @@
 /// expr(nullPointerConstant())
 ///   matches the initializer for v1, v2, v3, cp, and ip. Does not match the
 ///   initializer for i.
-AST_MATCHER_FUNCTION(internal::Matcher<Expr>, nullPointerConstant) {
-  return anyOf(
+AST_MATCHER_FUNCTION(internal::BindableMatcher<Stmt>, nullPointerConstant) {
+  return stmt(anyOf(
       gnuNullExpr(), cxxNullPtrLiteralExpr(),
-      integerLiteral(equals(0), hasParent(expr(hasType(pointerType())))));
+      integerLiteral(equals(0), hasParent(expr(hasType(pointerType()))))));
 }
 
 /// Matches the DecompositionDecl the binding belongs to.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to