[llvm] [ADT] Use a range-based for loop instead of llvm::for_each (NFC) (PR #149542)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 18 09:12:58 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
LLVM Coding Standards discourages llvm::for_each unless we already
have a callable.
---
Full diff: https://github.com/llvm/llvm-project/pull/149542.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/CombinationGenerator.h (+1-2)
``````````diff
diff --git a/llvm/include/llvm/ADT/CombinationGenerator.h b/llvm/include/llvm/ADT/CombinationGenerator.h
index 6100aa9812293..bbdbd9bfa1be3 100644
--- a/llvm/include/llvm/ADT/CombinationGenerator.h
+++ b/llvm/include/llvm/ADT/CombinationGenerator.h
@@ -118,10 +118,9 @@ class CombinationGenerator {
: VariablesChoices(VariablesChoices_) {
#ifndef NDEBUG
assert(!VariablesChoices.empty() && "There should be some variables.");
- llvm::for_each(VariablesChoices, [](ArrayRef<choice_type> VariableChoices) {
+ for (ArrayRef<choice_type> VariableChoices : VariablesChoices)
assert(!VariableChoices.empty() &&
"There must always be some choice, at least a placeholder one.");
- });
#endif
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/149542
More information about the llvm-commits
mailing list