Remove CppGlobalVarStore (#7309)

Replace all uses of CppGlobalVarStore store with ClangDeclStore.

Adding a VarStorage->VarDecl mapping to ClangDeclStore is now done with
the `AddVar` method, which takes an extra `pattern_id` arg. While the
corresponding `ClangDecl` is unchanged from before, the reverse mapping
in `inst_id_to_clang_decl_id_` now uses the `pattern_id` as the key.
This is necessary because in some places the original VarStorage
instructions gets replaced (e.g. by a call to `Convert`). The
`pattern_id` remains stable in those cases.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Nicholas Bishop
2026-06-05 02:07:46 +00:00
committed by GitHub
co-authored by Richard Smith
parent d652cb0dfd
commit 1aa34d7642
25 changed files with 45 additions and 168 deletions
+1 -2
View File
@@ -436,8 +436,7 @@ auto CarbonExternalASTSource::MapInstIdToClangDeclOrType(LookupResult lookup)
return ExportFieldToCpp(*context_, target_inst_id, field_decl);
}
case CARBON_KIND(SemIR::VarStorage var_storage): {
return ExportVarToCpp(*context_, SemIR::LocId(target_inst_id),
var_storage);
return ExportVarToCpp(*context_, target_inst_id, var_storage);
}
default:
return nullptr;