diff options
| author | Piotr Padlewski <piotr.padlewski@gmail.com> | 2016-05-02 16:56:39 +0000 |
|---|---|---|
| committer | Piotr Padlewski <piotr.padlewski@gmail.com> | 2016-05-02 16:56:39 +0000 |
| commit | ce18ade406a58aac9cfdea74479a6412f30d920f (patch) | |
| tree | 8ebc5fe184c2fee2c287e9a356b3b9d2437d21b6 /clang-tools-extra/docs | |
| parent | 45c7b3ecb574c84a559b6d00983dd19ec5041bc3 (diff) | |
| download | bcm5719-llvm-ce18ade406a58aac9cfdea74479a6412f30d920f.tar.gz bcm5719-llvm-ce18ade406a58aac9cfdea74479a6412f30d920f.zip | |
[clang-tidy] Add modernize-make-shared check
Because modernize-make-shared do almost the same job as
modernize-make-unique, I refactored common code to MakeSmartPtrCheck.
http://reviews.llvm.org/D19183
llvm-svn: 268253
Diffstat (limited to 'clang-tools-extra/docs')
| -rw-r--r-- | clang-tools-extra/docs/ReleaseNotes.rst | 5 | ||||
| -rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 1 | ||||
| -rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/modernize-make-shared.rst | 16 |
3 files changed, 22 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 219b63f59fd..e4a88b21de9 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -180,6 +180,11 @@ identified. The improvements since the 3.8 release include: Replaces C standard library headers with their C++ alternatives. +- New `modernize-make-shared + <http://clang.llvm.org/extra/clang-tidy/checks/modernize-make-shared.html>`_ check + + Replaces creation of ``std::shared_ptr`` from new expression with call to ``std::make_shared``. + - New `modernize-raw-string-literal <http://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html>`_ check diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index cff26126050..d5c680c653c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -92,6 +92,7 @@ Clang-Tidy Checks misc-virtual-near-miss modernize-deprecated-headers modernize-loop-convert + modernize-make-shared modernize-make-unique modernize-pass-by-value modernize-raw-string-literal diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-make-shared.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-make-shared.rst new file mode 100644 index 00000000000..e7c690eb08f --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-make-shared.rst @@ -0,0 +1,16 @@ +.. title:: clang-tidy - modernize-make-shared + +modernize-make-shared +===================== + +This check finds the creation of ``std::shared_ptr`` objects by explicitly +calling the constructor and a ``new`` expression, and replaces it with a call +to ``std::make_shared``. + +.. code-block:: c++ + + auto my_ptr = std::shared_ptr<MyPair>(new MyPair(1, 2)); + + // becomes + + auto my_ptr = std::make_shared<MyPair>(1, 2); |

