[PATCH] Fix UseAuto replacing declaration lists with new expressions
Edwin Vane
edwin.vane at intel.com
Tue May 21 12:24:15 PDT 2013
================
Comment at: cpp11-migrate/UseAuto/UseAutoActions.cpp:97
@@ -118,1 +96,3 @@
+ ->IgnoreParenImpCasts());
+ assert(NewExpr && "Bad Callback. No CXXNewExpr provided");
----------------
Change the assert message. It's not a callback problem but rather a CXXNewExpr should be expected thanks to the matcher.
================
Comment at: cpp11-migrate/UseAuto/UseAutoActions.cpp:104
@@ +103,3 @@
+
+ if (V->getType()->isPointerType()) {
+ // Find and remove the '*' from pointer types.
----------------
This will always be true. What you really care about is VarDecls #>=2. Also, you only care if a star is actually involved. If you're dealing with a typedef it may not be:
typedef int * int_p;
int_p a = new int, b = new int;
================
Comment at: cpp11-migrate/UseAuto/UseAutoActions.cpp:125
@@ +124,3 @@
+ // changing 'int *p' into autop'.
+ if(!V->getType()->isPointerType())
+ Replace.insert(tooling::Replacement(SM, Range, "auto"));
----------------
Again, the type will always be a pointer. Check about typedefs?
================
Comment at: cpp11-migrate/UseAuto/UseAutoActions.cpp:128
@@ +127,3 @@
+ else
+ Replace.insert(tooling::Replacement(SM, Range, "auto "));
+ ++AcceptedChanges;
----------------
why two and not one?
http://llvm-reviews.chandlerc.com/D839
More information about the cfe-commits
mailing list