| 12345678910111213141516171819202122232425262728293031323334 |
- // 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_SEM_IR_EXPR_INFO_H_
- #define CARBON_TOOLCHAIN_SEM_IR_EXPR_INFO_H_
- #include <cstdint>
- #include "toolchain/sem_ir/file.h"
- #include "toolchain/sem_ir/ids.h"
- #include "toolchain/sem_ir/inst_kind.h"
- namespace Carbon::SemIR {
- // Returns the expression category for an instruction.
- auto GetExprCategory(const File& file, InstId inst_id) -> ExprCategory;
- // Returns whether the given expression category is for a reference expression.
- inline auto IsRefCategory(ExprCategory cat) -> bool {
- return cat == ExprCategory::DurableRef || cat == ExprCategory::EphemeralRef;
- }
- // Given a primitive-form initializing expression, find its return slot
- // argument. If `allow_transitive` is true, the result may be an argument to
- // some other inst whose outcome is forwarded by `init_id`; otherwise the result
- // must be an argument to `init_id` itself. Returns `None` if no such return
- // slot is found.
- auto FindReturnSlotArgForInitializer(const File& sem_ir, InstId init_id,
- bool allow_transitive = true) -> InstId;
- } // namespace Carbon::SemIR
- #endif // CARBON_TOOLCHAIN_SEM_IR_EXPR_INFO_H_
|