Files
carbon-lang/toolchain/sem_ir/dump.h
T
Dana Jansens fb7eff130d Move IdentifiedFacetType to check (#8004)
`IdentifiedFacetType` is a concept that is only used by check. It does
not appear in the semir output, unlike `DeclaredFacetType`s.
`IdentifiedFacetType` is used in check to collapse named constraints
together, building a single structure of requirements from a
`DeclaredFacetType` and any referenced named constraints. This is used
for operations like impl lookup, and building `FacetValue`s.

The outputs of `IdentifiedFacetType` are now in an intermediate state,
where they contain `IdentifiedWitness`es, and need to be processed
before they are used. We'd like to build that into the API of
`IdentifiedFacetType` so that their use is more robust. But the
`IdentifiedWitnesses` need to be replaced by subst, which is a part of
check, so we need to move `IdentifiedFacetType` to check in order to
build the type on top of subst.
2026-10-21 13:20:54 +00:00

95 lines
4.4 KiB
C++

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// This library contains functions to assist dumping objects to stderr during
// interactive debugging. Functions named `Dump` are intended for direct use by
// developers, and should use overload resolution to determine which will be
// invoked. The debugger should do namespace resolution automatically. For
// example:
//
// - lldb: `dump file id`
// - gdb: `call Dump(file, id)`
//
// When adding a new ID type, if it corresponds to a collection in `File`, also
// update the following places:
// - Add a `Dump` function in this header and `toolchain/sem_ir/dump.cpp`.
// - Add a forwarding `Dump` function in `toolchain/check/dump.cpp`.
// - Add a `Make<NewIdType>` function in `toolchain/sem_ir/dump.cpp`.
// - Add the `Make<NewIdType>` function to the `id_types` map in
// `scripts/lldbinit.py`.
#ifndef CARBON_TOOLCHAIN_SEM_IR_DUMP_H_
#define CARBON_TOOLCHAIN_SEM_IR_DUMP_H_
#include "toolchain/sem_ir/ids.h"
#ifndef NDEBUG
#include "toolchain/sem_ir/file.h"
namespace Carbon::SemIR {
auto DumpNameIfValid(const File& file, NameId name_id) -> std::string;
auto DumpNameOfEntityName(const File& file, const EntityName& entity_name)
-> std::string;
auto DumpLocSummary(const File& file, LocId loc_id) -> std::string;
auto DumpConstantSummary(const File& file, ConstantId const_id) -> std::string;
auto DumpTypeSummary(const File& file, TypeId type_id) -> std::string;
auto DumpInstSummary(const File& file, InstId inst_id) -> std::string;
auto DumpGenericSummary(const File& file, GenericId generic_id) -> std::string;
auto DumpInterfaceSummary(const File& file, InterfaceId interface_id)
-> std::string;
auto DumpNamedConstraintSummary(const File& file,
NamedConstraintId named_constraint_id)
-> std::string;
auto DumpSpecificSummary(const File& file, SpecificId specific_id)
-> std::string;
auto DumpRequireImplsSummary(const File& file, RequireImplsId require_impls_id)
-> std::string;
auto Dump(const File& file) -> std::string;
auto Dump(const File& file, RawBundleId bundle_id) -> std::string;
auto Dump(const File& file, GeneratedFunctionId generated_function_id)
-> std::string;
auto Dump(const File& file, ClangDeclId clang_decl_id) -> std::string;
auto Dump(const File& file, ClangDeclSignatureId clang_decl_signature_id)
-> std::string;
auto Dump(const File& file, ClassId class_id) -> std::string;
auto Dump(const File& file, ConstantId const_id) -> std::string;
auto Dump(const File& file, CppOverloadSetId overload_set_id) -> std::string;
auto Dump(const File& file, DeclaredFacetTypeId declared_facet_type_id)
-> std::string;
auto Dump(const File& file, EntityNameId entity_name_id) -> std::string;
auto Dump(const File& file, FieldId field_id) -> std::string;
auto Dump(const File& file, FunctionId function_id) -> std::string;
auto Dump(const File& file, GenericId generic_id) -> std::string;
auto Dump(const File& file, ImplId impl_id) -> std::string;
auto Dump(const File& file, ImportIRInstId import_inst_id) -> std::string;
auto Dump(const File& file, const Inst& inst) -> std::string;
auto Dump(const File& file, InstBlockId inst_block_id) -> std::string;
auto Dump(const File& file, InstId inst_id) -> std::string;
auto Dump(const File& file, InterfaceId interface_id) -> std::string;
auto Dump(const File& file, LocId loc_id) -> std::string;
auto Dump(const File& file, NameId name_id) -> std::string;
auto Dump(const File& file, const NameScope& name_scope) -> std::string;
auto Dump(const File& file, NameScopeId name_scope_id) -> std::string;
auto Dump(const File& file, NamedConstraintId named_constraint_id)
-> std::string;
auto Dump(const File& file, RequireImplsBlockId require_impls_block_id)
-> std::string;
auto Dump(const File& file, RequireImplsId require_impls_id) -> std::string;
auto Dump(const File& file, SpecificId specific_id) -> std::string;
auto Dump(const File& file, const SpecificInterface& specific_interface_id)
-> std::string;
auto Dump(const File& file, SpecificInterfaceId specific_interface_id)
-> std::string;
auto Dump(const File& file, StructTypeFieldsId struct_type_fields_id)
-> std::string;
auto Dump(const File& file, TypeId type_id) -> std::string;
} // namespace Carbon::SemIR
#endif // NDEBUG
#endif // CARBON_TOOLCHAIN_SEM_IR_DUMP_H_