[clang-tools-extra] r279115 - [clang-tidy docs] Move option descriptions to the Options section
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 18 11:43:47 PDT 2016
Author: alexfh
Date: Thu Aug 18 13:43:47 2016
New Revision: 279115
URL: http://llvm.org/viewvc/llvm-project?rev=279115&view=rev
Log:
[clang-tidy docs] Move option descriptions to the Options section
+ random fixes
Modified:
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-dangling-handle.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst?rev=279115&r1=279114&r2=279115&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst Thu Aug 18 13:43:47 2016
@@ -9,7 +9,8 @@ The condition of ``assert()`` is evaluat
condition with side effect can cause different behavior in debug / release
builds.
-There are two options:
+Options
+-------
.. option:: AssertMacros
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-dangling-handle.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-dangling-handle.rst?rev=279115&r1=279114&r2=279115&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-dangling-handle.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-dangling-handle.rst Thu Aug 18 13:43:47 2016
@@ -3,15 +3,11 @@
misc-dangling-handle
====================
-Detect dangling references in value handlers like
+Detect dangling references in value handles like
``std::experimental::string_view``.
-These dangling references can come from constructing handles from temporary
+These dangling references can be a result of constructing handles from temporary
values, where the temporary is destroyed soon after the handle is created.
-By default only ``std::experimental::basic_string_view`` is considered.
-This list can be modified by passing a `;` separated list of class names using
-the HandleClasses option.
-
Examples:
.. code-block:: c++
@@ -32,3 +28,11 @@ Examples:
char Array[10]{};
return Array;
}
+
+Options
+-------
+
+.. option:: HandleClasses
+
+ A semicolon-separated list of class names that should be treated as handles.
+ By default only ``std::experimental::basic_string_view`` is considered.
Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst?rev=279115&r1=279114&r2=279115&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-emplace.rst Thu Aug 18 13:43:47 2016
@@ -13,12 +13,11 @@ because replacing ``insert`` with ``empl
`speed regression <http://htmlpreview.github.io/?https://github.com/HowardHinnant/papers/blob/master/insert_vs_emplace.html>`_, but it might get support with some addition flag in the future.
By default only ``std::vector``, ``std::deque``, ``std::list`` are considered.
-This list can be modified by passing a semicolon-separated list of class names
-using the `ContainersWithPushBack` option.
+This list can be modified using the :option:`ContainersWithPushBack` option.
Before:
-.. code:: c++
+.. code-block:: c++
std::vector<MyClass> v;
v.push_back(MyClass(21, 37));
@@ -30,7 +29,7 @@ Before:
After:
-.. code:: c++
+.. code-block:: c++
std::vector<MyClass> v;
v.emplace_back(21, 37);
@@ -45,14 +44,14 @@ inside a container.
Before:
-.. code:: c++
+.. code-block:: c++
std::vector<boost::optional<std::string> > v;
v.push_back("abc");
After:
-.. code:: c++
+.. code-block:: c++
std::vector<boost::optional<std::string> > v;
v.emplace_back("abc");
@@ -62,7 +61,7 @@ In some cases the transformation would b
wouldn't be exception safe.
In this case the calls of ``push_back`` won't be replaced.
-.. code:: c++
+.. code-block:: c++
std::vector<std::unique_ptr<int>> v;
v.push_back(std::unique_ptr<int>(new int(0)));
@@ -70,16 +69,15 @@ In this case the calls of ``push_back``
v.push_back(std::unique_ptr<int>(ptr));
This is because replacing it with ``emplace_back`` could cause a leak of this
-pointer if ``emplace_back`` would throw exception before emplacement
-(e.g. not enough memory to add new element).
+pointer if ``emplace_back`` would throw exception before emplacement (e.g. not
+enough memory to add new element).
-For more info read item 42 - "Consider emplacement instead of insertion."
-of Scott Meyers Effective Modern C++.
+For more info read item 42 - "Consider emplacement instead of insertion." of
+Scott Meyers Effective Modern C++.
-The default smart pointers that are considered are
-``std::unique_ptr``, ``std::shared_ptr``, ``std::auto_ptr``.
-To specify other smart pointers or other classes use option
-`SmartPointers` similar to `ContainersWithPushBack`.
+The default smart pointers that are considered are ``std::unique_ptr``,
+``std::shared_ptr``, ``std::auto_ptr``. To specify other smart pointers or
+other classes use the :option:`SmartPointers` option.
Check also fires if any argument of constructor call would be:
@@ -88,3 +86,15 @@ Check also fires if any argument of cons
or if the argument would be converted via derived-to-base cast.
This check requires C++11 of higher to run.
+
+Options
+-------
+
+.. option:: ContainersWithPushBack
+
+ Semicolon-separated list of class names of custom containers that support
+ ``push_back``.
+
+.. option:: SmartPointers
+
+ Semicolon-separated list of class names of custom smart pointers.
More information about the cfe-commits
mailing list