[PATCH] Introducing initial UseAuto transform

Edwin Vane edwin.vane at intel.com
Wed Feb 13 06:51:38 PST 2013



================
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:
> Edwin Vane wrote:
> > 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.
> I think we can drop [the loop] then.  This will not break the test, and conversion operator that converts to itself will not be called implicitly.
Just to be clear, you're suggesting something like:

  const Expr *E = Construct->arg_begin()->IgnoreParenImpCasts();
  const Expr *E2 = E->IgnoreConversionOperator();
  if (E2 != E) {
    return;
  }

That is, shall we abort on a conversion expression or do we just update E with the result of `IgnoreConversionOperator()`? Or are these two options really equivalent since conversion expressions where the source and dest type are the same never happen?


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



More information about the cfe-commits mailing list