Debian Codegraph @

llvm-project/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-default.rst

raw
1 .. title:: clang-tidy - modernize-use-equals-default
2
3 modernize-use-equals-default
4 ============================
5
6 This check replaces default bodies of special member functions with ``=
7 default;``. The explicitly defaulted function declarations enable more
8 opportunities in optimization, because the compiler might treat explicitly
9 defaulted functions as trivial.
10
11 .. code-block:: c++
12
13 struct A {
14 A() {}
15 ~A();
16 };
17 A::~A() {}
18
19 // becomes
20
21 struct A {
22 A() = default;
23 ~A();
24 };
25 A::~A() = default;
26
27 .. note::
28 Move-constructor and move-assignment operator are not supported yet.
29
30 Options
31 -------
32
33 .. option:: IgnoreMacros
34
35 If set to `true`, the check will not give warnings inside macros. Default
36 is `true`.