================
@@ -780,6 +780,15 @@ void FactsGenerator::VisitCXXDeleteExpr(const 
CXXDeleteExpr *DE) {
       FactMgr.createFact<InvalidateOriginFact>(List->getOuterOriginID(), DE));
 }
 
+void FactsGenerator::VisitStmtExpr(const StmtExpr *SE) {
+  // Mark the value used here (its origins are shared with the final 
expression;
+  // see getOrCreateList). The CFG runs this point after the body's locals
+  // expire, so the use keeps that origin live across a body-local's expiry --
+  // the only way to catch such a borrow, since liveness comes only from a
+  // direct use, never backward through the flow that later delivers the value.
+  handleUse(SE);
----------------
usx95 wrote:

Once we model this as an origin flow (without sharing origins), I feel this 
might be not be required and could also fix the `discarded_body_local` 
false-positive.

https://github.com/llvm/llvm-project/pull/204841
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to