Roundtrip (export/reimport) class declarations (#7182)

Roundtrip (export/reimport) class declarations

The remapping was previously implemented using name_scopes, which aren't
created for class declarations, only definitions - causing the reimport
to import a fresh copy of the type that mismatched with the original (as
seen in the test baseline).

By changing the mapping to use the reverse part of the clang_decls
mapping this should generalize better (& we probably should further
migrate to that mapping). Though it did trip over some issue with
exactly which instruction is used as the key in the clang_decls map -
this change moves towards standardizing on the first decl id of the
class as its map key.
This commit is contained in:
David Blaikie
2026-05-11 16:35:47 +00:00
committed by GitHub
parent eea1e58376
commit 0f5de499d6
4 changed files with 27 additions and 11 deletions
@@ -41,3 +41,19 @@ auto F(C *p) -> Carbon::CAlias* {
return p;
}
''';
// --- import.carbon
library "[[@TEST_NAME]]";
import Cpp;
class Class1;
inline Cpp '''
void func(Carbon::Class1* _Nonnull);
''';
fn Caller(p: Class1*) {
Cpp.func(p);
}