[clang] [LifetimeSafety] Add multi-block support to buildOriginFlowChain (PR #204592)

Yuan Suo via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 19 00:45:48 PDT 2026


================
@@ -204,51 +209,45 @@ class AnalysisImpl
 
   llvm::SmallVector<OriginID>
   buildOriginFlowChain(ProgramPoint StartPoint, const OriginID StartOID,
-                       const LoanID TargetLoan) const {
+                       const LoanID TargetLoan,
+                       const PostOrderCFGView *POV) const {
     assert(getLoans(StartOID, StartPoint).contains(TargetLoan) &&
            "TargetLoan must be present in the StartOID at the StartPoint");
 
-    OriginID CurrOID = StartOID;
     llvm::SmallVector<OriginID> OriginFlowChain;
-    llvm::ArrayRef<const Fact *> Facts = FactMgr.getBlockContaining(StartPoint);
-    const auto *StartIt = llvm::find(Facts, StartPoint);
-    assert(StartIt != Facts.end());
+    std::optional<size_t> BlockID = FactMgr.getBlockID(StartPoint);
+    assert(BlockID.has_value());
+    const auto StartIt = llvm::find_if(*POV, [&BlockID](const CFGBlock *Block) {
----------------
suoyuan666 wrote:

Yes, but it's also the starting point for the search.

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


More information about the cfe-commits mailing list