[clang] [LifetimeSafety] Introduce buildOriginFlowChain for use-after-scope (PR #199345)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Sun May 24 10:00:24 PDT 2026


================
@@ -54,14 +54,24 @@ inline bool IsLifetimeSafetyEnabled(Sema &S, const Decl *D) {
   return false;
 }
 
+inline StringRef formatExpr(const Expr *E) {
+  const Expr *PureExpr = E->IgnoreImpCasts();
----------------
usx95 wrote:

Instead of this, we should introduce a filter `bool shouldShowInAliasingChain(const Expr* CurExpr, const Expr* LastExpr)` and return `false` for `ParenCast` and `ImplicitCast`. This method can also be responsible for skipping if we have same source range as the `LastExpr`.

Currently we will print diagnostics multiple times for the inner expression.

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


More information about the cfe-commits mailing list