mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user