[clang] Adding use-after-return in Lifetime Analysis (PR #165370)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 31 01:01:43 PDT 2025


================
@@ -166,7 +169,8 @@ void FactsGenerator::VisitReturnStmt(const ReturnStmt *RS) {
   if (const Expr *RetExpr = RS->getRetValue()) {
     if (hasOrigin(RetExpr)) {
       OriginID OID = FactMgr.getOriginMgr().getOrCreate(*RetExpr);
-      CurrentBlockFacts.push_back(FactMgr.createFact<ReturnOfOriginFact>(OID));
----------------
Xazax-hun wrote:

I was wondering if keeping the return fact would help producing good quality diagnostics, especially after other sources of escapes are introduced, like assigning to members, globals. Or output parameters. If we do not actually need this for diagnostics, I am fine removing it. 

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


More information about the cfe-commits mailing list