Reverse interop support for type aliases. (#7043)

Allow any type that has a mapping from Carbon to C++ to be exposed to
C++ via name lookup. This also exposes the logic to export Carbon
classes to C++ to apply during type mapping, which gives very slight
support for passing Carbon types to C++ functions from Carbon, but not
really enough to sensibly test yet.

Depends on #7042.
This commit is contained in:
Richard Smith
2026-04-14 00:18:33 +00:00
committed by GitHub
parent 5b1de7633c
commit 43867a678b
9 changed files with 135 additions and 46 deletions
+2 -6
View File
@@ -131,12 +131,8 @@ auto ExportClassToCpp(Context& context, SemIR::LocId loc_id,
}
auto* identifier_info = GetClangIdentifierInfo(context, class_info.name_id);
if (!identifier_info) {
// TODO: Handle keyword package names like `Cpp` and `Core`. These can
// be named from C++ via an alias.
context.TODO(loc_id, "interop with non-identifier package name");
return nullptr;
}
CARBON_CHECK(identifier_info, "non-identifier class name {0}",
class_info.name_id);
auto* decl_context =
ExportNameScopeToCpp(context, loc_id, class_info.parent_scope_id);