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);
}
diff --git a/rs_bindings_from_cc/importer.h b/rs_bindings_from_cc/importer.h
index 7058859..a17759f 100644
--- a/rs_bindings_from_cc/importer.h
+++ b/rs_bindings_from_cc/importer.h
@@ -127,7 +127,7 @@
absl::flat_hash_map<const clang::Decl*, std::optional<IR::Item>>
import_cache_;
absl::flat_hash_set<const clang::ClassTemplateSpecializationDecl*>
- class_template_instantiations_for_current_target_;
+ class_template_instantiations_;
std::vector<const clang::RawComment*> comments_;
// Set of decls that have been successfully imported (i.e. that will be