@@ -77,7 +77,7 @@ static FindArgsResult findArgs(const CallExpr *Call) {
77
77
}
78
78
79
79
static SmallVector<FixItHint>
80
- generateReplacement (const MatchFinder::MatchResult &Match,
80
+ generateReplacements (const MatchFinder::MatchResult &Match,
81
81
const CallExpr *TopCall, const FindArgsResult &Result) {
82
82
SmallVector<FixItHint> FixItHints;
83
83
@@ -158,12 +158,9 @@ generateReplacement(const MatchFinder::MatchResult &Match,
158
158
}
159
159
160
160
const SmallVector<FixItHint> InnerReplacements =
161
- generateReplacement (Match, InnerCall, InnerResult);
161
+ generateReplacements (Match, InnerCall, InnerResult);
162
162
163
- FixItHints.insert (FixItHints.end (),
164
- // ignore { and } insertions for the inner call if it does
165
- // not have an initializer list arg
166
- InnerReplacements.begin (), InnerReplacements.end ());
163
+ FixItHints.append (InnerReplacements);
167
164
168
165
if (InnerResult.Compare ) {
169
166
// find the comma after the value arguments
@@ -222,10 +219,10 @@ void MinMaxUseInitializerListCheck::check(
222
219
const auto *TopCall = Match.Nodes .getNodeAs <CallExpr>(" topCall" );
223
220
224
221
const FindArgsResult Result = findArgs (TopCall);
225
- const SmallVector<FixItHint> Replacement =
226
- generateReplacement (Match, TopCall, Result);
222
+ const SmallVector<FixItHint> Replacements =
223
+ generateReplacements (Match, TopCall, Result);
227
224
228
- if (Replacement .empty ())
225
+ if (Replacements .empty ())
229
226
return ;
230
227
231
228
const DiagnosticBuilder Diagnostic =
@@ -248,8 +245,7 @@ void MinMaxUseInitializerListCheck::check(
248
245
" }" );
249
246
}
250
247
251
- for (const auto &FixIt : Replacement)
252
- Diagnostic << FixIt;
248
+ Diagnostic << Replacements;
253
249
}
254
250
255
251
} // namespace clang::tidy::modernize
0 commit comments