dump.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. // This library contains functions to assist dumping objects to stderr during
  5. // interactive debugging. Functions named `Dump` are intended for direct use by
  6. // developers, and should use overload resolution to determine which will be
  7. // invoked. The debugger should do namespace resolution automatically. For
  8. // example:
  9. //
  10. // - lldb: `expr Dump(tokens, id)`
  11. // - gdb: `call Dump(tokens, id)`
  12. #ifndef CARBON_TOOLCHAIN_SEM_IR_DUMP_H_
  13. #define CARBON_TOOLCHAIN_SEM_IR_DUMP_H_
  14. #ifndef NDEBUG
  15. #include "toolchain/sem_ir/file.h"
  16. namespace Carbon::SemIR {
  17. auto Dump(const File& file, ClassId class_id) -> std::string;
  18. auto Dump(const File& file, ConstantId const_id) -> std::string;
  19. auto Dump(const File& file, EntityNameId entity_name_id) -> std::string;
  20. auto Dump(const File& file, FacetTypeId facet_type_id) -> std::string;
  21. auto Dump(const File& file, FunctionId function_id) -> std::string;
  22. auto Dump(const File& file, GenericId generic_id) -> std::string;
  23. auto Dump(const File& file, IdentifiedFacetTypeId identified_facet_type_id)
  24. -> std::string;
  25. auto Dump(const File& file, ImplId impl_id) -> std::string;
  26. auto Dump(const File& file, InstBlockId inst_block_id) -> std::string;
  27. auto Dump(const File& file, InstId inst_id) -> std::string;
  28. auto Dump(const File& file, InterfaceId interface_id) -> std::string;
  29. auto Dump(const File& file, LocId loc_id) -> std::string;
  30. auto Dump(const File& file, NameId name_id) -> std::string;
  31. auto Dump(const File& file, NameScopeId name_scope_id) -> std::string;
  32. auto Dump(const File& file, NamedConstraintId named_constraint_id)
  33. -> std::string;
  34. auto Dump(const File& file, RequireImplsBlockId require_impls_block_id)
  35. -> std::string;
  36. auto Dump(const File& file, RequireImplsId require_impls_id) -> std::string;
  37. auto Dump(const File& file, SpecificId specific_id) -> std::string;
  38. auto Dump(const File& file, SpecificInterfaceId specific_interface_id)
  39. -> std::string;
  40. auto Dump(const File& file, StructTypeFieldsId struct_type_fields_id)
  41. -> std::string;
  42. auto Dump(const File& file, TypeId type_id) -> std::string;
  43. } // namespace Carbon::SemIR
  44. #endif // NDEBUG
  45. #endif // CARBON_TOOLCHAIN_SEM_IR_DUMP_H_