blob: 9d11f123518fe6170e54359f20189055a2294d1f [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
Edwin Vane3b9f08d2013-03-08 23:26:00 +000043.. option:: -use-auto
44
45 Replace the type specifier of variable declarations with the ``auto`` type
46 specifier. See :doc:`UseAutoTransform`.
47
Edwin Vane30f70042013-02-25 20:37:03 +000048.. option:: -p=<build-path>
49
50 ``<build-path>`` is a CMake build directory containing a file named
51 ``compile_commands.json`` which provides compiler options for building
52 each source file and can be generated by specifying
53 ``-DCMAKE_EXPORT_COMPILE_COMMANDS`` when running CMake. If ``<build-path>``
54 is not provided the ``compile_commands.json`` file is searched for through
55 all parent directories.
56
57 Alternatively, one can provide compile options to be applied to every
58 source file after the optional ``--``.
59
60.. option:: -risk=<risk-level>
61
62 Some transformations may cause a change in semantics. In such cases the
63 maximum acceptable risk level specified through the ``-risk`` command
64 line option decides whether or not a transformation is applied.
65
66 Three different risk level options are available:
67
68 ``-risk=safe``
69 Perform only safe transformations.
70 ``-risk=reasonable`` (default)
71 Enable transformations that may change semantics.
72 ``-risk=risky``
73 Enable transformations that are likely to change semantics.
74
Edwin Vanee4e7c242013-03-09 03:33:50 +000075 The meaning of risk is handled differently for each transform. See
76 :ref:`transform documentation <transforms>` for details.
Edwin Vane30f70042013-02-25 20:37:03 +000077
Edwin Vanebdcd1352013-03-09 03:38:20 +000078.. option:: -final-syntax-check
79
80 After applying the final transform to a file, parse the file to ensure the
81 last transform did not introduce syntax errors. Syntax errors introduced by
82 earlier transforms are already caught when subsequent transforms parse the
83 file.
84
85.. option:: -fatal-assembler-warnings
86
87 Treat all compiler warnings as errors.
88
Edwin Vane30f70042013-02-25 20:37:03 +000089
90.. option:: -version
91
92 Displays the version information of this tool.
93
Edwin Vanee4e7c242013-03-09 03:33:50 +000094.. _transforms:
Edwin Vane30f70042013-02-25 20:37:03 +000095
96Transformations
97===============
98
Edwin Vanee4e7c242013-03-09 03:33:50 +000099* :doc:`LoopConvertTransform`
Edwin Vane30f70042013-02-25 20:37:03 +0000100
Edwin Vanee4e7c242013-03-09 03:33:50 +0000101* :doc:`UseNullptrTransform`
Edwin Vane30f70042013-02-25 20:37:03 +0000102
Edwin Vanee4e7c242013-03-09 03:33:50 +0000103* :doc:`UseAutoTransform`