[clang] [llvm] fix-liveness (PR #205740)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 25 00:34:21 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 h,cpp -- lifetime_reproduce.cpp clang/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h clang/include/clang/Analysis/Analyses/LifetimeSafety/FactsGenerator.h clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp clang/lib/Analysis/LifetimeSafety/LiveOrigins.cpp clang/test/Sema/LifetimeSafety/invalidations.cpp clang/test/Sema/LifetimeSafety/safety.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/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h
index ac12957a1..5c671a93b 100644
--- a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h
+++ b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h
@@ -355,7 +355,6 @@ public:
     BlockToFacts[B->getBlockID()].push_back(F);
   }
 
-
   template <typename FactType, typename... Args>
   FactType *createFact(Args &&...args) {
     void *Mem = FactAllocator.Allocate<FactType>();
diff --git a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
index a9999e7c6..7f5b11e64 100644
--- a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
+++ b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
@@ -127,7 +127,6 @@ static const CFGBlock *findPredBlockForExpr(const CFGBlock *MergeBlock,
   return nullptr;
 }
 
-
 void FactsGenerator::run() {
   llvm::TimeTraceScope TimeProfile("FactGenerator");
   const CFG &Cfg = *AC.getCFG();
@@ -580,7 +579,8 @@ void FactsGenerator::VisitAbstractConditionalOperator(
   const CFGBlock *FBPred = findPredBlockForExpr(CurrentBlock, FalseExpr);
 
   // Helper to generate flow facts.
-  auto HandleFlowInBlock = [&](const Expr *E, const CFGBlock *PredBlock, bool Kill) {
+  auto HandleFlowInBlock = [&](const Expr *E, const CFGBlock *PredBlock,
+                               bool Kill) {
     OriginList *Dst = getOriginsList(*CO);
     OriginList *Src = getOriginsList(*E);
     if (!Dst || !Src)
@@ -655,7 +655,6 @@ void FactsGenerator::VisitAbstractConditionalOperator(
   }
 }
 
-
 void FactsGenerator::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *OCE) {
   // Assignment operators have special "kill-then-propagate" semantics
   // and are handled separately.
diff --git a/lifetime_reproduce.cpp b/lifetime_reproduce.cpp
index cc8691949..771ff1af2 100644
--- a/lifetime_reproduce.cpp
+++ b/lifetime_reproduce.cpp
@@ -1,8 +1,8 @@
-void consume(int* a);
+void consume(int *a);
 
 void test(bool cond) {
-    for (int i = 0; i < 2; i++) {
-        int x, y;
-        consume(cond ? &x : &y);
-    }
+  for (int i = 0; i < 2; i++) {
+    int x, y;
+    consume(cond ? &x : &y);
+  }
 }

``````````

</details>


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


More information about the cfe-commits mailing list