mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 13:21:06 +01:00
As discussed in toolchain meeting, we want to avoid overloading the meaning of "instance", and "specific" was the best name we found. It's a little unorthodox and inventive, but hopefully over time will become as unsurprising as the term "generic" is.
49 lines
1.9 KiB
C++
49 lines
1.9 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_CHECK_FUNCTION_H_
|
|
#define CARBON_TOOLCHAIN_CHECK_FUNCTION_H_
|
|
|
|
#include "toolchain/check/context.h"
|
|
#include "toolchain/check/decl_name_stack.h"
|
|
#include "toolchain/check/subst.h"
|
|
#include "toolchain/sem_ir/function.h"
|
|
#include "toolchain/sem_ir/ids.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
// State saved for a function definition that has been suspended after
|
|
// processing its declaration and before processing its body. This is used for
|
|
// inline method handling.
|
|
struct SuspendedFunction {
|
|
// The function that was declared.
|
|
SemIR::FunctionId function_id;
|
|
// The instruction ID of the FunctionDecl instruction.
|
|
SemIR::InstId decl_id;
|
|
// The declaration name information of the function. This includes the scope
|
|
// information, such as parameter names.
|
|
DeclNameStack::SuspendedName saved_name_state;
|
|
};
|
|
|
|
// Checks that `new_function` has the same parameter types and return type as
|
|
// `prev_function`, applying the specified set of substitutions to the
|
|
// previous function. Prints a suitable diagnostic and returns false if not.
|
|
auto CheckFunctionTypeMatches(Context& context,
|
|
const SemIR::Function& new_function,
|
|
const SemIR::Function& prev_function,
|
|
Substitutions substitutions, bool check_syntax)
|
|
-> bool;
|
|
|
|
// Checks that the return type of the specified function is complete, issuing an
|
|
// error if not. This computes the return slot usage for the function if
|
|
// necessary.
|
|
auto CheckFunctionReturnType(Context& context, SemIRLoc loc,
|
|
SemIR::Function& function,
|
|
SemIR::SpecificId specific_id)
|
|
-> SemIR::Function::ReturnSlot;
|
|
|
|
} // namespace Carbon::Check
|
|
|
|
#endif // CARBON_TOOLCHAIN_CHECK_FUNCTION_H_
|