[clang-tools-extra] r246996 - [clang-tidy] Updated docs.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 02:44:05 PDT 2015


Author: alexfh
Date: Tue Sep  8 04:44:04 2015
New Revision: 246996

URL: http://llvm.org/viewvc/llvm-project?rev=246996&view=rev
Log:
[clang-tidy] Updated docs.

Added:
    clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
    clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
Modified:
    clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h
    clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h?rev=246996&r1=246995&r2=246996&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceAutoPtrCheck.h Tue Sep  8 04:44:04 2015
@@ -17,24 +17,26 @@ namespace clang {
 namespace tidy {
 namespace modernize {
 
-/// \brief Transforms the deprecated \c std::auto_ptr into the C++11 \c
-/// std::unique_ptr.
+/// Transforms the deprecated `std::auto_ptr` into the C++11 `std::unique_ptr`.
 ///
-/// Note that both the \c std::auto_ptr type and the transfer of ownership are
-/// transformed. \c std::auto_ptr provides two ways to transfer the ownership,
+/// 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.
-/// \c std::unique_ptr uses move semantics instead, which makes the intent of
+/// `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
-/// \c std::move().
+/// `std::move()`.
 ///
 /// For example, given:
+///
 /// \code
 ///   std::auto_ptr<int> i, j;
 ///   i = j;
 /// \endcode
+///
 /// This code is transformed to:
+///
 /// \code
 ///   std::unique_ptr<in> i, j;
 ///   i = std::move(j);

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=246996&r1=246995&r2=246996&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Tue Sep  8 04:44:04 2015
@@ -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

Added: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst?rev=246996&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-replace-auto-ptr.rst Tue Sep  8 04:44:04 2015
@@ -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);
+

Added: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst?rev=246996&view=auto
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst (added)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst Tue Sep  8 04:44:04 2015
@@ -0,0 +1,4 @@
+modernize-use-auto
+==================
+
+




More information about the cfe-commits mailing list