Handle "gaps" in C++ vtables. (#7206)

Not every entry in a C++ vtable corresponds to a function that we want
to import. For the holes, leave a `SemIR::InstId::None` in the vtable.
Also mark vtables that extend a C++ vtable as being non-Carbon-native so
we don't try to lower them (and crash on the `None` entries).

In particular, we leave holes for destructors, since we don't have
destructor declarations on the Carbon side that need to override them.
This commit is contained in:
Richard Smith
2026-05-14 00:38:24 +00:00
committed by GitHub
parent bd918fb33b
commit c9d8b59bbd
6 changed files with 128 additions and 93 deletions
+3
View File
@@ -2454,6 +2454,9 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver,
for (auto [import_vtable_entry_inst_id, local_vtable_entry_inst_id] :
llvm::zip_equal(virtual_functions, lazy_virtual_functions)) {
if (!local_vtable_entry_inst_id.has_value()) {
continue;
}
// Use LoadedImportRef for imported symbolic constant vtable entries so they
// can carry attached constants necessary for applying specifics to these
// constants when they are used.