Add unit tagging to VtableId (#6216)

This commit is contained in:
David Blaikie
2025-10-15 20:48:31 +00:00
committed by GitHub
parent 45017bf65d
commit 63118265f0
4 changed files with 9 additions and 0 deletions
+1
View File
@@ -45,6 +45,7 @@ File::File(const Parse::Tree* parse_tree, CheckIRId check_ir_id,
// instruction. It's not a "singleton" instruction, but it's a unique
// instruction id that comes right after the singletons.
insts_(this, SingletonInstKinds.size() + 1),
vtables_(IdTag(check_ir_id.index, 0)),
constant_values_(ConstantId::NotConstant, &insts_),
inst_blocks_(allocator_),
constants_(this) {
+4
View File
@@ -62,6 +62,10 @@ auto ClassId::Print(llvm::raw_ostream& out) const -> void {
IdBase::PrintHex(out);
}
auto VtableId::Print(llvm::raw_ostream& out) const -> void {
IdBase::PrintHex(out);
}
auto AssociatedConstantId::Print(llvm::raw_ostream& out) const -> void {
IdBase::PrintHex(out);
}
+2
View File
@@ -324,6 +324,8 @@ struct VtableId : public IdBase<VtableId> {
static constexpr llvm::StringLiteral Label = "vtable";
using IdBase::IdBase;
auto Print(llvm::raw_ostream& out) const -> void;
};
// The ID of an `Interface`.
+2
View File
@@ -63,6 +63,8 @@ class InstNamer {
index = sem_ir_->impls().GetRawIndex(id);
} else if constexpr (std::is_same_v<IdT, SpecificInterfaceId>) {
index = sem_ir_->specific_interfaces().GetRawIndex(id);
} else if constexpr (std::is_same_v<IdT, VtableId>) {
index = sem_ir_->vtables().GetRawIndex(id);
}
return static_cast<ScopeId>(GetScopeIdOffset(ScopeIdTypeEnum::For<IdT>) +
index);