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
diff --git a/clang-tools-extra/docs/AddOverrideTransform.rst b/clang-tools-extra/docs/AddOverrideTransform.rst
new file mode 100644
index 0000000..8057f2f
--- /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
+ { }
+ };
+