stringify.h 1.2 KB

123456789101112131415161718192021222324252627282930
  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. #ifndef CARBON_TOOLCHAIN_SEM_IR_STRINGIFY_H_
  5. #define CARBON_TOOLCHAIN_SEM_IR_STRINGIFY_H_
  6. #include "toolchain/sem_ir/file.h"
  7. #include "toolchain/sem_ir/ids.h"
  8. namespace Carbon::SemIR {
  9. // Produces a string version of an instruction with a constant value. Generally,
  10. // this should not be called directly. To format a constant value into a
  11. // diagnostic, use a diagnostic parameter of type `InstIdAsConstant`. When the
  12. // constant value is a type, use `InstIdAsType`, `InstIdAsRawType`, or
  13. // `TypeOfInstId` where possible, or of type `TypeId` or `TypeIdAsRawType` if
  14. // you don't have an expression describing the type.
  15. auto StringifyConstantInst(const File& sem_ir, InstId outer_inst_id)
  16. -> std::string;
  17. // Produces a string version of the name of a specific. Generally, this should
  18. // not be called directly. To format a string into a diagnostic, use a
  19. // diagnostic parameter of type `SemIR::SpecificId`.
  20. auto StringifySpecific(const File& sem_ir, SpecificId specific_id)
  21. -> std::string;
  22. } // namespace Carbon::SemIR
  23. #endif // CARBON_TOOLCHAIN_SEM_IR_STRINGIFY_H_