[clang] [LifetimeSafety] Introduce buildOriginFlowChain to use-after-invalidation (PR #208891)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 13 02:40:33 PDT 2026


================
@@ -263,12 +263,16 @@ class LifetimeChecker {
         if (Warning.InvalidatedByExpr) {
           if (IssueExpr)
             // Use-after-invalidation of an object on stack.
-            SemaHelper->reportUseAfterInvalidation(IssueExpr, UF->getUseExpr(),
-                                                   Warning.InvalidatedByExpr);
+            SemaHelper->reportUseAfterInvalidation(
+                IssueExpr, UF->getUseExpr(), Warning.InvalidatedByExpr,
+                getExprChain(
----------------
Xazax-hun wrote:

We have this repeated pattern of `getExprChain(LoanPropagation.buildOriginFlowChain(...))`. I am wondering if this means we would be better off with a helper that gives us directly the expression chain and would take one additional argument, the loan propagation.

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


More information about the cfe-commits mailing list