mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Add unit tagging to VtableId (#6216)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user