Only export each class or namespace to C++ once. (#7042)

Instead of exporting a class or namespace each time a new C++ name
lookup discovers it, track that we have exported the entity on its name
scope, and if a new name lookup finds the same entity, produce the same
clang declaration.
This commit is contained in:
Richard Smith
2026-04-13 19:43:44 +00:00
committed by GitHub
parent 3cdb159067
commit f31e1685fd
11 changed files with 325 additions and 161 deletions
@@ -107,3 +107,17 @@ inline Cpp '''
// CHECK:STDERR:
static_assert(sizeof(Carbon::A) == 2 * sizeof(int));
''';
// --- alias_identity.carbon
library "[[@TEST_NAME]]";
import Cpp;
class A {}
alias B = A;
inline Cpp '''
// OK, Carbon::A and Carbon::B are the same type.
Carbon::A *pa;
Carbon::B *pb = pa;
''';