Skip to content

Conversation

@steakhal
Copy link
Contributor

@steakhal steakhal commented Sep 9, 2025

No description provided.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:analysis labels Sep 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2025

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clang-analysis

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Balazs Benics (steakhal)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/157670.diff

1 Files Affected:

  • (modified) clang/lib/Analysis/LiveVariables.cpp (+2-3)
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]);
       }
     }

@steakhal steakhal changed the title [analyzer][NFC] Modernize iterator-based loop in LiveVariables::computeLiveness [analyzer][NFC] Modernize loops in LiveVariables analysis Sep 9, 2025
…dumpBlockLiveness

Convert multiple iterator-based loops to range-based for loops:
- DenseMap iteration over blocksEndToLiveness
- std::vector iteration over CFGBlocks
- ImmutableSet iteration over liveDecls
- std::vector iteration over declVec
@steakhal
Copy link
Contributor Author

steakhal commented Sep 9, 2025

Finally, I managed to reset the commit authors 😅

@steakhal steakhal enabled auto-merge (squash) September 9, 2025 14:20
@steakhal steakhal merged commit 723fcd5 into llvm:main Sep 9, 2025
9 checks passed
@steakhal steakhal deleted the bb/refactor branch September 9, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:analysis clang:static analyzer clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants