diff options
author | Alexander Kornienko <alexfh@google.com> | 2015-09-08 09:44:04 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2015-09-08 09:44:04 +0000 |
commit | d96d89f6e5f0948c7ee8daf60ae19c356c43dfdf (patch) | |
tree | 8af597ead821d26423f6fcb572f87e0eaafdc21c /clang-tools-extra/docs/clang-tidy | |
parent | ff7a9252e8e6be6cabbd182b622750c75aea96c2 (diff) | |
download | bcm5719-llvm-d96d89f6e5f0948c7ee8daf60ae19c356c43dfdf.tar.gz bcm5719-llvm-d96d89f6e5f0948c7ee8daf60ae19c356c43dfdf.zip |
[clang-tidy] Updated docs.
llvm-svn: 246996
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
3 files changed, 36 insertions, 1 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index 05aebe8d298..abd5b8ef395 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -40,7 +40,9 @@ List of clang-tidy Checks misc-unused-raii modernize-loop-convert modernize-pass-by-value + modernize-replace-auto-ptr modernize-shrink-to-fit + modernize-use-auto modernize-use-nullptr modernize-use-override readability-braces-around-statements @@ -51,4 +53,4 @@ List of clang-tidy Checks readability-named-parameter readability-redundant-smartptr-get readability-redundant-string-cstr - readability-simplify-boolean-expr + readability-simplify-boolean-expr
\ No newline at end of file diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst new file mode 100644 index 00000000000..09290f19e78 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst @@ -0,0 +1,29 @@ +modernize-replace-auto-ptr +========================== + + +Transforms the deprecated ``std::auto_ptr`` into the C++11 ``std::unique_ptr``. + +Note that both the ``std::auto_ptr`` type and the transfer of ownership are +transformed. ``std::auto_ptr`` provides two ways to transfer the ownership, +the copy-constructor and the assignment operator. Unlike most classes these +operations do not 'copy' the resource but they 'steal' it. +``std::unique_ptr`` uses move semantics instead, which makes the intent of +transferring the resource explicit. This difference between the two smart +pointers requeres to wrap the copy-ctor and assign-operator with +``std::move()``. + +For example, given: + +.. code:: c++ + + std::auto_ptr<int> i, j; + i = j; + +This code is transformed to: + +.. code:: c++ + + std::unique_ptr<in> i, j; + i = std::move(j); + diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-auto.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-auto.rst new file mode 100644 index 00000000000..db2b20a7aca --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-auto.rst @@ -0,0 +1,4 @@ +modernize-use-auto +================== + + |