Skip to content

Commit 4d6446c

Browse files
committed
Fix, format and reorder documentation
1 parent 12f1abf commit 4d6446c

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

clang-tools-extra/clang-tidy/modernize/UseDesignatedInitializersCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void UseDesignatedInitializersCheck::check(
150150
return;
151151
}
152152

153-
// In case that a only few elements are un-designated (not all as before), the
153+
// In case that only a few elements are un-designated (not all as before), the
154154
// check offers dedicated issues and fix-its for each of them.
155155
for (const auto *InitExpr : *SyntacticInitList) {
156156
if (isa<DesignatedInitExpr>(InitExpr))

clang-tools-extra/docs/clang-tidy/checks/modernize/use-designated-initializers.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,16 @@
33
modernize-use-designated-initializers
44
=====================================
55

6-
Finds initializer lists for aggregate type that could be written as
7-
designated initializers instead.
6+
Finds initializer lists for aggregate types which could be written as designated
7+
initializers instead.
88

9-
With plain initializer lists, it is very easy to introduce bugs when adding
10-
new fields in the middle of a struct or class type. The same confusion might
11-
arise when changing the order of fields.
9+
With plain initializer lists, it is very easy to introduce bugs when adding new
10+
fields in the middle of a struct or class type. The same confusion might arise
11+
when changing the order of fields.
1212

13-
C++20 supports the designated initializer syntax for aggregate types.
14-
By applying it, we can always be sure that aggregates are constructed correctly,
15-
because every variable being initialized is referenced by name.
16-
17-
Even when compiling in a language version older than C++20, depending on your
18-
compiler, designated initializers are potentially supported. Therefore, the
19-
check is not restricted to C++20 and older. Check out the options
20-
``-Wc99-designator`` to get support for mixed designators in
21-
initializer list in C and ``-Wc++20-designator`` for support of designated
22-
initializers in older C++ language modes.
13+
C++20 supports the designated initializer syntax for aggregate types. By
14+
applying it, we can always be sure that aggregates are constructed correctly,
15+
because every variable being initialized is referenced by its name.
2316

2417
Example:
2518

@@ -42,21 +35,28 @@ instead of
4235
which could easily become an issue when ``i`` and ``j`` are swapped in the
4336
declaration of ``S``.
4437

38+
Even when compiling in a language version older than C++20, depending on your
39+
compiler, designated initializers are potentially supported. Therefore, the
40+
check is not restricted to C++20 and newer versions. Check out the options
41+
``-Wc99-designator`` to get support for mixed designators in initializer list in
42+
C and ``-Wc++20-designator`` for support of designated initializers in older C++
43+
language modes.
44+
4545
Options
4646
-------
4747

4848
.. option:: IgnoreMacros
4949

50-
The value `false` specifies that components of initializer lists expanded
51-
from macros are not checked. The default value is `true`.
50+
The value `false` specifies that components of initializer lists expanded from
51+
macros are not checked. The default value is `true`.
5252

5353
.. option:: IgnoreSingleElementAggregates
5454

55-
The value `false` specifies that even initializers for aggregate types
56-
with only a single element should be checked. The default value is `true`.
55+
The value `false` specifies that even initializers for aggregate types with
56+
only a single element should be checked. The default value is `true`.
5757

5858
.. option:: RestrictToPODTypes
5959

6060
The value `true` specifies that only Plain Old Data (POD) types shall be
61-
checked. This makes the check applicable to even older C++ standards.
62-
The default value is `false`.
61+
checked. This makes the check applicable to even older C++ standards. The
62+
default value is `false`.

0 commit comments

Comments
 (0)