literal.h 1.1 KB

1234567891011121314151617181920212223242526272829
  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_CHECK_LITERAL_H_
  5. #define CARBON_TOOLCHAIN_CHECK_LITERAL_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/sem_ir/ids.h"
  8. namespace Carbon::Check {
  9. // Forms an IntValue instruction with type `IntLiteral` for a given literal
  10. // integer value, which is assumed to be unsigned.
  11. auto MakeIntLiteral(Context& context, Parse::NodeId node_id, IntId int_id)
  12. -> SemIR::InstId;
  13. // Forms an integer type expression for either an `iN` or `uN` literal.
  14. auto MakeIntTypeLiteral(Context& context, Parse::NodeId node_id,
  15. SemIR::IntKind int_kind, IntId size_id)
  16. -> SemIR::InstId;
  17. // Forms an integer type of the specified kind and bit-width.
  18. auto MakeIntType(Context& context, Parse::NodeId node_id,
  19. SemIR::IntKind int_kind, IntId size_id) -> SemIR::TypeId;
  20. } // namespace Carbon::Check
  21. #endif // CARBON_TOOLCHAIN_CHECK_LITERAL_H_