mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:51:12 +01:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user