Edwin Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 1 | .. index:: cpp11-migrate |
| 2 | |
Edwin Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 3 | =========================== |
| 4 | cpp11-migrate User's Manual |
| 5 | =========================== |
| 6 | |
Edwin Vane | 3b9f08d | 2013-03-08 23:26:00 +0000 | [diff] [blame] | 7 | .. toctree:: |
| 8 | :hidden: |
| 9 | |
| 10 | UseAutoTransform |
Edwin Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 11 | UseNullptrTransform |
| 12 | LoopConvertTransform |
Edwin Vane | 8ef7fa1 | 2013-04-09 20:49:49 +0000 | [diff] [blame^] | 13 | AddOverrideTransform |
Edwin Vane | 3b9f08d | 2013-03-08 23:26:00 +0000 | [diff] [blame] | 14 | |
Edwin Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 15 | :program:`cpp11-migrate` is a standalone tool used to automatically convert |
| 16 | C++98 and C++03 code to use features of the new C++11 standard where |
| 17 | appropriate. |
| 18 | |
| 19 | Basic Usage |
| 20 | =========== |
| 21 | |
| 22 | ``cpp11-migrate [options] <source0> [... <sourceN>]`` |
| 23 | |
| 24 | ``<source0>...`` specify the paths of files in the CMake source tree, |
| 25 | with the same requirements as other tools built on LibTooling. |
| 26 | |
| 27 | Command Line Options |
| 28 | -------------------- |
| 29 | |
Edwin Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 30 | .. option:: -help |
| 31 | |
| 32 | Displays tool usage instructions and command line options. |
| 33 | |
| 34 | .. option:: -loop-convert |
| 35 | |
Edwin Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 36 | 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 Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 43 | |
Tareq A. Siraj | c2aa348d | 2013-03-28 16:06:59 +0000 | [diff] [blame] | 44 | .. 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 Vane | 3b9f08d | 2013-03-08 23:26:00 +0000 | [diff] [blame] | 50 | .. option:: -use-auto |
| 51 | |
| 52 | Replace the type specifier of variable declarations with the ``auto`` type |
| 53 | specifier. See :doc:`UseAutoTransform`. |
| 54 | |
Edwin Vane | 8ef7fa1 | 2013-04-09 20:49:49 +0000 | [diff] [blame^] | 55 | .. 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 Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 62 | .. 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 Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 89 | The meaning of risk is handled differently for each transform. See |
| 90 | :ref:`transform documentation <transforms>` for details. |
Edwin Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 91 | |
Edwin Vane | bdcd135 | 2013-03-09 03:38:20 +0000 | [diff] [blame] | 92 | .. option:: -final-syntax-check |
Tareq A. Siraj | c2aa348d | 2013-03-28 16:06:59 +0000 | [diff] [blame] | 93 | |
Edwin Vane | bdcd135 | 2013-03-09 03:38:20 +0000 | [diff] [blame] | 94 | 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 Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 103 | |
| 104 | .. option:: -version |
| 105 | |
| 106 | Displays the version information of this tool. |
| 107 | |
Edwin Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 108 | .. _transforms: |
Edwin Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 109 | |
| 110 | Transformations |
| 111 | =============== |
| 112 | |
Edwin Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 113 | * :doc:`LoopConvertTransform` |
Edwin Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 114 | |
Edwin Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 115 | * :doc:`UseNullptrTransform` |
Edwin Vane | 30f7004 | 2013-02-25 20:37:03 +0000 | [diff] [blame] | 116 | |
Edwin Vane | e4e7c24 | 2013-03-09 03:33:50 +0000 | [diff] [blame] | 117 | * :doc:`UseAutoTransform` |