llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-analysis Author: Zhijie Wang (aeft) <details> <summary>Changes</summary> Follow-up to #<!-- -->240104. Replace the remaining `IgnoreParenImpCasts()` calls in LifetimeSafety with `ignoreParensAndImpCasts()`. NFC: at these call sites, not skipping `MaterializeTemporaryExpr` and `SubstNonTypeTemplateParmExpr` does not change the result. Assisted-by: Claude Opus 5.5 --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> --- Full diff: https://github.com/llvm/llvm-project/pull/240733.diff 3 Files Affected: - (modified) clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp (+6-5) - (modified) clang/lib/Analysis/LifetimeSafety/LifetimeAnnotations.cpp (+2-2) - (modified) clang/lib/Analysis/LifetimeSafety/Origins.cpp (+1-1) ``````````diff diff --git a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp index 7356c6b5ce134..30ec401736c05 100644 --- a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp +++ b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp @@ -557,10 +557,10 @@ static const CFGBlock *findPredBlockForExpr(const CFGBlock *MergeBlock, const Expr *ArmExpr) { if (!ArmExpr) return nullptr; - const Expr *Target = ArmExpr->IgnoreParenImpCasts(); + const Expr *Target = ignoreParensAndImpCasts(ArmExpr); if (const auto *OVE = dyn_cast<OpaqueValueExpr>(Target)) if (const Expr *Src = OVE->getSourceExpr()) - Target = Src->IgnoreParenImpCasts(); + Target = ignoreParensAndImpCasts(Src); for (const CFGBlock *Pred : MergeBlock->preds()) { if (!Pred) @@ -568,7 +568,7 @@ static const CFGBlock *findPredBlockForExpr(const CFGBlock *MergeBlock, for (const CFGElement &Elt : *Pred) if (auto CS = Elt.getAs<CFGStmt>()) if (const auto *E = dyn_cast<Expr>(CS->getStmt())) - if (E->IgnoreParenImpCasts() == Target) + if (ignoreParensAndImpCasts(E) == Target) return Pred; } return nullptr; @@ -690,7 +690,8 @@ void FactsGenerator::VisitLambdaExpr(const LambdaExpr *LE) { const Expr *Init = cast<VarDecl>(C.getCapturedVar())->getInit(); if (!Init) continue; - if (const auto *ME = dyn_cast<MemberExpr>(Init->IgnoreParenImpCasts())) { + if (const auto *ME = + dyn_cast<MemberExpr>(ignoreParensAndImpCasts(Init))) { if (const auto *FD = dyn_cast<FieldDecl>(ME->getMemberDecl())) FactMgr.addCapturedField(FD); } @@ -1302,7 +1303,7 @@ bool FactsGenerator::handleTestPoint(const CXXFunctionalCastExpr *FCE) { if (!FCE->getType()->isVoidType()) return false; - const auto *SubExpr = FCE->getSubExpr()->IgnoreParenImpCasts(); + const auto *SubExpr = ignoreParensAndImpCasts(FCE->getSubExpr()); if (const auto *SL = dyn_cast<StringLiteral>(SubExpr)) { llvm::StringRef LiteralValue = SL->getString(); const std::string Prefix = "__lifetime_test_point_"; diff --git a/clang/lib/Analysis/LifetimeSafety/LifetimeAnnotations.cpp b/clang/lib/Analysis/LifetimeSafety/LifetimeAnnotations.cpp index dd00ff4f5ccb6..dd764ddd1222b 100644 --- a/clang/lib/Analysis/LifetimeSafety/LifetimeAnnotations.cpp +++ b/clang/lib/Analysis/LifetimeSafety/LifetimeAnnotations.cpp @@ -124,7 +124,7 @@ FunctionCallInfo::FunctionCallInfo(const Expr *Call) { if (!Call) return; - std::optional<AnyCall> AC = AnyCall::forExpr(Call->IgnoreParenImpCasts()); + std::optional<AnyCall> AC = AnyCall::forExpr(ignoreParensAndImpCasts(Call)); if (!AC) return; @@ -179,7 +179,7 @@ getTrackingInfoForCallArg(const Expr *Call, const Expr *Source) { return std::nullopt; for (unsigned I = 0; I < Args.size(); ++I) - if (Args[I]->IgnoreParenImpCasts() == Source->IgnoreParenImpCasts()) + if (ignoreParensAndImpCasts(Args[I]) == ignoreParensAndImpCasts(Source)) if (std::optional<LifetimeBoundParamInfo> ParamInfo = getTrackedArgInfo(FD, Args, I)) return ParamInfo; diff --git a/clang/lib/Analysis/LifetimeSafety/Origins.cpp b/clang/lib/Analysis/LifetimeSafety/Origins.cpp index e571e6290bb30..2c3109fbb57c7 100644 --- a/clang/lib/Analysis/LifetimeSafety/Origins.cpp +++ b/clang/lib/Analysis/LifetimeSafety/Origins.cpp @@ -264,7 +264,7 @@ OriginList *OriginManager::getOrCreateList(const ValueDecl *D) { /// Returns true if the field named by \p ME denotes a subobject of `*this`, /// reached as `this->f` or through anonymous-struct/union subobjects. static bool isSubobjectOfThis(const MemberExpr *ME) { - const Expr *Base = ME->getBase()->IgnoreParenImpCasts(); + const Expr *Base = ignoreParensAndImpCasts(ME->getBase()); if (isa<CXXThisExpr>(Base)) return true; `````````` </details> https://github.com/llvm/llvm-project/pull/240733 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
