[clang-tidy] Fixed formatting of headings in the docs.
llvm-svn: 248151
This commit is contained in:
parent
5c2cb0eee2
commit
3e748fbd17
|
@ -11,10 +11,10 @@ Three kinds of loops can be converted:
|
||||||
- Loops over array-like containers, using ``operator[]`` and ``at()``.
|
- Loops over array-like containers, using ``operator[]`` and ``at()``.
|
||||||
|
|
||||||
MinConfidence option
|
MinConfidence option
|
||||||
====================
|
--------------------
|
||||||
|
|
||||||
risky
|
risky
|
||||||
-----
|
^^^^^
|
||||||
|
|
||||||
In loops where the container expression is more complex than just a
|
In loops where the container expression is more complex than just a
|
||||||
reference to a declared expression (a variable, function, enum, etc.),
|
reference to a declared expression (a variable, function, enum, etc.),
|
||||||
|
@ -40,7 +40,7 @@ for an example of an incorrect transformation when the minimum required confiden
|
||||||
level is set to `risky`.
|
level is set to `risky`.
|
||||||
|
|
||||||
reasonable (Default)
|
reasonable (Default)
|
||||||
--------------------
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If a loop calls ``.end()`` or ``.size()`` after each iteration, the
|
If a loop calls ``.end()`` or ``.size()`` after each iteration, the
|
||||||
transformation for that loop is marked as `reasonable`, and thus will
|
transformation for that loop is marked as `reasonable`, and thus will
|
||||||
|
@ -54,7 +54,7 @@ be converted if the required confidence level is set to ``reasonable``
|
||||||
cout << container[i];
|
cout << container[i];
|
||||||
|
|
||||||
safe
|
safe
|
||||||
----
|
^^^^
|
||||||
|
|
||||||
Any other loops that do not match the above criteria to be marked as
|
Any other loops that do not match the above criteria to be marked as
|
||||||
`risky` or `reasonable` are marked `safe`, and thus will be converted
|
`risky` or `reasonable` are marked `safe`, and thus will be converted
|
||||||
|
@ -68,7 +68,7 @@ if the required confidence level is set to ``safe`` or lower.
|
||||||
cout << arr[i];
|
cout << arr[i];
|
||||||
|
|
||||||
Example
|
Example
|
||||||
=======
|
-------
|
||||||
|
|
||||||
Original:
|
Original:
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ After transformation with confidence level set to ``reasonable`` (default):
|
||||||
cout << elem;
|
cout << elem;
|
||||||
|
|
||||||
Limitations
|
Limitations
|
||||||
===========
|
-----------
|
||||||
|
|
||||||
There are certain situations where the tool may erroneously perform
|
There are certain situations where the tool may erroneously perform
|
||||||
transformations that remove information and change semantics. Users of the tool
|
transformations that remove information and change semantics. Users of the tool
|
||||||
|
@ -125,7 +125,7 @@ should be aware of the behaviour and limitations of the transform outlined by
|
||||||
the cases below.
|
the cases below.
|
||||||
|
|
||||||
Comments inside loop headers
|
Comments inside loop headers
|
||||||
----------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Comments inside the original loop header are ignored and deleted when
|
Comments inside the original loop header are ignored and deleted when
|
||||||
transformed.
|
transformed.
|
||||||
|
@ -135,7 +135,7 @@ transformed.
|
||||||
for (int i = 0; i < N; /* This will be deleted */ ++i) { }
|
for (int i = 0; i < N; /* This will be deleted */ ++i) { }
|
||||||
|
|
||||||
Range-based loops evaluate end() only once
|
Range-based loops evaluate end() only once
|
||||||
------------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The C++11 range-based for loop calls ``.end()`` only once during the
|
The C++11 range-based for loop calls ``.end()`` only once during the
|
||||||
initialization of the loop. If in the original loop ``.end()`` is called after
|
initialization of the loop. If in the original loop ``.end()`` is called after
|
||||||
|
@ -201,7 +201,7 @@ transformed loop if ``.end()`` was originally called after each iteration.
|
||||||
}
|
}
|
||||||
|
|
||||||
Overloaded operator->() with side effects
|
Overloaded operator->() with side effects
|
||||||
-----------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Similarly, if ``operator->()`` was overloaded to have side effects, such as
|
Similarly, if ``operator->()`` was overloaded to have side effects, such as
|
||||||
logging, the semantics will change. If the iterator's ``operator->()`` was used
|
logging, the semantics will change. If the iterator's ``operator->()`` was used
|
||||||
|
@ -221,7 +221,7 @@ performed.
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointers and references to containers
|
Pointers and references to containers
|
||||||
-------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
While most of the transform's risk analysis is dedicated to determining whether
|
While most of the transform's risk analysis is dedicated to determining whether
|
||||||
the iterator or container was modified within the loop, it is possible to
|
the iterator or container was modified within the loop, it is possible to
|
||||||
|
|
|
@ -25,12 +25,12 @@ Migration example:
|
||||||
+ take_ownership_fn(std::move(b));
|
+ take_ownership_fn(std::move(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
Since `std::move()` is a library function declared in `<utility>` it may be
|
Since ``std::move()`` is a library function declared in ``<utility>`` it may be
|
||||||
necessary to add this include. The transform will add the include directive when
|
necessary to add this include. The transform will add the include directive when
|
||||||
necessary.
|
necessary.
|
||||||
|
|
||||||
Known Limitations
|
Known Limitations
|
||||||
=================
|
-----------------
|
||||||
* If headers modification is not activated or if a header is not allowed to be
|
* If headers modification is not activated or if a header is not allowed to be
|
||||||
changed this transform will produce broken code (compilation error), where the
|
changed this transform will produce broken code (compilation error), where the
|
||||||
the headers' code will stay unchanged while the code using them will be
|
the headers' code will stay unchanged while the code using them will be
|
||||||
|
|
|
@ -34,7 +34,7 @@ and maintainability. As a result, ``auto`` is used only introduced in specific
|
||||||
situations described below.
|
situations described below.
|
||||||
|
|
||||||
Iterators
|
Iterators
|
||||||
=========
|
---------
|
||||||
|
|
||||||
Iterator type specifiers tend to be long and used frequently, especially in
|
Iterator type specifiers tend to be long and used frequently, especially in
|
||||||
loop constructs. Since the functions generating iterators have a common format,
|
loop constructs. Since the functions generating iterators have a common format,
|
||||||
|
@ -127,7 +127,7 @@ following conditions are satisfied:
|
||||||
deduced as``std::initializer_list``.
|
deduced as``std::initializer_list``.
|
||||||
|
|
||||||
Known Limitations
|
Known Limitations
|
||||||
=================
|
-----------------
|
||||||
* If the initializer is an explicit conversion constructor, the transform will
|
* If the initializer is an explicit conversion constructor, the transform will
|
||||||
not replace the type specifier even though it would be safe to do so.
|
not replace the type specifier even though it would be safe to do so.
|
||||||
* User-defined iterators are not handled at this time.
|
* User-defined iterators are not handled at this time.
|
||||||
|
|
|
@ -5,7 +5,7 @@ The check converts the usage of null pointer constants (eg. ``NULL``, ``0``)
|
||||||
to use the new C++11 ``nullptr`` keyword.
|
to use the new C++11 ``nullptr`` keyword.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
=======
|
-------
|
||||||
|
|
||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ transforms to:
|
||||||
|
|
||||||
|
|
||||||
User defined macros
|
User defined macros
|
||||||
===================
|
-------------------
|
||||||
|
|
||||||
By default this transform will only replace the ``NULL`` macro and will skip any
|
By default this transform will only replace the ``NULL`` macro and will skip any
|
||||||
user-defined macros that behaves like ``NULL``. The user can use the
|
user-defined macros that behaves like ``NULL``. The user can use the
|
||||||
|
@ -44,7 +44,7 @@ user-defined macros that behaves like ``NULL``. The user can use the
|
||||||
names that will be transformed along with ``NULL``.
|
names that will be transformed along with ``NULL``.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
^^^^^^^
|
||||||
|
|
||||||
.. code-block:: c++
|
.. code-block:: c++
|
||||||
|
|
||||||
|
@ -62,4 +62,4 @@ transforms to:
|
||||||
int *p = nullptr;
|
int *p = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if the ``UserNullMacros`` option is set to ``MY_NULL``.
|
if the ``UserNullMacros`` option is set to ``MY_NULL``.
|
||||||
|
|
Loading…
Reference in New Issue