diff options
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 1 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/modernize-use-default.rst | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index d1dda8ecdb2..a2e4de29135 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -55,6 +55,7 @@ List of clang-tidy Checks modernize-replace-auto-ptr modernize-shrink-to-fit modernize-use-auto + modernize-use-default modernize-use-nullptr modernize-use-override readability-braces-around-statements diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize-use-default.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-default.rst new file mode 100644 index 00000000000..c52cf89b918 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize-use-default.rst @@ -0,0 +1,27 @@ +modernize-use-default +===================== + +This check replaces default bodies of special member functions with ``= +default;``. The explicitly defaulted function declarations enable more +opportunities in optimization, because the compiler might treat explicitly +defaulted functions as trivial. + +.. code-block:: c++ + + struct A { + A() {} + ~A(); + }; + A::~A() {} + + // becomes + + struct A { + A() = default; + ~A(); + }; + A::~A() = default; + +.. note:: + Copy-constructor, copy-assignment operator, move-constructor and + move-assignment operator are not supported yet. |