mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +01:00
Move default value inst ids to a dedicated value store. (#7810)
Per #7737 we move the default value `InstId` storage from a block in the `SemIR::Function` data structure to a `SemIR::File` scoped `ValueStore`. Moves the default value consistency checking to the general merge argument pattern matching logic, which changes the error message issued to the generic one.
This commit is contained in:
+27
-11
@@ -255,17 +255,6 @@ LLVM_DUMP_METHOD auto Dump(const File& file, CppOverloadSetId overload_set_id)
|
||||
return out.TakeStr();
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file, EntityNameId entity_name_id)
|
||||
-> std::string {
|
||||
RawStringOstream out;
|
||||
out << entity_name_id;
|
||||
if (entity_name_id.has_value()) {
|
||||
auto entity_name = file.entity_names().Get(entity_name_id);
|
||||
out << ": " << entity_name << DumpNameOfEntityName(file, entity_name);
|
||||
}
|
||||
return out.TakeStr();
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file,
|
||||
DeclaredFacetTypeId declared_facet_type_id)
|
||||
-> std::string {
|
||||
@@ -314,6 +303,30 @@ LLVM_DUMP_METHOD auto Dump(const File& file,
|
||||
return out.TakeStr();
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file, DefaultValueId value_id)
|
||||
-> std::string {
|
||||
RawStringOstream out;
|
||||
out << value_id;
|
||||
if (value_id.has_value()) {
|
||||
const auto& default_value = file.default_values().Get(value_id);
|
||||
out << ": " << default_value
|
||||
<< "\n - raw: " << DumpInstSummary(file, default_value.raw_id)
|
||||
<< "\n - value: " << DumpInstSummary(file, default_value.value_id);
|
||||
}
|
||||
return out.TakeStr();
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file, EntityNameId entity_name_id)
|
||||
-> std::string {
|
||||
RawStringOstream out;
|
||||
out << entity_name_id;
|
||||
if (entity_name_id.has_value()) {
|
||||
auto entity_name = file.entity_names().Get(entity_name_id);
|
||||
out << ": " << entity_name << DumpNameOfEntityName(file, entity_name);
|
||||
}
|
||||
return out.TakeStr();
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file, FieldId field_id) -> std::string {
|
||||
RawStringOstream out;
|
||||
out << field_id;
|
||||
@@ -655,6 +668,9 @@ LLVM_DUMP_METHOD static auto MakeConstantId(int id) -> ConstantId {
|
||||
LLVM_DUMP_METHOD auto MakeSymbolicConstantId(int id) -> ConstantId {
|
||||
return ConstantId::ForSymbolicConstantId(ConstantId::SymbolicId(id));
|
||||
}
|
||||
LLVM_DUMP_METHOD static auto MakeDefaultValueId(int id) -> DefaultValueId {
|
||||
return DefaultValueId(id);
|
||||
}
|
||||
LLVM_DUMP_METHOD static auto MakeEntityNameId(int id) -> EntityNameId {
|
||||
return EntityNameId(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user