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/clang-tidy | |
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/clang-tidy')
-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 |
2 files changed, 17 insertions, 0 deletions
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); |