2013-03-09 11:33:50 +08:00
|
|
|
.. index:: cpp11-migrate
|
|
|
|
|
2013-02-26 04:37:03 +08:00
|
|
|
===========================
|
|
|
|
cpp11-migrate User's Manual
|
|
|
|
===========================
|
|
|
|
|
2013-03-09 07:26:00 +08:00
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
|
|
|
|
UseAutoTransform
|
2013-03-09 11:33:50 +08:00
|
|
|
UseNullptrTransform
|
|
|
|
LoopConvertTransform
|
2013-04-10 04:49:49 +08:00
|
|
|
AddOverrideTransform
|
2013-03-09 07:26:00 +08:00
|
|
|
|
2013-02-26 04:37:03 +08:00
|
|
|
:program:`cpp11-migrate` is a standalone tool used to automatically convert
|
|
|
|
C++98 and C++03 code to use features of the new C++11 standard where
|
|
|
|
appropriate.
|
|
|
|
|
|
|
|
Basic Usage
|
|
|
|
===========
|
|
|
|
|
|
|
|
``cpp11-migrate [options] <source0> [... <sourceN>]``
|
|
|
|
|
|
|
|
``<source0>...`` specify the paths of files in the CMake source tree,
|
|
|
|
with the same requirements as other tools built on LibTooling.
|
|
|
|
|
|
|
|
Command Line Options
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
.. option:: -help
|
|
|
|
|
|
|
|
Displays tool usage instructions and command line options.
|
|
|
|
|
|
|
|
.. option:: -loop-convert
|
|
|
|
|
2013-03-09 11:33:50 +08:00
|
|
|
Makes use of C++11 range-based for loops where possible. See
|
|
|
|
:doc:`LoopConvertTransform`.
|
|
|
|
|
|
|
|
.. option:: -use-nullptr
|
|
|
|
|
|
|
|
Makes use of the new C++11 keyword ``nullptr`` where possible.
|
|
|
|
See :doc:`UseNullptrTransform`.
|
2013-02-26 04:37:03 +08:00
|
|
|
|
2013-03-29 00:06:59 +08:00
|
|
|
.. option:: -user-null-macros=<string>
|
|
|
|
|
|
|
|
``<string>`` is a comma-separated list of user-defined macros that behave like
|
|
|
|
the ``NULL`` macro. The :option:`-use-nullptr` transform will replace these
|
|
|
|
macros along with ``NULL``. See :doc:`UseNullptrTransform`.
|
|
|
|
|
2013-03-09 07:26:00 +08:00
|
|
|
.. option:: -use-auto
|
|
|
|
|
|
|
|
Replace the type specifier of variable declarations with the ``auto`` type
|
|
|
|
specifier. See :doc:`UseAutoTransform`.
|
|
|
|
|
2013-04-10 04:49:49 +08:00
|
|
|
.. option:: -add-override
|
|
|
|
|
|
|
|
Adds the override specifier to member functions where it is appropriate. That
|
|
|
|
is, the override specifier is added to member functions that override a
|
|
|
|
virtual function in a base class and that don't already have the specifier.
|
|
|
|
See :doc:`AddOverrideTransform`.
|
|
|
|
|
2013-02-26 04:37:03 +08:00
|
|
|
.. option:: -p=<build-path>
|
|
|
|
|
|
|
|
``<build-path>`` is a CMake build directory containing a file named
|
|
|
|
``compile_commands.json`` which provides compiler options for building
|
|
|
|
each source file and can be generated by specifying
|
|
|
|
``-DCMAKE_EXPORT_COMPILE_COMMANDS`` when running CMake. If ``<build-path>``
|
|
|
|
is not provided the ``compile_commands.json`` file is searched for through
|
|
|
|
all parent directories.
|
|
|
|
|
|
|
|
Alternatively, one can provide compile options to be applied to every
|
|
|
|
source file after the optional ``--``.
|
|
|
|
|
|
|
|
.. option:: -risk=<risk-level>
|
|
|
|
|
|
|
|
Some transformations may cause a change in semantics. In such cases the
|
|
|
|
maximum acceptable risk level specified through the ``-risk`` command
|
|
|
|
line option decides whether or not a transformation is applied.
|
|
|
|
|
|
|
|
Three different risk level options are available:
|
|
|
|
|
|
|
|
``-risk=safe``
|
|
|
|
Perform only safe transformations.
|
|
|
|
``-risk=reasonable`` (default)
|
|
|
|
Enable transformations that may change semantics.
|
|
|
|
``-risk=risky``
|
|
|
|
Enable transformations that are likely to change semantics.
|
|
|
|
|
2013-03-09 11:33:50 +08:00
|
|
|
The meaning of risk is handled differently for each transform. See
|
|
|
|
:ref:`transform documentation <transforms>` for details.
|
2013-02-26 04:37:03 +08:00
|
|
|
|
2013-03-09 11:38:20 +08:00
|
|
|
.. option:: -final-syntax-check
|
2013-03-29 00:06:59 +08:00
|
|
|
|
2013-03-09 11:38:20 +08:00
|
|
|
After applying the final transform to a file, parse the file to ensure the
|
|
|
|
last transform did not introduce syntax errors. Syntax errors introduced by
|
|
|
|
earlier transforms are already caught when subsequent transforms parse the
|
|
|
|
file.
|
|
|
|
|
|
|
|
.. option:: -fatal-assembler-warnings
|
|
|
|
|
|
|
|
Treat all compiler warnings as errors.
|
|
|
|
|
2013-02-26 04:37:03 +08:00
|
|
|
|
|
|
|
.. option:: -version
|
|
|
|
|
|
|
|
Displays the version information of this tool.
|
|
|
|
|
2013-03-09 11:33:50 +08:00
|
|
|
.. _transforms:
|
2013-02-26 04:37:03 +08:00
|
|
|
|
|
|
|
Transformations
|
|
|
|
===============
|
|
|
|
|
2013-03-09 11:33:50 +08:00
|
|
|
* :doc:`LoopConvertTransform`
|
2013-02-26 04:37:03 +08:00
|
|
|
|
2013-03-09 11:33:50 +08:00
|
|
|
* :doc:`UseNullptrTransform`
|
2013-02-26 04:37:03 +08:00
|
|
|
|
2013-03-09 11:33:50 +08:00
|
|
|
* :doc:`UseAutoTransform`
|