[PATCH] Introducing initial UseAuto transform

Dmitri Gribenko gribozavr at gmail.com
Tue Feb 12 08:52:52 PST 2013


  > I'm not sure sugar really matters.

  It does.  `vector<int>::_Iter_type x = ...;` is not valid C++, no matter if it actually compiles on a particular implementation or not.  And transforming non-portable code is asking for trouble.

  > That said, one could foresee an improvement to this transform that tests for unusual sugar and then prompts the user.

  It can be done easier, I think.  We know that all functions that return iterators have a return value type with correct sugar.  That is, `vector<T>::begin()` return value is always `vector<T>::iterator`.  We should desugar the user-provided type until we hit that correct type (then we are sure that the transformation is safe), or we get a canonical type (and that means that the code is unportable).

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



More information about the cfe-commits mailing list