Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Improve modernize-use-auto documentation (https://llvm.org/bugs/show_bug.cgi?id=24962). Add documentation for modernize-make-unique. Reviewers: klimek Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D13346 llvm-svn: 249017
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
clang-tools-extra/docs/clang-tidy/checks/modernize-make-unique.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
modernize-make-unique | ||
===================== | ||
|
||
This check finds the creation of ``std::unique_ptr`` objects by explicitly | ||
calling the constructor and a ``new`` expression, and replaces it with a call | ||
to ``std::make_unique``, introduced in C++14. | ||
|
||
.. code-block:: c++ | ||
|
||
auto my_ptr = std::unique_ptr<MyPair>(new MyPair(1, 2)); | ||
|
||
// becomes | ||
|
||
auto my_ptr = std::make_unique<MyPair>(1, 2); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters