mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 07:31:28 +00:00
Documentation: improve description of make_shared transformation, as suggested by David Blaikie
llvm-svn: 180627
This commit is contained in:
parent
be0e89d9e8
commit
148fdf2ed1
@ -124,14 +124,16 @@ Ideas for new Tools
|
|||||||
``foo.begin()`` into ``begin(foo)`` and similarly for ``end()``, where
|
``foo.begin()`` into ``begin(foo)`` and similarly for ``end()``, where
|
||||||
``foo`` is a standard container. We could also detect similar patterns for
|
``foo`` is a standard container. We could also detect similar patterns for
|
||||||
arrays.
|
arrays.
|
||||||
* ``make_shared`` / ``make_unique`` conversion. This transformation can be
|
* ``make_shared`` / ``make_unique`` conversion. Part of this transformation
|
||||||
incorporated into the ``auto`` transformation. Will convert
|
can be incorporated into the ``auto`` transformation. Will convert
|
||||||
|
|
||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
|
|
||||||
std::shared_ptr<Foo> sp(new Foo);
|
std::shared_ptr<Foo> sp(new Foo);
|
||||||
std::unique_ptr<Foo> up(new Foo);
|
std::unique_ptr<Foo> up(new Foo);
|
||||||
|
|
||||||
|
func(std::shared_ptr<Foo>(new Foo), bar());
|
||||||
|
|
||||||
into:
|
into:
|
||||||
|
|
||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
@ -139,6 +141,10 @@ Ideas for new Tools
|
|||||||
auto sp = std::make_shared<Foo>();
|
auto sp = std::make_shared<Foo>();
|
||||||
auto up = std::make_unique<Foo>(); // In C++14 mode.
|
auto up = std::make_unique<Foo>(); // In C++14 mode.
|
||||||
|
|
||||||
|
// This also affects correctness. For the cases where bar() throws,
|
||||||
|
// make_shared() is safe and the original code may leak.
|
||||||
|
func(std::make_shared<Foo>(), bar());
|
||||||
|
|
||||||
* ``tr1`` removal tool. Will migrate source code from using TR1 library
|
* ``tr1`` removal tool. Will migrate source code from using TR1 library
|
||||||
features to C++11 library. For example:
|
features to C++11 library. For example:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user