Switch more of toolchain to enumerate/seq (#3137)

These were already used in a few spots, just trying to switch more loops
for consistency and ease of reading.
This commit is contained in:
Jon Ross-Perkins
2023-08-23 00:47:03 +00:00
committed by GitHub
parent 5c2338dbd0
commit 7330e6698c
10 changed files with 39 additions and 44 deletions
+1 -4
View File
@@ -4,9 +4,6 @@
#include "toolchain/parser/parse_tree.h"
#include <cstdlib>
#include <optional>
#include "common/check.h"
#include "common/error.h"
#include "llvm/ADT/Sequence.h"
@@ -244,7 +241,7 @@ auto ParseTree::Verify() const -> ErrorOr<Success> {
}
}
} else {
for (int i = 0; i < n_impl.kind.child_count(); ++i) {
for (int i : llvm::seq(n_impl.kind.child_count())) {
if (nodes.empty()) {
return Error(llvm::formatv(
"Node #{0} is a {1} with child_count {2}, but only had {3} "