diff options
author | Alexander Kornienko <alexfh@google.com> | 2016-08-18 18:43:47 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2016-08-18 18:43:47 +0000 |
commit | 0f85498a0b6cf1e4a4c8ce3d49b2f6f1a83c361e (patch) | |
tree | f1ad0a39967bd67a8accf3842f746a8244b62bad | |
parent | cc29958fb8c0889007f400f6213b16e8e66a3e95 (diff) | |
download | bcm5719-llvm-0f85498a0b6cf1e4a4c8ce3d49b2f6f1a83c361e.tar.gz bcm5719-llvm-0f85498a0b6cf1e4a4c8ce3d49b2f6f1a83c361e.zip |
[clang-tidy docs] Move option descriptions to the Options section
+ random fixes
llvm-svn: 279115
3 files changed, 37 insertions, 22 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-assert-side-effect.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-assert-side-effect.rst index 3270d20daab..3f8b4696793 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-assert-side-effect.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-assert-side-effect.rst @@ -9,7 +9,8 @@ The condition of ``assert()`` is evaluated only in debug builds so a condition with side effect can cause different behavior in debug / release builds. -There are two options: +Options +------- .. option:: AssertMacros diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-dangling-handle.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-dangling-handle.rst index 03c04e3b604..03d03ed994a 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-dangling-handle.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-dangling-handle.rst @@ -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. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-emplace.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-emplace.rst index 0f4d38d5a97..fb35f282440 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-emplace.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-emplace.rst @@ -13,12 +13,11 @@ because replacing ``insert`` with ``emplace`` may result in `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 be valid, but the code 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`` won't be replaced. 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 constructor call would be: 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. |