mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-22 15:42:38 +00:00
The key changes are: - Function output parameters are now prefixed with `out`, and more consistently formatted as named parameters. - Function and inst output arguments are now written as part of the inst form, rather than as one of the inst arguments. As a drive-by fix, this also changes `Temporary::storage_id` from `DestInstId` to `InstId`, because it doesn't represent an output parameter of the `Temporary` inst itself. See the review of [#6532](https://github.com/carbon-language/carbon-lang/pull/6532) and [this Discord discussion](https://discord.com/channels/655572317891461132/999638000126394370/1458268977020141589) for additional background.
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
// 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_
|