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

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 19 00:54:58 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions c,h,cpp -- clang/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h clang/include/clang/Analysis/Analyses/LifetimeSafety/LoanPropagation.h clang/lib/Analysis/LifetimeSafety/Checker.cpp clang/lib/Analysis/LifetimeSafety/Facts.cpp clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp clang/test/Sema/LifetimeSafety/safety-c.c clang/test/Sema/LifetimeSafety/safety.cpp clang/unittests/Analysis/LifetimeSafetyTest.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp b/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
index 3424bbc80..f6d620d65 100644
--- a/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
+++ b/clang/lib/Analysis/LifetimeSafety/LoanPropagation.cpp
@@ -212,9 +212,10 @@ public:
     llvm::SmallVector<OriginID> OriginFlowChain;
     std::optional<size_t> BlockID = FactMgr.getBlockID(StartPoint);
     assert(BlockID.has_value());
-    const auto EndBlockIt = llvm::find_if(*POV, [&BlockID](const CFGBlock *Block) {
-      return Block->getBlockID() == BlockID;
-    });
+    const auto EndBlockIt =
+        llvm::find_if(*POV, [&BlockID](const CFGBlock *Block) {
+          return Block->getBlockID() == BlockID;
+        });
 
     OriginID CurrOID = StartOID;
     for (const CFGBlock *B :

``````````

</details>


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


More information about the cfe-commits mailing list