| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- // 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
- #ifndef CARBON_TOOLCHAIN_CHECK_LITERAL_H_
- #define CARBON_TOOLCHAIN_CHECK_LITERAL_H_
- #include "toolchain/base/value_ids.h"
- #include "toolchain/check/context.h"
- #include "toolchain/check/convert.h"
- #include "toolchain/lex/token_info.h"
- #include "toolchain/sem_ir/ids.h"
- namespace Carbon::Check {
- // Forms a TypeType for a `type` literal.
- auto MakeTypeTypeLiteral(Context& context, Parse::NodeId node_id)
- -> SemIR::TypeInstId;
- // Forms a boolean type for a `bool` literal.
- auto MakeBoolTypeLiteral(Context& context, Parse::NodeId node_id)
- -> SemIR::TypeInstId;
- // Forms a BoolLiteral instruction with the given value and returns it.
- auto MakeBoolLiteral(Context& context, SemIR::LocId loc_id,
- SemIR::BoolValue value) -> SemIR::InstId;
- // Forms an IntValue instruction with type `IntLiteral` for a given literal
- // integer value, which is assumed to be unsigned.
- auto MakeIntLiteral(Context& context, Parse::NodeId node_id, IntId int_id)
- -> SemIR::InstId;
- // Forms a char type expression for `char` literal.
- auto MakeCharTypeLiteral(Context& context, Parse::NodeId node_id)
- -> SemIR::TypeInstId;
- // Forms an integer type expression for either an `iN` or `uN` literal.
- auto MakeIntTypeLiteral(Context& context, Parse::NodeId node_id,
- SemIR::IntKind int_kind, IntId size_id)
- -> SemIR::TypeInstId;
- // Forms an integer type of the specified kind and bit-width.
- auto MakeIntType(Context& context, Parse::NodeId node_id,
- SemIR::IntKind int_kind, IntId size_id) -> SemIR::TypeId;
- // Forms a floating point type expression for `fN` literal.
- auto MakeFloatTypeLiteral(Context& context, Parse::NodeId node_id,
- IntId size_id) -> SemIR::TypeInstId;
- // Forms a string literal value instruction for a given string literal.
- auto MakeStringLiteral(Context& context, Parse::StringLiteralId node_id,
- StringLiteralValueId value_id) -> SemIR::InstId;
- // Forms a string literal type expression for a `str` literal.
- auto MakeStringTypeLiteral(Context& context, Parse::StringTypeLiteralId node_id)
- -> SemIR::TypeInstId;
- // Forms a string type.
- auto MakeStringType(Context& context, SemIR::LocId loc_id) -> TypeExpr;
- } // namespace Carbon::Check
- #endif // CARBON_TOOLCHAIN_CHECK_LITERAL_H_
|