[clang-tools-extra] [clang-tidy] Support direct initialization in modernize smart pointer (PR #154732)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 23 04:36:42 PDT 2025
================
@@ -190,9 +188,15 @@ void MakeSmartPtrCheck::checkConstruct(SourceManager &SM, ASTContext *Ctx,
ConstructCallEnd = ConstructCallStart.getLocWithOffset(LAngle);
}
+ std::string FinalMakeSmartPtrFunctionName = MakeSmartPtrFunctionName.str();
+ auto Parents = Ctx->getParents(*Construct);
+ if (!Parents.empty() && Parents[0].get<clang::Decl>())
----------------
vbvictor wrote:
Waking up AST with parents is expensive, and I think this part can be moved in matchers.
Something like: `cxxConstructExpr(..., optionally(hasParent(varDecl().bind("decl"))))`
https://github.com/llvm/llvm-project/pull/154732
More information about the cfe-commits
mailing list