Support for mapping array types to/from C++. (#7285)

For now, disable the use of array types as by-var paramters and by-init
return types when exporting Carbon functions to C++, as C++ does not
support raw arrays being passed or returned by value.

Assisted-by: Gemini via Antigravity
This commit is contained in:
Richard Smith
2026-06-01 21:55:16 +00:00
committed by GitHub
parent d01e1d2d06
commit 2952f61095
12 changed files with 495 additions and 37 deletions
+14
View File
@@ -13,6 +13,7 @@
#include "toolchain/check/type.h"
#include "toolchain/diagnostics/emitter.h"
#include "toolchain/sem_ir/inst.h"
#include "toolchain/sem_ir/inst_categories.h"
namespace Carbon::Check {
@@ -224,6 +225,19 @@ auto AddPatternVarStorage(Context& context, SemIR::InstBlockId pattern_block_id,
}
}
auto GetParamPatternKind(Context& context, SemIR::InstId param_inst_id)
-> ParamPatternKind {
auto param = context.insts().Get(param_inst_id);
CARBON_CHECK(param.Is<SemIR::AnyParamPattern>());
if (param.Is<SemIR::RefParamPattern>()) {
return ParamPatternKind::Ref;
} else if (param.Is<SemIR::VarParamPattern>()) {
return ParamPatternKind::Var;
} else {
return ParamPatternKind::Value;
}
}
auto AddParamPattern(Context& context, SemIR::LocId loc_id,
SemIR::NameId name_id,
SemIR::ExprRegionId type_expr_region_id,