Replace references to "transform" with references to "check" where neccessary in the documentation.

Summary: Replace references to "transform" with references to "check" where neccessary in the documentation.

Reviewers: alexfh

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D13006

llvm-svn: 248153
This commit is contained in:
Angel Garcia Gomez 2015-09-21 12:53:30 +00:00
parent 79b0adaae4
commit 415af0184c
5 changed files with 35 additions and 53 deletions

View File

@ -81,19 +81,19 @@ Original:
v.push_back(2); v.push_back(2);
v.push_back(3); v.push_back(3);
// safe transform // safe conversion
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
cout << arr[i]; cout << arr[i];
// reasonable transform // reasonable conversion
for (vector<int>::iterator it = v.begin(); it != v.end(); ++it) for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
cout << *it;* cout << *it;*
// reasonable transform // reasonable conversion
for (int i = 0; i < v.size(); ++i) for (int i = 0; i < v.size(); ++i)
cout << v[i]; cout << v[i];
After transformation with confidence level set to ``reasonable`` (default): After applying the check with minimum confidence level set to ``reasonable`` (default):
.. code-block:: c++ .. code-block:: c++
@ -104,15 +104,15 @@ After transformation with confidence level set to ``reasonable`` (default):
v.push_back(2); v.push_back(2);
v.push_back(3); v.push_back(3);
// safe transform // safe conversion
for (auto & elem : arr) for (auto & elem : arr)
cout << elem; cout << elem;
// reasonable transform // reasonable conversion
for (auto & elem : v) for (auto & elem : v)
cout << elem; cout << elem;
// reasonable transform // reasonable conversion
for (auto & elem : v) for (auto & elem : v)
cout << elem; cout << elem;
@ -121,7 +121,7 @@ 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
should be aware of the behaviour and limitations of the transform outlined by should be aware of the behaviour and limitations of the check outlined by
the cases below. the cases below.
Comments inside loop headers Comments inside loop headers
@ -223,7 +223,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 check'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
circumvent the analysis by accessing and modifying the container through a circumvent the analysis by accessing and modifying the container through a
pointer or reference. pointer or reference.
@ -231,7 +231,7 @@ pointer or reference.
If the container were directly used instead of using the pointer or reference If the container were directly used instead of using the pointer or reference
the following transformation would have only been applied at the ``risky`` the following transformation would have only been applied at the ``risky``
level since calling a member function of the container is considered `risky`. level since calling a member function of the container is considered `risky`.
The transform cannot identify expressions associated with the container that are The check cannot identify expressions associated with the container that are
different than the one used in the loop header, therefore the transformation different than the one used in the loop header, therefore the transformation
below ends up being performed at the ``safe`` level. below ends up being performed at the ``safe`` level.

View File

@ -2,10 +2,10 @@ modernize-pass-by-value
======================= =======================
With move semantics added to the language and the standard library updated with With move semantics added to the language and the standard library updated with
move constructors added for many types it is now interesting to take an argument move constructors added for many types it is now interesting to take an
directly by value, instead of by const-reference, and then copy. This argument directly by value, instead of by const-reference, and then copy. This
transformation allows the compiler to take care of choosing the best way to check allows the compiler to take care of choosing the best way to construct
construct the copy. the copy.
The transformation is usually beneficial when the calling code passes an The transformation is usually beneficial when the calling code passes an
*rvalue* and assumes the move construction is a cheap operation. This short *rvalue* and assumes the move construction is a cheap operation. This short
@ -34,7 +34,7 @@ Replaces the uses of const-references constructor parameters that are copied
into class fields. The parameter is then moved with `std::move()`. into class fields. The parameter is then moved with `std::move()`.
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 check will add the include directive when
necessary. necessary.
.. code-block:: c++ .. code-block:: c++

View File

@ -26,24 +26,23 @@ Migration example:
} }
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 check 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 check will produce broken code (compilation error), where the
the headers' code will stay unchanged while the code using them will be headers' code will stay unchanged while the code using them will be changed.
changed.
* Client code that declares a reference to an ``std::auto_ptr`` coming from code * Client code that declares a reference to an ``std::auto_ptr`` coming from
that can't be migrated (such as a header coming from a 3\ :sup:`rd` party code that can't be migrated (such as a header coming from a 3\ :sup:`rd`
library) will produce a compilation error after migration. This is because the party library) will produce a compilation error after migration. This is
type of the reference will be changed to ``std::unique_ptr`` but the type because the type of the reference will be changed to ``std::unique_ptr`` but
returned by the library won't change, binding a reference to the type returned by the library won't change, binding a reference to
``std::unique_ptr`` from an ``std::auto_ptr``. This pattern doesn't make much ``std::unique_ptr`` from an ``std::auto_ptr``. This pattern doesn't make much
sense and usually ``std::auto_ptr`` are stored by value (otherwise what is the sense and usually ``std::auto_ptr`` are stored by value (otherwise what is
point in using them instead of a reference or a pointer?). the point in using them instead of a reference or a pointer?).
.. code-block:: c++ .. code-block:: c++

View File

@ -1,9 +1,8 @@
modernize-use-auto modernize-use-auto
================== ==================
This check is responsible for using the ``auto`` type specifier for This check is responsible for using the ``auto`` type specifier for variable
variable declarations to *improve code readability and maintainability*. declarations to *improve code readability and maintainability*. For example:
For example:
.. code-block:: c++ .. code-block:: c++
@ -53,50 +52,33 @@ improving readability and maintainability.
for (auto I = my_container.begin(), E = my_container.end(); I != E; ++I) { for (auto I = my_container.begin(), E = my_container.end(); I != E; ++I) {
} }
The transform will only replace iterator type-specifiers when all of the The check will only replace iterator type-specifiers when all of the following
following conditions are satisfied: conditions are satisfied:
* The iterator is for one of the standard container in ``std`` namespace: * The iterator is for one of the standard container in ``std`` namespace:
* ``array`` * ``array``
* ``deque`` * ``deque``
* ``forward_list`` * ``forward_list``
* ``list`` * ``list``
* ``vector`` * ``vector``
* ``map`` * ``map``
* ``multimap`` * ``multimap``
* ``set`` * ``set``
* ``multiset`` * ``multiset``
* ``unordered_map`` * ``unordered_map``
* ``unordered_multimap`` * ``unordered_multimap``
* ``unordered_set`` * ``unordered_set``
* ``unordered_multiset`` * ``unordered_multiset``
* ``queue`` * ``queue``
* ``priority_queue`` * ``priority_queue``
* ``stack`` * ``stack``
* The iterator is one of the possible iterator types for standard containers: * The iterator is one of the possible iterator types for standard containers:
* ``iterator`` * ``iterator``
* ``reverse_iterator`` * ``reverse_iterator``
* ``const_iterator`` * ``const_iterator``
* ``const_reverse_iterator`` * ``const_reverse_iterator``
* In addition to using iterator types directly, typedefs or other ways of * In addition to using iterator types directly, typedefs or other ways of
@ -128,7 +110,8 @@ following conditions are satisfied:
Known Limitations Known Limitations
----------------- -----------------
* If the initializer is an explicit conversion constructor, the transform will * If the initializer is an explicit conversion constructor, the check will not
not replace the type specifier even though it would be safe to do so. 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.

View File

@ -38,7 +38,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 check 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
:option:``UserNullMacros`` option to specify a comma-separated list of macro :option:``UserNullMacros`` option to specify a comma-separated list of macro
names that will be transformed along with ``NULL``. names that will be transformed along with ``NULL``.