File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -153,15 +153,19 @@ std::string MinMaxUseInitializerListCheck::generateReplacement(
153
153
for (const Expr *Arg : Result.Args ) {
154
154
QualType ArgType = Arg->getType ();
155
155
156
- // check if expression is std::min or std::max
157
156
if (const auto *InnerCall = dyn_cast<CallExpr>(Arg)) {
158
- if (InnerCall->getDirectCallee () &&
159
- InnerCall->getDirectCallee ()->getNameAsString () !=
160
- TopCall->getDirectCallee ()->getNameAsString ()) {
161
- FindArgsResult innerResult = findArgs (Match, InnerCall);
162
- ReplacementText += generateReplacement (Match, InnerCall, innerResult) +=
163
- " })" ;
164
- continue ;
157
+ if (InnerCall->getDirectCallee ()) {
158
+ std::string InnerCallNameStr =
159
+ InnerCall->getDirectCallee ()->getNameAsString ();
160
+
161
+ if (InnerCallNameStr != TopCall->getDirectCallee ()->getNameAsString () &&
162
+ (InnerCallNameStr == " std::min" ||
163
+ InnerCallNameStr == " std::max" )) {
164
+ FindArgsResult innerResult = findArgs (Match, InnerCall);
165
+ ReplacementText +=
166
+ generateReplacement (Match, InnerCall, innerResult);
167
+ continue ;
168
+ }
165
169
}
166
170
}
167
171
You can’t perform that action at this time.
0 commit comments