Drop `for_current_target_` from `Importer::class_template_instantiations_`.
The renamed field includes decls from *all* targets, because
`IsFromCurrentTarget` *always* returns true for
`ClassTemplateSpecializationDecl`s, since `GetOwningTarget` has the
following code:
```
BazelLabel Importer::GetOwningTarget(const clang::Decl* decl) const {
// Template instantiations need to be generated in the target that
// triggered the instantiation (not in the target where the template
// is defined).
if (IsFullClassTemplateSpecializationOrChild(decl)) {
return invocation_.target_;
}
```
PiperOrigin-RevId: 476224525
diff --git a/rs_bindings_from_cc/importer.cc b/rs_bindings_from_cc/importer.cc
index aa1ab56..f609c9c 100644
--- a/rs_bindings_from_cc/importer.cc
+++ b/rs_bindings_from_cc/importer.cc
@@ -411,8 +411,8 @@
std::vector<ItemId> Importer::GetOrderedItemIdsOfTemplateInstantiations()
const {
std::vector<SourceLocationComparator::OrderedItemId> items;
- items.reserve(class_template_instantiations_for_current_target_.size());
- for (const auto* decl : class_template_instantiations_for_current_target_) {
+ items.reserve(class_template_instantiations_.size());
+ for (const auto* decl : class_template_instantiations_) {
items.push_back({GetSourceOrderKey(decl), GenerateItemId(decl)});
}
@@ -664,7 +664,7 @@
// Store `specialization_decl`s so that they will get included in
// IR::top_level_item_ids.
- class_template_instantiations_for_current_target_.insert(specialization_decl);
+ class_template_instantiations_.insert(specialization_decl);
return ConvertTypeDecl(specialization_decl);
}