mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-03 07:38:57 +00:00
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:
parent
79b0adaae4
commit
415af0184c
@ -81,19 +81,19 @@ Original:
|
||||
v.push_back(2);
|
||||
v.push_back(3);
|
||||
|
||||
// safe transform
|
||||
// safe conversion
|
||||
for (int i = 0; i < N; ++i)
|
||||
cout << arr[i];
|
||||
|
||||
// reasonable transform
|
||||
// reasonable conversion
|
||||
for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
|
||||
cout << *it;*
|
||||
|
||||
// reasonable transform
|
||||
// reasonable conversion
|
||||
for (int i = 0; i < v.size(); ++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++
|
||||
|
||||
@ -104,15 +104,15 @@ After transformation with confidence level set to ``reasonable`` (default):
|
||||
v.push_back(2);
|
||||
v.push_back(3);
|
||||
|
||||
// safe transform
|
||||
// safe conversion
|
||||
for (auto & elem : arr)
|
||||
cout << elem;
|
||||
|
||||
// reasonable transform
|
||||
// reasonable conversion
|
||||
for (auto & elem : v)
|
||||
cout << elem;
|
||||
|
||||
// reasonable transform
|
||||
// reasonable conversion
|
||||
for (auto & elem : v)
|
||||
cout << elem;
|
||||
|
||||
@ -121,7 +121,7 @@ Limitations
|
||||
|
||||
There are certain situations where the tool may erroneously perform
|
||||
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.
|
||||
|
||||
Comments inside loop headers
|
||||
@ -223,7 +223,7 @@ performed.
|
||||
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
|
||||
circumvent the analysis by accessing and modifying the container through a
|
||||
pointer or reference.
|
||||
@ -231,7 +231,7 @@ 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``
|
||||
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
|
||||
below ends up being performed at the ``safe`` level.
|
||||
|
||||
|
@ -2,10 +2,10 @@ modernize-pass-by-value
|
||||
=======================
|
||||
|
||||
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
|
||||
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
|
||||
construct the copy.
|
||||
move constructors added for many types it is now interesting to take an
|
||||
argument directly by value, instead of by const-reference, and then copy. This
|
||||
check allows the compiler to take care of choosing the best way to construct
|
||||
the copy.
|
||||
|
||||
The transformation is usually beneficial when the calling code passes an
|
||||
*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()`.
|
||||
|
||||
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.
|
||||
|
||||
.. code-block:: c++
|
||||
|
@ -26,24 +26,23 @@ Migration example:
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
Known Limitations
|
||||
-----------------
|
||||
* 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
|
||||
the headers' code will stay unchanged while the code using them will be
|
||||
changed.
|
||||
changed this check will produce broken code (compilation error), where the
|
||||
headers' code will stay unchanged while the code using them will be changed.
|
||||
|
||||
* Client code that declares a reference to an ``std::auto_ptr`` coming from code
|
||||
that can't be migrated (such as a header coming from a 3\ :sup:`rd` party
|
||||
library) will produce a compilation error after migration. This is because the
|
||||
type of the reference will be changed to ``std::unique_ptr`` but the type
|
||||
returned by the library won't change, binding a reference to
|
||||
* Client code that declares a reference to an ``std::auto_ptr`` coming from
|
||||
code that can't be migrated (such as a header coming from a 3\ :sup:`rd`
|
||||
party library) will produce a compilation error after migration. This is
|
||||
because the type of the reference will be changed to ``std::unique_ptr`` but
|
||||
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
|
||||
sense and usually ``std::auto_ptr`` are stored by value (otherwise what is the
|
||||
point in using them instead of a reference or a pointer?).
|
||||
sense and usually ``std::auto_ptr`` are stored by value (otherwise what is
|
||||
the point in using them instead of a reference or a pointer?).
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
modernize-use-auto
|
||||
==================
|
||||
|
||||
This check is responsible for using the ``auto`` type specifier for
|
||||
variable declarations to *improve code readability and maintainability*.
|
||||
For example:
|
||||
This check is responsible for using the ``auto`` type specifier for variable
|
||||
declarations to *improve code readability and maintainability*. For example:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
@ -38,7 +37,7 @@ Iterators
|
||||
|
||||
Iterator type specifiers tend to be long and used frequently, especially in
|
||||
loop constructs. Since the functions generating iterators have a common format,
|
||||
the type specifier can be replaced without obscuring the meaning of code while
|
||||
the type specifier can be replaced without obscuring the meaning of code while
|
||||
improving readability and maintainability.
|
||||
|
||||
.. code-block:: c++
|
||||
@ -53,50 +52,33 @@ improving readability and maintainability.
|
||||
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
|
||||
following conditions are satisfied:
|
||||
The check will only replace iterator type-specifiers when all of the following
|
||||
conditions are satisfied:
|
||||
|
||||
* The iterator is for one of the standard container in ``std`` namespace:
|
||||
|
||||
* ``array``
|
||||
|
||||
* ``deque``
|
||||
|
||||
* ``forward_list``
|
||||
|
||||
* ``list``
|
||||
|
||||
* ``vector``
|
||||
|
||||
* ``map``
|
||||
|
||||
* ``multimap``
|
||||
|
||||
* ``set``
|
||||
|
||||
* ``multiset``
|
||||
|
||||
* ``unordered_map``
|
||||
|
||||
* ``unordered_multimap``
|
||||
|
||||
* ``unordered_set``
|
||||
|
||||
* ``unordered_multiset``
|
||||
|
||||
* ``queue``
|
||||
|
||||
* ``priority_queue``
|
||||
|
||||
* ``stack``
|
||||
|
||||
* The iterator is one of the possible iterator types for standard containers:
|
||||
|
||||
* ``iterator``
|
||||
|
||||
* ``reverse_iterator``
|
||||
|
||||
* ``const_iterator``
|
||||
|
||||
* ``const_reverse_iterator``
|
||||
|
||||
* In addition to using iterator types directly, typedefs or other ways of
|
||||
@ -128,7 +110,8 @@ following conditions are satisfied:
|
||||
|
||||
Known Limitations
|
||||
-----------------
|
||||
* 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.
|
||||
* If the initializer is an explicit conversion constructor, the check will not
|
||||
replace the type specifier even though it would be safe to do so.
|
||||
|
||||
* User-defined iterators are not handled at this time.
|
||||
|
||||
|
@ -38,7 +38,7 @@ transforms to:
|
||||
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
|
||||
:option:``UserNullMacros`` option to specify a comma-separated list of macro
|
||||
names that will be transformed along with ``NULL``.
|
||||
|
Loading…
x
Reference in New Issue
Block a user