[clang] [LifetimeSafety] Introduce buildOriginFlowChain for use-after-scope (PR #199345)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 12 06:20:27 PDT 2026
================
@@ -471,13 +474,44 @@ class LifetimeSafetySemaHelperImpl : public LifetimeSafetySemaHelper {
}
std::string getDiagSubjectDescription(const Expr *E) {
+ E = E->IgnoreImpCasts();
if (isa<MaterializeTemporaryExpr>(E))
return "local temporary object";
if (const auto *DRE = dyn_cast<DeclRefExpr>(E))
return getDiagSubjectDescription(DRE->getDecl());
// TODO: Handle other expression types.
- return "";
+ return "expression";
+ }
+
+ bool shouldShowInAliasChain(const Expr *CurrExpr, const Expr *LastExpr) {
+ CurrExpr = CurrExpr->IgnoreImpCasts();
+ LastExpr = LastExpr->IgnoreImpCasts();
+
+ if (isa<MaterializeTemporaryExpr, ParenExpr>(CurrExpr))
----------------
usx95 wrote:
I think we agreed to start from a small subset of expression like CallExpr and DeclRefExpr.
So we can have instead:
`if (!isa<CallExpr, DeclRefExpr>(CurrExpr)) return false;`
https://github.com/llvm/llvm-project/pull/199345
More information about the cfe-commits
mailing list