mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Move the mapping from entity name to an imported C++ global variable declaration outside of EntityName (#6211)
This would save space for every `EntityName` that is not an imported C++ global variable. C++ global variables include static data members. Created `CppGlobalVarId`, `CppGlobalVarKey` and `CppGlobalVar` to allow having `CanonicalValueStore` that maps `EntityNameId` (which is in `CppGlobalVarKey` and `CppGlobalVar`) to `ClangDeclId` (which is also in `CppGlobalVar`). This is similar to `ClangDeclId`, `ClangDeclKey` and `ClangDecl` .
This commit is contained in:
@@ -1853,7 +1853,9 @@ static auto ImportVarDecl(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::EntityNameId entity_name_id =
|
||||
context.entity_names().AddSymbolicBindingName(
|
||||
var_name_id, GetParentNameScopeId(context, var_decl),
|
||||
SemIR::CompileTimeBindIndex::None, false, clang_decl_id);
|
||||
SemIR::CompileTimeBindIndex::None, false);
|
||||
context.cpp_global_names().Add({.key = {.entity_name_id = entity_name_id},
|
||||
.clang_decl_id = clang_decl_id});
|
||||
|
||||
// Create `BindingPattern` and `VarPattern` in a `NameBindingDecl`.
|
||||
context.pattern_block_stack().Push();
|
||||
|
||||
Reference in New Issue
Block a user