Skip to content

Commit 44159e7

Browse files
zrlkcopybara-github
authored andcommitted
Don't add unsupported items to the list of toplevel items.
PiperOrigin-RevId: 840405417
1 parent ab7f6fc commit 44159e7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

rs_bindings_from_cc/importer.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,20 @@ void Importer::Import(clang::TranslationUnitDecl* translation_unit_decl) {
606606
llvm::copy(GetOrderedItemIdsOfTemplateInstantiations(),
607607
std::back_inserter(
608608
invocation_.ir_.top_level_item_ids[invocation_.target_]));
609+
610+
// Remove any unsupported items.
611+
for (auto& [label, item_ids] : invocation_.ir_.top_level_item_ids) {
612+
item_ids.erase(
613+
std::remove_if(
614+
item_ids.begin(), item_ids.end(),
615+
[&](ItemId item_id) {
616+
auto it = import_cache_.find(
617+
reinterpret_cast<clang::Decl*>(item_id.value()));
618+
return it != import_cache_.end() && it->second.has_value() &&
619+
std::holds_alternative<UnsupportedItem>(*it->second);
620+
}),
621+
item_ids.end());
622+
}
609623
}
610624

611625
void Importer::ImportDeclsFromDeclContext(

0 commit comments

Comments
 (0)