[llvm-branch-commits] [clang] [LifetimeSafety][NFC] Add field-labeled child edges to OriginNode and generalize subtree walks (PR #201510)

Zhijie Wang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 11 11:53:32 PDT 2026


================
@@ -365,13 +376,18 @@ void FactsGenerator::VisitUnaryOperator(const UnaryOperator *UO) {
   }
 }
 
+void FactsGenerator::emitReturnEscapes(OriginNode *N, const Expr *RetExpr) {
+  if (!N)
+    return;
+  EscapesInCurrentBlock.push_back(
+      FactMgr.createFact<ReturnEscapeFact>(N->getOriginID(), RetExpr));
+  for (const OriginNode::Edge &E : N->children())
----------------
aeft wrote:

Thanks for the suggestion. This makes it much cleaner.  
  
I have extracted `forEachOrigin` and refactored the code:  
\- `Lattice transfer(Lattice In, const UseFact &UF)`  
\- `void FactsGenerator::VisitReturnStmt(const ReturnStmt *RS)`  
\- `void FactsGenerator::flow(OriginNode *Dst, OriginNode *Src, bool Kill)`

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


More information about the llvm-branch-commits mailing list