[PATCH] D17034: Add an AST matcher for null pointers

Samuel Benzaquen via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 11:30:59 PST 2016


sbenza added inline comments.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:4821
@@ +4820,3 @@
+///   initializer for i.
+AST_MATCHER(Expr, nullPointerConstant) {
+  return Matcher<Expr>(
----------------
Use AST_MATCHER_FUNCTION instead, where the return value is the matcher (instead of the application of the matcher).
It is simpler to write and since it has no arguments it will memoize the matcher and construct it only once.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:4821
@@ +4820,3 @@
+///   initializer for i.
+AST_MATCHER(Expr, nullPointerConstant) {
+  return Matcher<Expr>(
----------------
sbenza wrote:
> Use AST_MATCHER_FUNCTION instead, where the return value is the matcher (instead of the application of the matcher).
> It is simpler to write and since it has no arguments it will memoize the matcher and construct it only once.
Maybe use Expr::isNullPointerConstant?


http://reviews.llvm.org/D17034





More information about the cfe-commits mailing list