Add extern template declarations for ValueStore in inst.h and entity_name.h (#7507)

Add extern template declarations and explicit template instantiations
for ValueStore<InstId, Inst> and ValueStore<EntityNameId, EntityName> to
prevent redundant template instantiations.

Place them in their respective domain files (inst.h/cpp and
entity_name.h/cpp) to maintain modularity.

Assisted-by: Antigravity with Gemini
This commit is contained in:
Chandler Carruth
2026-07-14 22:58:05 +00:00
committed by GitHub
parent 6c010816a4
commit 5b48274e58
5 changed files with 21 additions and 0 deletions
+1
View File
@@ -92,6 +92,7 @@ cc_library(
"cpp_file.cpp",
"cpp_initializer_list.cpp",
"cpp_overload_set.cpp",
"entity_name.cpp",
"facet_type_info.cpp",
"field.cpp",
"file.cpp",
+12
View File
@@ -0,0 +1,12 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "toolchain/sem_ir/entity_name.h"
#include "toolchain/base/value_store_impl.h"
namespace Carbon {
template class ValueStore<SemIR::EntityNameId, SemIR::EntityName,
Tag<SemIR::CheckIRId>>;
} // namespace Carbon
+5
View File
@@ -142,4 +142,9 @@ inline auto EntityNameStore::MakeCanonical(EntityNameId id) -> EntityNameId {
} // namespace Carbon::SemIR
namespace Carbon {
extern template class ValueStore<SemIR::EntityNameId, SemIR::EntityName,
Tag<SemIR::CheckIRId>>;
} // namespace Carbon
#endif // CARBON_TOOLCHAIN_SEM_IR_ENTITY_NAME_H_
+1
View File
@@ -169,4 +169,5 @@ template class ValueStore<SemIR::InstBlockId,
Tag<SemIR::CheckIRId>>;
template class BlockValueStore<SemIR::InstBlockId, SemIR::InstId,
Tag<SemIR::CheckIRId>>;
template class ValueStore<SemIR::InstId, SemIR::Inst, Tag<SemIR::CheckIRId>>;
} // namespace Carbon
+2
View File
@@ -718,6 +718,8 @@ extern template class ValueStore<SemIR::InstBlockId,
Tag<SemIR::CheckIRId>>;
extern template class BlockValueStore<SemIR::InstBlockId, SemIR::InstId,
Tag<SemIR::CheckIRId>>;
extern template class ValueStore<SemIR::InstId, SemIR::Inst,
Tag<SemIR::CheckIRId>>;
} // namespace Carbon
#endif // CARBON_TOOLCHAIN_SEM_IR_INST_H_