mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:34:41 +01:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user