mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:51:04 +01:00
Rework handling of C++ references. (#6268)
For now, map C++ reference types to const-qualified Carbon pointer types rather than picking between a (non-const) pointer or a value type. This fixes misbehavior in lowering for reference members in classes and reference return types. Update the special-case handling for references as function parameters so that it continues to map const reference parameters to Carbon pass-by-value, and unify the code paths for `self` parameters and other parameters, which were mostly doing the same thing but had some subtle differences. Add references to the list of types that we can pass to and from C++ directly, without needing an additional layer of thunks.
This commit is contained in:
@@ -157,15 +157,4 @@ auto AddSelfParamPattern(Context& context, SemIR::LocId loc_id,
|
||||
return pattern_id;
|
||||
}
|
||||
|
||||
auto AddAddrSelfParamPattern(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::ExprRegionId type_expr_region_id,
|
||||
SemIR::TypeInstId type_inst_id) -> SemIR::InstId {
|
||||
auto pattern_id = AddSelfParamPattern(context, loc_id, type_expr_region_id,
|
||||
GetPointerType(context, type_inst_id));
|
||||
return AddPatternInst<SemIR::AddrPattern>(
|
||||
context, loc_id,
|
||||
{.type_id = GetPatternType(context, SemIR::AutoType::TypeId),
|
||||
.inner_id = pattern_id});
|
||||
}
|
||||
|
||||
} // namespace Carbon::Check
|
||||
|
||||
Reference in New Issue
Block a user