[clang-tools-extra] [clang-tidy] Fix invalid fixit from modernize-use-ranges for nullptr used with std::unique_ptr (PR #127162)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 13 21:44:04 PST 2025
================
@@ -215,6 +215,16 @@ void UseRangesCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Call = Result.Nodes.getNodeAs<CallExpr>(Buffer);
if (!Call)
continue;
+ if (Function->getName() == "find") {
+ unsigned ValueArgIndex = 2;
+ if (Call->getNumArgs() <= ValueArgIndex)
+ continue;
+ const Expr *ValueExpr =
+ Call->getArg(ValueArgIndex)->IgnoreParenImpCasts();
+ if (isa<CXXNullPtrLiteralExpr>(ValueExpr)) {
+ return;
+ }
----------------
PiotrZSL wrote:
```suggestion
if (isa<CXXNullPtrLiteralExpr>(ValueExpr))
return;
```
https://github.com/llvm/llvm-project/pull/127162
More information about the cfe-commits
mailing list