[PATCH] Fix UseAuto replacing declaration lists with new expressions

Edwin Vane edwin.vane at intel.com
Thu May 23 11:22:21 PDT 2013



================
Comment at: cpp11-migrate/UseAuto/UseAutoActions.cpp:112
@@ +111,3 @@
+    // one declaration in the declaration list.
+    if (VarDecls > 0) {
+      // All delcarations should match the same non-decorated type.
----------------
Just compare DI against D->decl_begin(). No need to count VarDecls otherwise.

================
Comment at: cpp11-migrate/UseAuto/UseAutoActions.cpp:120
@@ +119,3 @@
+      SourceLocation SL = Q.getStarLoc();
+      while (SL != FirsDeclTypeLoc.getBeginLoc()) {
+        Replace.insert(tooling::Replacement(SM, SL, 1, ""));
----------------
Is this test even necessary? When you've finished unwinding all the PointerTypes, I would expect cast<PointerTypeLoc>(Q.getNexttypeLoc()) to fail no? That, is you'll unwind typelocs until you get the underlying pointed-at type.

================
Comment at: test/cpp11-migrate/UseAuto/new.cpp:68
@@ +67,3 @@
+    // CHECK: MyType *g = new MyType(), **h = new MyType*();
+  }
+  return 0;
----------------
Can we have some tests using typedefs?


http://llvm-reviews.chandlerc.com/D839



More information about the cfe-commits mailing list