blob: 70e833683dcdbcfbaa01a05d54bdcc280b8b266f [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 Vane8ef7fa12013-04-09 20:49:49 +000013 AddOverrideTransform
Edwin Vane3b9f08d2013-03-08 23:26:00 +000014
Edwin Vane30f70042013-02-25 20:37:03 +000015:program:`cpp11-migrate` is a standalone tool used to automatically convert
16C++98 and C++03 code to use features of the new C++11 standard where
17appropriate.
18
19Basic Usage
20===========
21
22``cpp11-migrate [options] <source0> [... <sourceN>]``
23
24``<source0>...`` specify the paths of files in the CMake source tree,
25with the same requirements as other tools built on LibTooling.
26
27Command Line Options
28--------------------
29
Edwin Vane30f70042013-02-25 20:37:03 +000030.. option:: -help
31
32 Displays tool usage instructions and command line options.
33
34.. option:: -loop-convert
35
Edwin Vanee4e7c242013-03-09 03:33:50 +000036 Makes use of C++11 range-based for loops where possible. See
37 :doc:`LoopConvertTransform`.
38
39.. option:: -use-nullptr
40
41 Makes use of the new C++11 keyword ``nullptr`` where possible.
42 See :doc:`UseNullptrTransform`.
Edwin Vane30f70042013-02-25 20:37:03 +000043
Tareq A. Sirajc2aa348d2013-03-28 16:06:59 +000044.. option:: -user-null-macros=<string>
45
46 ``<string>`` is a comma-separated list of user-defined macros that behave like
47 the ``NULL`` macro. The :option:`-use-nullptr` transform will replace these
48 macros along with ``NULL``. See :doc:`UseNullptrTransform`.
49
Edwin Vane3b9f08d2013-03-08 23:26:00 +000050.. option:: -use-auto
51
52 Replace the type specifier of variable declarations with the ``auto`` type
53 specifier. See :doc:`UseAutoTransform`.
54
Edwin Vane8ef7fa12013-04-09 20:49:49 +000055.. option:: -add-override
56
57 Adds the override specifier to member functions where it is appropriate. That
58 is, the override specifier is added to member functions that override a
59 virtual function in a base class and that don't already have the specifier.
60 See :doc:`AddOverrideTransform`.
61
Edwin Vane30f70042013-02-25 20:37:03 +000062.. option:: -p=<build-path>
63
64 ``<build-path>`` is a CMake build directory containing a file named
65 ``compile_commands.json`` which provides compiler options for building
66 each source file and can be generated by specifying
67 ``-DCMAKE_EXPORT_COMPILE_COMMANDS`` when running CMake. If ``<build-path>``
68 is not provided the ``compile_commands.json`` file is searched for through
69 all parent directories.
70
71 Alternatively, one can provide compile options to be applied to every
72 source file after the optional ``--``.
73
74.. option:: -risk=<risk-level>
75
76 Some transformations may cause a change in semantics. In such cases the
77 maximum acceptable risk level specified through the ``-risk`` command
78 line option decides whether or not a transformation is applied.
79
80 Three different risk level options are available:
81
82 ``-risk=safe``
83 Perform only safe transformations.
84 ``-risk=reasonable`` (default)
85 Enable transformations that may change semantics.
86 ``-risk=risky``
87 Enable transformations that are likely to change semantics.
88
Edwin Vanee4e7c242013-03-09 03:33:50 +000089 The meaning of risk is handled differently for each transform. See
90 :ref:`transform documentation <transforms>` for details.
Edwin Vane30f70042013-02-25 20:37:03 +000091
Edwin Vanebdcd1352013-03-09 03:38:20 +000092.. option:: -final-syntax-check
Tareq A. Sirajc2aa348d2013-03-28 16:06:59 +000093
Edwin Vanebdcd1352013-03-09 03:38:20 +000094 After applying the final transform to a file, parse the file to ensure the
95 last transform did not introduce syntax errors. Syntax errors introduced by
96 earlier transforms are already caught when subsequent transforms parse the
97 file.
98
99.. option:: -fatal-assembler-warnings
100
101 Treat all compiler warnings as errors.
102
Edwin Vane30f70042013-02-25 20:37:03 +0000103
104.. option:: -version
105
106 Displays the version information of this tool.
107
Edwin Vanee4e7c242013-03-09 03:33:50 +0000108.. _transforms:
Edwin Vane30f70042013-02-25 20:37:03 +0000109
110Transformations
111===============
112
Edwin Vanee4e7c242013-03-09 03:33:50 +0000113* :doc:`LoopConvertTransform`
Edwin Vane30f70042013-02-25 20:37:03 +0000114
Edwin Vanee4e7c242013-03-09 03:33:50 +0000115* :doc:`UseNullptrTransform`
Edwin Vane30f70042013-02-25 20:37:03 +0000116
Edwin Vanee4e7c242013-03-09 03:33:50 +0000117* :doc:`UseAutoTransform`