blob: 6e787f28e359b351c6e20adb8f89ef715775b2e1 [file] [log] [blame]
Edwin Vanee4e7c242013-03-09 03:33:50 +00001.. index:: cpp11-migrate
2
Edwin Vane30f70042013-02-25 20:37:03 +00003===========================
4cpp11-migrate User's Manual
5===========================
6
Edwin Vane3b9f08d2013-03-08 23:26:00 +00007.. toctree::
8 :hidden:
9
10 UseAutoTransform
Edwin Vanee4e7c242013-03-09 03:33:50 +000011 UseNullptrTransform
12 LoopConvertTransform
Edwin Vane3b9f08d2013-03-08 23:26:00 +000013
Edwin Vane30f70042013-02-25 20:37:03 +000014:program:`cpp11-migrate` is a standalone tool used to automatically convert
15C++98 and C++03 code to use features of the new C++11 standard where
16appropriate.
17
18Basic Usage
19===========
20
21``cpp11-migrate [options] <source0> [... <sourceN>]``
22
23``<source0>...`` specify the paths of files in the CMake source tree,
24with the same requirements as other tools built on LibTooling.
25
26Command Line Options
27--------------------
28
Edwin Vane30f70042013-02-25 20:37:03 +000029.. option:: -help
30
31 Displays tool usage instructions and command line options.
32
33.. option:: -loop-convert
34
Edwin Vanee4e7c242013-03-09 03:33:50 +000035 Makes use of C++11 range-based for loops where possible. See
36 :doc:`LoopConvertTransform`.
37
38.. option:: -use-nullptr
39
40 Makes use of the new C++11 keyword ``nullptr`` where possible.
41 See :doc:`UseNullptrTransform`.
Edwin Vane30f70042013-02-25 20:37:03 +000042
Tareq A. Sirajc2aa348d2013-03-28 16:06:59 +000043.. option:: -user-null-macros=<string>
44
45 ``<string>`` is a comma-separated list of user-defined macros that behave like
46 the ``NULL`` macro. The :option:`-use-nullptr` transform will replace these
47 macros along with ``NULL``. See :doc:`UseNullptrTransform`.
48
Edwin Vane3b9f08d2013-03-08 23:26:00 +000049.. option:: -use-auto
50
51 Replace the type specifier of variable declarations with the ``auto`` type
52 specifier. See :doc:`UseAutoTransform`.
53
Edwin Vane30f70042013-02-25 20:37:03 +000054.. option:: -p=<build-path>
55
56 ``<build-path>`` is a CMake build directory containing a file named
57 ``compile_commands.json`` which provides compiler options for building
58 each source file and can be generated by specifying
59 ``-DCMAKE_EXPORT_COMPILE_COMMANDS`` when running CMake. If ``<build-path>``
60 is not provided the ``compile_commands.json`` file is searched for through
61 all parent directories.
62
63 Alternatively, one can provide compile options to be applied to every
64 source file after the optional ``--``.
65
66.. option:: -risk=<risk-level>
67
68 Some transformations may cause a change in semantics. In such cases the
69 maximum acceptable risk level specified through the ``-risk`` command
70 line option decides whether or not a transformation is applied.
71
72 Three different risk level options are available:
73
74 ``-risk=safe``
75 Perform only safe transformations.
76 ``-risk=reasonable`` (default)
77 Enable transformations that may change semantics.
78 ``-risk=risky``
79 Enable transformations that are likely to change semantics.
80
Edwin Vanee4e7c242013-03-09 03:33:50 +000081 The meaning of risk is handled differently for each transform. See
82 :ref:`transform documentation <transforms>` for details.
Edwin Vane30f70042013-02-25 20:37:03 +000083
Edwin Vanebdcd1352013-03-09 03:38:20 +000084.. option:: -final-syntax-check
Tareq A. Sirajc2aa348d2013-03-28 16:06:59 +000085
Edwin Vanebdcd1352013-03-09 03:38:20 +000086 After applying the final transform to a file, parse the file to ensure the
87 last transform did not introduce syntax errors. Syntax errors introduced by
88 earlier transforms are already caught when subsequent transforms parse the
89 file.
90
91.. option:: -fatal-assembler-warnings
92
93 Treat all compiler warnings as errors.
94
Edwin Vane30f70042013-02-25 20:37:03 +000095
96.. option:: -version
97
98 Displays the version information of this tool.
99
Edwin Vanee4e7c242013-03-09 03:33:50 +0000100.. _transforms:
Edwin Vane30f70042013-02-25 20:37:03 +0000101
102Transformations
103===============
104
Edwin Vanee4e7c242013-03-09 03:33:50 +0000105* :doc:`LoopConvertTransform`
Edwin Vane30f70042013-02-25 20:37:03 +0000106
Edwin Vanee4e7c242013-03-09 03:33:50 +0000107* :doc:`UseNullptrTransform`
Edwin Vane30f70042013-02-25 20:37:03 +0000108
Edwin Vanee4e7c242013-03-09 03:33:50 +0000109* :doc:`UseAutoTransform`