[clang] [analyzer][NFC] Modernize iterator-based loop in LiveVariables::computeLiveness (PR #157670)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 9 06:39:34 PDT 2025


https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/157670

None

>From 36480cff2af13ba75d94a306dabea372bb2b3614 Mon Sep 17 00:00:00 2001
From: Balazs Benics <balazs.benics at sonarsource.com>
Date: Tue, 9 Sep 2025 11:32:45 +0200
Subject: [PATCH] [analyzer][NFC] Modernize iterator-based loop in
 LiveVariables::computeLiveness

---
 clang/lib/Analysis/LiveVariables.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp
index 891e766407722..c23a092df6cfb 100644
--- a/clang/lib/Analysis/LiveVariables.cpp
+++ b/clang/lib/Analysis/LiveVariables.cpp
@@ -556,9 +556,8 @@ LiveVariables::computeLiveness(AnalysisDeclContext &AC, bool killAtAssign) {
 
     // Merge the values of all successor blocks.
     LivenessValues val;
-    for (CFGBlock::const_succ_iterator it = block->succ_begin(),
-                                       ei = block->succ_end(); it != ei; ++it) {
-      if (const CFGBlock *succ = *it) {
+    for (const CFGBlock *succ : block->succs()) {
+      if (succ) {
         val = LV->merge(val, LV->blocksBeginToLiveness[succ]);
       }
     }



More information about the cfe-commits mailing list