summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/AddOverrideTransform.rst
diff options
context:
space:
mode:
authorEdwin Vane <edwin.vane@intel.com>2013-04-09 20:49:49 +0000
committerEdwin Vane <edwin.vane@intel.com>2013-04-09 20:49:49 +0000
commit8ef7fa1e073e76ea06bd96a299880ee572f762df (patch)
tree9d287ebe8c6e009ff4957690d8121b4efefe75c1 /clang-tools-extra/docs/AddOverrideTransform.rst
parent37ee1d7b80bcae3d63ab12ba0b89698765e10a5d (diff)
downloadbcm5719-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/AddOverrideTransform.rst')
-rw-r--r--clang-tools-extra/docs/AddOverrideTransform.rst47
1 files changed, 47 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
+ { }
+ };
+
OpenPOWER on IntegriCloud