[PATCH] Refactor UseNullptr matcher to avoid duplication
Edwin Vane
edwin.vane at intel.com
Mon Apr 1 09:27:27 PDT 2013
Your work is based on an old version of the master branch. You'll want to do an update and resubmit this patch.
================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:137
@@ -106,3 +136,3 @@
const CastExpr *NullCast = Result.Nodes.getNodeAs<CastExpr>(CastSequence);
if (NullCast) {
----------------
You should just assert NullCast is not null. The matcher is bad if you get a nullptr here.
================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:139
@@ -108,5 +138,3 @@
if (NullCast) {
- // Given an explicit cast with an implicit null-to-pointer cast within
- // use CastSequenceVisitor to identify sequences of explicit casts that can
- // be converted into 'nullptr'.
- CastSequenceVisitor Visitor(Replace, SM, AcceptedChanges);
+ NullCast->dumpColor();
+ // Given an explicit cast with an implicit null-to-pointer cast within use
----------------
debug code to remove.
================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:140
@@ +139,3 @@
+ NullCast->dumpColor();
+ // Given an explicit cast with an implicit null-to-pointer cast within use
+ // CastSequenceVisitor to identify implicit casts and sequences of explicit
----------------
Need to update this comment. NullCast is no longer an explicit cast necessarily.
================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:100
@@ +99,3 @@
+ if (ImmediateMacroName != "NULL")
+ return true;
+
----------------
This should be return false to tell the AST Visitor to stop visiting.
================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:111
@@ +110,3 @@
+ } else
+ return true;
+ }
----------------
This should be return false to tell the AST Visitor to stop visiting.
http://llvm-reviews.chandlerc.com/D604
More information about the cfe-commits
mailing list