Skip to content

Commit 542459e

Browse files
committed
Add some doc
1 parent 6a77257 commit 542459e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ void UseDesignatedInitializersCheck::check(
124124
if (SyntacticInitList->getNumInits() - NumberOfDesignated >
125125
Designators.size())
126126
return;
127+
128+
// If the whole initializer list is un-designated, issue only one warning and
129+
// a single fix-it for the whole expression.
127130
if (0 == NumberOfDesignated) {
128131
if (IgnoreMacros && InitList->getBeginLoc().isMacroID())
129132
return;
@@ -142,6 +145,9 @@ void UseDesignatedInitializersCheck::check(
142145
DiagnosticIDs::Note);
143146
return;
144147
}
148+
149+
// In case that a only few elements are un-designated (not all as before), the
150+
// check offers dedicated issues and fix-its for each of them.
145151
for (const auto *InitExpr : *SyntacticInitList) {
146152
if (isa<DesignatedInitExpr>(InitExpr))
147153
continue;

0 commit comments

Comments
 (0)