mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 19:51:09 +01:00
Cleanup pass over llvm::seq uses (#5185)
I was thinking about this after `seq` changes in #5182, and looked for other uses that might be replaceable. Here's the resulting cleanup around `seq`: - Switch to `enumerate` or `zip` when possible. - `int _` -> `auto _` (it's typically a `size_t`, but there's no reason to cast when unused) - Fix a case of cast style `(size_t)...` -> `static_cast<size_t>(...)` - Switch `(void)close_children_count` to `[[maybe_unused]]`
This commit is contained in:
@@ -117,13 +117,13 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void {
|
||||
|
||||
// Check we have a value for all non-function associated constants in the
|
||||
// witness.
|
||||
for (auto index : llvm::seq(assoc_entities.size())) {
|
||||
auto decl_id = assoc_entities[index];
|
||||
for (auto [assoc_entity, witness_value] :
|
||||
llvm::zip(assoc_entities, witness_block)) {
|
||||
auto decl_id = assoc_entity;
|
||||
decl_id = context.constant_values().GetConstantInstId(decl_id);
|
||||
CARBON_CHECK(decl_id.has_value(), "Non-constant associated entity");
|
||||
if (auto decl =
|
||||
context.insts().TryGetAs<SemIR::AssociatedConstantDecl>(decl_id)) {
|
||||
auto& witness_value = witness_block[index];
|
||||
if (!witness_value.has_value()) {
|
||||
CARBON_DIAGNOSTIC(ImplAssociatedConstantNeedsValue, Error,
|
||||
"associated constant {0} not given a value in impl "
|
||||
@@ -137,7 +137,7 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void {
|
||||
.Get(decl->assoc_const_id)
|
||||
.name_id,
|
||||
interface.name_id)
|
||||
.Note(assoc_entities[index], AssociatedConstantHere)
|
||||
.Note(assoc_entity, AssociatedConstantHere)
|
||||
.Emit();
|
||||
|
||||
witness_value = SemIR::ErrorInst::SingletonInstId;
|
||||
|
||||
Reference in New Issue
Block a user