r180266 - Add an idea for cpp11-migrate and cpp14-migrate

David Blaikie dblaikie at gmail.com
Thu Apr 25 16:45:58 PDT 2013


On Thu, Apr 25, 2013 at 9:07 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> Author: gribozavr
> Date: Thu Apr 25 11:07:10 2013
> New Revision: 180266
>
> URL: http://llvm.org/viewvc/llvm-project?rev=180266&view=rev
> Log:
> Add an idea for cpp11-migrate and cpp14-migrate
>
> Modified:
>     cfe/trunk/docs/ClangTools.rst
>
> Modified: cfe/trunk/docs/ClangTools.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangTools.rst?rev=180266&r1=180265&r2=180266&view=diff
> ==============================================================================
> --- cfe/trunk/docs/ClangTools.rst (original)
> +++ cfe/trunk/docs/ClangTools.rst Thu Apr 25 11:07:10 2013
> @@ -124,6 +124,21 @@ Ideas for new Tools
>    ``foo.begin()`` into ``begin(foo)`` and similarly for ``end()``, where
>    ``foo`` is a standard container.  We could also detect similar patterns for
>    arrays.
> +* ``make_shared`` / ``make_unique`` conversion.  This transformation can be
> +  incorporated into the ``auto`` transformation.  Will convert
> +
> +  .. code-block:: c++
> +
> +    std::shared_ptr<Foo> sp(new Foo);
> +    std::unique_ptr<Foo> up(new Foo);

FWIW: it would be as or more important to make this transformation in
function parameters & the like:

func(std::shared_ptr<Foo>(new Foo), bar());

=>

func(std::make_shared<Foo>(), bar());

(for the cases where bar() throws, the latter is safe & the former may leak)

> +
> +  into:
> +
> +  .. code-block:: c++
> +
> +    auto sp = std::make_shared<Foo>();
> +    auto up = std::make_unique<Foo>(); // In C++14 mode.
> +
>  * ``tr1`` removal tool.  Will migrate source code from using TR1 library
>    features to C++11 library.  For example:
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list