================
Comment at: nullptr-convert/Matchers.cpp:34-39
@@ +33,8 @@
+/// would match the declarations for p1, p2 and p3 but not p4.
+AST_MATCHER(VarDecl, hasNullInitializer) {
+ const Expr *Initializer = Node.getAnyInitializer();
+ return (Initializer != NULL && Initializer->isNullPointerConstant(
+ Node.getASTContext(), Expr::NPC_ValueDependentIsNull)
+ != Expr::NPCK_NotNull);
+}
+
----------------
Instead of just looking for a few special cases, you could find *all* null
pointer constants by looking for casts with CK_NullToPointer or
CK_NullToMemberPointer.
http://llvm-reviews.chandlerc.com/D136
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits