Skip to content

Commit edebaad

Browse files
committed
docs
1 parent 458f638 commit edebaad

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

clang-tools-extra/clang-tidy/bugprone/CrtpConstructorAccessibilityCheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace clang::tidy::bugprone {
1515

16-
/// Detects error-prone CRTP usage, when the CRTP can be constructed outside
17-
/// itself and the derived class.
16+
/// Detects error-prone Curiously Recurring Template Pattern usage, when the
17+
/// CRTP can be constructed outside itself and the derived class.
1818
///
1919
/// For the user-facing documentation see:
2020
/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone/crtp-constructor-accessibility.html

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ New checks
107107
- New :doc:`bugprone-crtp-constructor-accessibility
108108
<clang-tidy/checks/bugprone/crtp-constructor-accessibility>` check.
109109

110-
Detects error-prone CRTP usage, when the CRTP can be constructed outside itself and the derived class.
110+
Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP
111+
can be constructed outside itself and the derived class.
111112

112113
- New :doc:`modernize-use-designated-initializers
113114
<clang-tidy/checks/modernize/use-designated-initializers>` check.

clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
bugprone-crtp-constructor-accessibility
44
=======================================
55

6-
Finds Curiously Recurring Template Pattern used in an error-prone way.
6+
Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP
7+
can be constructed outside itself and the derived class.
78

89
The CRTP is an idiom, in which a class derives from a template class, where
910
itself is the template argument. It should be ensured that if a class is
@@ -22,7 +23,8 @@ Example:
2223

2324
class Derived : CRTP<Derived> {};
2425

25-
Below can be seen some common mistakes that will allow the breaking of the idiom.
26+
Below can be seen some common mistakes that will allow the breaking of the
27+
idiom.
2628

2729
If the constructor of a class intended to be used in a CRTP is public, then
2830
it allows users to construct that class on its own.
@@ -60,9 +62,10 @@ Example:
6062
class Bad : CRTP<Good> {};
6163
Bad BadInstance;
6264

63-
To ensure that no accidental instantiation happens, the best practice is to make
64-
the constructor private and declare the derived class as friend. Note that as a tradeoff,
65-
this also gives the derived class access to every other private members of the CRTP.
65+
To ensure that no accidental instantiation happens, the best practice is to
66+
make the constructor private and declare the derived class as friend. Note
67+
that as a tradeoff, this also gives the derived class access to every other
68+
private members of the CRTP.
6669

6770
Example:
6871

0 commit comments

Comments
 (0)