Add unit tagging to CppOverloadSetId (#6212)

No update to lldbinit.py because we don't currently have
dumping/debugging support for CppOverloadSetId anyway.
This commit is contained in:
David Blaikie
2025-10-14 18:29:40 +00:00
committed by GitHub
parent a0ef7e7112
commit d0d2f18f37
5 changed files with 12 additions and 3 deletions
@@ -135,9 +135,9 @@ fn G(x: Cpp.X) {
// CHECK:STDOUT: inst60000022: {kind: CompleteTypeWitness, arg0: inst60000020, type: type(inst(WitnessType))}
// CHECK:STDOUT: inst60000023: {kind: PointerType, arg0: inst60000020, type: type(TypeType)}
// CHECK:STDOUT: inst60000024: {kind: NameRef, arg0: name0, arg1: inst60000010, type: type(inst(NamespaceType))}
// CHECK:STDOUT: inst60000025: {kind: CppOverloadSetType, arg0: cpp_overload_set0, arg1: specific<none>, type: type(TypeType)}
// CHECK:STDOUT: inst60000026: {kind: CppOverloadSetValue, arg0: cpp_overload_set0, type: type(inst60000025)}
// CHECK:STDOUT: inst60000027: {kind: CppOverloadSetValue, arg0: cpp_overload_set0, type: type(inst60000025)}
// CHECK:STDOUT: inst60000025: {kind: CppOverloadSetType, arg0: cpp_overload_set60000000, arg1: specific<none>, type: type(TypeType)}
// CHECK:STDOUT: inst60000026: {kind: CppOverloadSetValue, arg0: cpp_overload_set60000000, type: type(inst60000025)}
// CHECK:STDOUT: inst60000027: {kind: CppOverloadSetValue, arg0: cpp_overload_set60000000, type: type(inst60000025)}
// CHECK:STDOUT: inst60000028: {kind: NameRef, arg0: name4, arg1: inst60000026, type: type(inst60000025)}
// CHECK:STDOUT: inst60000029: {kind: FunctionDecl, arg0: function1, arg1: inst_block_empty, type: type(inst6000002A)}
// CHECK:STDOUT: inst6000002A: {kind: FunctionType, arg0: function1, arg1: specific<none>, type: type(TypeType)}
+1
View File
@@ -35,6 +35,7 @@ File::File(const Parse::Tree* parse_tree, CheckIRId check_ir_id,
: LibraryNameId::Default),
value_stores_(&value_stores),
filename_(std::move(filename)),
cpp_overload_sets_(IdTag(check_ir_id.index, 0)),
classes_(IdTag(check_ir_id.index, 0)),
associated_constants_(IdTag(check_ir_id.index, 0)),
impls_(*this),
+4
View File
@@ -42,6 +42,10 @@ auto ConstantId::Print(llvm::raw_ostream& out, bool disambiguate) const
}
}
auto CppOverloadSetId::Print(llvm::raw_ostream& out) const -> void {
IdBase::PrintHex(out);
}
auto CheckIRId::Print(llvm::raw_ostream& out) const -> void {
if (*this == Cpp) {
out << Label << "(Cpp)";
+2
View File
@@ -276,6 +276,8 @@ struct CppOverloadSetId : public IdBase<CppOverloadSetId> {
static constexpr llvm::StringLiteral Label = "cpp_overload_set";
using IdBase::IdBase;
auto Print(llvm::raw_ostream& out) const -> void;
};
// The ID of a function.
+2
View File
@@ -53,6 +53,8 @@ class InstNamer {
auto index = id.index;
if constexpr (std::is_same_v<IdT, ClassId>) {
index = sem_ir_->classes().GetRawIndex(id);
} else if constexpr (std::is_same_v<IdT, CppOverloadSetId>) {
index = sem_ir_->cpp_overload_sets().GetRawIndex(id);
} else if constexpr (std::is_same_v<IdT, AssociatedConstantId>) {
index = sem_ir_->associated_constants().GetRawIndex(id);
}