[PATCH] Introducing initial UseAuto transform

Edwin Vane edwin.vane at intel.com
Tue Feb 12 11:41:28 PST 2013



================
Comment at: cpp11-migrate/UseAuto/UseAutoActions.cpp:35
@@ +34,3 @@
+  // Drill down to the as-written initializer.
+  const Expr *E = Construct->arg_begin()->IgnoreParenImpCasts();
+
----------------
Dmitri Gribenko wrote:
> Is `IgnoreParenImpCasts()` needed here?  We will do it in the loop body anyway.
You're right. Holdover from pre-loop code.

================
Comment at: test/cpp11-migrate/UseAuto/iterator.cpp:67-70
@@ +66,6 @@
+
+  // declarator-id is not the same type as initializer expression. No transform
+  // should happen.
+  std::vector<int>::iterator I2 = myI;
+  // CHECK: std::vector<int>::iterator I2 = myI;
+
----------------
Dmitri Gribenko wrote:
> So this transformation was not being done even without this change?
That's right. The point of that code originally was to get at the as-written source of the conversion operator. In this case, the source type of the conversion op was not the same as the dest so the change wasn't made. Now we abort on any conversion ops, even those whose source type is the same as the dest (if that's even possible) because of the side effect thing you mentioned.


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



More information about the cfe-commits mailing list