Skip to content

Commit b1ab340

Browse files
committed
Add blank lines to group case with the above offset increment in InstNamer::GetScopeIdOffset()
This would hopefully help prevent bugs like the one fixed in carbon-language#6151.
1 parent b99bc00 commit b1ab340

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

toolchain/sem_ir/inst_namer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,30 +129,39 @@ auto InstNamer::GetScopeIdOffset(ScopeIdTypeEnum id_enum) const -> int {
129129
switch (id_enum) {
130130
case ScopeIdTypeEnum::None:
131131
// `None` will be getting a full count of scopes.
132+
132133
offset += sem_ir_->associated_constants().size();
133134
[[fallthrough]];
134135
case ScopeIdTypeEnum::For<AssociatedConstantId>:
136+
135137
offset += sem_ir_->classes().size();
136138
[[fallthrough]];
137139
case ScopeIdTypeEnum::For<ClassId>:
140+
138141
offset += sem_ir_->cpp_overload_sets().size();
139142
[[fallthrough]];
140143
case ScopeIdTypeEnum::For<CppOverloadSetId>:
144+
141145
offset += sem_ir_->functions().size();
142146
[[fallthrough]];
143147
case ScopeIdTypeEnum::For<FunctionId>:
148+
144149
offset += sem_ir_->impls().size();
145150
[[fallthrough]];
146151
case ScopeIdTypeEnum::For<ImplId>:
152+
147153
offset += sem_ir_->interfaces().size();
148154
[[fallthrough]];
149155
case ScopeIdTypeEnum::For<InterfaceId>:
156+
150157
offset += sem_ir_->specific_interfaces().size();
151158
[[fallthrough]];
152159
case ScopeIdTypeEnum::For<SpecificInterfaceId>:
160+
153161
offset += sem_ir_->vtables().size();
154162
[[fallthrough]];
155163
case ScopeIdTypeEnum::For<VtableId>:
164+
156165
// All type-specific scopes are offset by `FirstEntityScope`.
157166
offset += static_cast<int>(ScopeId::FirstEntityScope);
158167
return offset;

0 commit comments

Comments
 (0)