mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:10:12 +01:00
Add more output in dump for generics, impls (#5190)
This commit is contained in:
@@ -99,6 +99,13 @@ LLVM_DUMP_METHOD static auto Dump(const Context& context,
|
||||
LLVM_DUMP_METHOD static auto Dump(const Context& context, SemIR::ImplId impl_id)
|
||||
-> void {
|
||||
SemIR::Dump(context.sem_ir(), impl_id);
|
||||
if (impl_id.has_value()) {
|
||||
const auto& impl = context.sem_ir().impls().Get(impl_id);
|
||||
auto loc_id = context.sem_ir().insts().GetLocId(impl.witness_id);
|
||||
llvm::errs() << "witness loc: ";
|
||||
DumpNoNewline(context, loc_id);
|
||||
llvm::errs() << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD static auto Dump(const Context& context,
|
||||
|
||||
@@ -19,6 +19,9 @@ static auto DumpNameIfValid(const File& file, NameId name_id) -> void {
|
||||
|
||||
static auto DumpNoNewline(const File& file, ConstantId const_id) -> void {
|
||||
llvm::errs() << const_id;
|
||||
if (!const_id.has_value()) {
|
||||
return;
|
||||
}
|
||||
if (const_id.is_symbolic()) {
|
||||
llvm::errs() << ": "
|
||||
<< file.constant_values().GetSymbolicConstant(const_id);
|
||||
@@ -121,18 +124,34 @@ LLVM_DUMP_METHOD auto Dump(const File& file, FunctionId function_id) -> void {
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file, GenericId generic_id) -> void {
|
||||
llvm::errs() << generic_id;
|
||||
if (generic_id.has_value()) {
|
||||
llvm::errs() << ": " << file.generics().Get(generic_id);
|
||||
if (!generic_id.has_value()) {
|
||||
llvm::errs() << '\n';
|
||||
return;
|
||||
}
|
||||
llvm::errs() << '\n';
|
||||
llvm::errs() << ": " << file.generics().Get(generic_id) << '\n';
|
||||
Dump(file, file.generics().Get(generic_id).bindings_id);
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file, ImplId impl_id) -> void {
|
||||
llvm::errs() << impl_id;
|
||||
if (impl_id.has_value()) {
|
||||
llvm::errs() << ": " << file.impls().Get(impl_id);
|
||||
if (!impl_id.has_value()) {
|
||||
llvm::errs() << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& impl = file.impls().Get(impl_id);
|
||||
llvm::errs() << ": " << impl << '\n';
|
||||
llvm::errs() << " - interface_id: ";
|
||||
DumpNoNewline(file, impl.interface.interface_id);
|
||||
llvm::errs() << '\n';
|
||||
llvm::errs() << " - specific_id: ";
|
||||
DumpNoNewline(file, impl.interface.specific_id);
|
||||
llvm::errs() << '\n';
|
||||
if (impl.interface.specific_id.has_value()) {
|
||||
auto inst_block_id =
|
||||
file.specifics().Get(impl.interface.specific_id).args_id;
|
||||
Dump(file, inst_block_id);
|
||||
}
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD auto Dump(const File& file, InstBlockId inst_block_id)
|
||||
|
||||
@@ -49,7 +49,8 @@ struct Impl : public EntityWithParamsBase,
|
||||
public ImplFields,
|
||||
public Printable<Impl> {
|
||||
auto Print(llvm::raw_ostream& out) const -> void {
|
||||
out << "{self: " << self_id << ", constraint: " << constraint_id << "}";
|
||||
out << "{self: " << self_id << ", constraint: " << constraint_id
|
||||
<< ", witness: " << witness_id << "}";
|
||||
}
|
||||
|
||||
// Determines whether this impl has been fully defined. This is false until we
|
||||
|
||||
Reference in New Issue
Block a user