diff options
| author | Edwin Vane <edwin.vane@intel.com> | 2013-04-09 20:49:49 +0000 |
|---|---|---|
| committer | Edwin Vane <edwin.vane@intel.com> | 2013-04-09 20:49:49 +0000 |
| commit | 8ef7fa1e073e76ea06bd96a299880ee572f762df (patch) | |
| tree | 9d287ebe8c6e009ff4957690d8121b4efefe75c1 /clang-tools-extra/docs | |
| parent | 37ee1d7b80bcae3d63ab12ba0b89698765e10a5d (diff) | |
| download | bcm5719-llvm-8ef7fa1e073e76ea06bd96a299880ee572f762df.tar.gz bcm5719-llvm-8ef7fa1e073e76ea06bd96a299880ee572f762df.zip | |
Adding the AddOverride transform for cpp11-migrate
This transform adds the override specifier to methods that overrides virtual
methods from a base class that don't already have this specifier.
Author: Philip Dunstan <phil@phildunstan.com>
llvm-svn: 179127
Diffstat (limited to 'clang-tools-extra/docs')
| -rw-r--r-- | clang-tools-extra/docs/AddOverrideTransform.rst | 47 | ||||
| -rw-r--r-- | clang-tools-extra/docs/cpp11-migrate.rst | 8 |
2 files changed, 55 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/AddOverrideTransform.rst b/clang-tools-extra/docs/AddOverrideTransform.rst new file mode 100644 index 00000000000..8057f2fda1c --- /dev/null +++ b/clang-tools-extra/docs/AddOverrideTransform.rst @@ -0,0 +1,47 @@ +.. index:: Add-Override Transform + +====================== +Add-Override Transform +====================== + +The Add-Override Transform adds the ``override`` specifier to member +functions that override a virtual function in a base class and that +don't already have the specifier. The transform is enabled with the +:option:`-add-override` option of :program:`cpp11-migrate`. +For example: + +.. code-block:: c++ + + class A { + public: + virtual void h() const; + }; + + class B : public A { + public: + void h() const; + + // The declaration of h is transformed to + void h() const override; + }; + + +Known Limitations +----------------- +* This transform will fail if a method declaration has an inlined method + body and there is a comment between the method declaration and the body. + In this case, the override keyword will incorrectly be inserted at the + end of the comment. + +.. code-block:: c++ + + class B : public A { + public: + virtual void h() const // comment + { } + + // The declaration of h is transformed to + virtual void h() const // comment override + { } + }; + diff --git a/clang-tools-extra/docs/cpp11-migrate.rst b/clang-tools-extra/docs/cpp11-migrate.rst index 6e787f28e35..70e833683dc 100644 --- a/clang-tools-extra/docs/cpp11-migrate.rst +++ b/clang-tools-extra/docs/cpp11-migrate.rst @@ -10,6 +10,7 @@ cpp11-migrate User's Manual UseAutoTransform UseNullptrTransform LoopConvertTransform + AddOverrideTransform :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 @@ -51,6 +52,13 @@ Command Line Options Replace the type specifier of variable declarations with the ``auto`` type specifier. See :doc:`UseAutoTransform`. +.. 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`. + .. option:: -p=<build-path> ``<build-path>`` is a CMake build directory containing a file named |

