File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -120,17 +120,16 @@ void UseDesignatedInitializersCheck::registerMatchers(MatchFinder *Finder) {
120
120
const auto HasBaseWithFields =
121
121
hasAnyBase (hasType (cxxRecordDecl (has (fieldDecl ()))));
122
122
123
- // see #133715
124
- const auto IsSTLArray =
125
- hasType (qualType (hasDeclaration (recordDecl (hasName (" ::std::array" )))));
126
-
127
123
Finder->addMatcher (
128
124
initListExpr (
129
125
hasType (cxxRecordDecl (RestrictToPODTypes ? isPOD () : isAggregate (),
130
- unless (HasBaseWithFields))
126
+ unless (anyOf (HasBaseWithFields,
127
+ IgnoreSingleElementAggregates
128
+ ? hasName (" ::std::array" )
129
+ : anything ())))
131
130
.bind (" type" )),
132
131
IgnoreSingleElementAggregates ? hasMoreThanOneElement () : anything (),
133
- unless (anyOf ( isFullyDesignated (), IsSTLArray )))
132
+ unless (isFullyDesignated ()))
134
133
.bind (" init" ),
135
134
this );
136
135
}
Original file line number Diff line number Diff line change @@ -173,7 +173,8 @@ Changes in existing checks
173
173
174
174
- Improved :doc: `modernize-use-designated-initializers
175
175
<clang-tidy/checks/modernize/use-designated-initializers>` check by avoiding
176
- diagnosing designated initializers for ``std::array `` initializations.
176
+ diagnosing designated initializers for ``std::array `` initializations when
177
+ `IgnoreSingleElementAggregates ` is false.
177
178
178
179
- Improved :doc: `modernize-use-ranges
179
180
<clang-tidy/checks/modernize/use-ranges>` check by updating suppress
You can’t perform that action at this time.
0 commit comments