mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 00:48:19 +00:00
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:
1 parent
5c2338dbd0
commit
7330e6698c
10 files changed
+39
-44
No files matched your search
@@ -4,11 +4,10 @@
|
||||
|
||||
#include "toolchain/parser/parser_context.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "common/check.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "toolchain/lexer/token_kind.h"
|
||||
#include "toolchain/lexer/tokenized_buffer.h"
|
||||
#include "toolchain/parser/parse_node_kind.h"
|
||||
@@ -448,8 +447,7 @@ auto ParserContext::EmitExpectedDeclarationSemiOrDefinition(
|
||||
|
||||
auto ParserContext::PrintForStackDump(llvm::raw_ostream& output) const -> void {
|
||||
output << "Parser stack:\n";
|
||||
for (int i = 0; i < static_cast<int>(state_stack_.size()); ++i) {
|
||||
const auto& entry = state_stack_[i];
|
||||
for (auto [i, entry] : llvm::enumerate(state_stack_)) {
|
||||
output << "\t" << i << ".\t" << entry.state;
|
||||
PrintTokenForStackDump(output, entry.token);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user