================
@@ -183,40 +210,47 @@ void UseStartsEndsWithCheck::check(const
MatchFinder::MatchResult &Result) {
const auto *EndsWithFunction =
Result.Nodes.getNodeAs<CXXMethodDecl>("ends_with_fun");
assert(bool(StartsWithFunction) != bool(EndsWithFunction));
+
const CXXMethodDecl *ReplacementFunction =
StartsWithFunction ? StartsWithFunction : EndsWithFunction;
- if (ComparisonExpr->getBeginLoc().isMacroID())
+ if (ComparisonExpr->getBeginLoc().isMacroID() ||
+ FindExpr->getBeginLoc().isMacroID())
return;
- const bool Neg = ComparisonExpr->getOpcode() == BO_NE;
+ if (FindExpr->getNumArgs() == 0)
----------------
nicovank wrote:
A short comment to explain why this is here would be nice. This should never
happen in practice anyway as all matchers check at least one argument.
```suggestion
// Make sure FindExpr->getArg(0) can be used to make a range in the FitItHint.
if (FindExpr->getNumArgs() == 0)
```
https://github.com/llvm/llvm-project/pull/116033
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits