[clang-tools-extra] [clang-tidy] cppcoreguidelines-owning-memory: support new expressions through implicit casts (PR #189544)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 08:23:01 PDT 2026


================
@@ -63,7 +63,8 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) {
                 functionDecl(returns(qualType(hasDeclaration(OwnerDecl)))))),
             CreatesLegacyOwner, LegacyOwnerCast);
----------------
vbvictor wrote:

Can we write `ignoringImpCasts()` only once:
```suggestion
const auto CreatesOwner =
    ignoringImpCasts(anyOf(cxxNewExpr(),
      callExpr(callee(
      functionDecl(returns(qualType(hasDeclaration(OwnerDecl)))))),
    CreatesLegacyOwner, LegacyOwnerCast));
```

https://github.com/llvm/llvm-project/pull/189544


More information about the cfe-commits mailing list