mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Import C++ vtables (#7174)
This correctly renders the vtable in SemIR, including allowing overrides in Carbon-derived-from-C++ classes. It doesn't work in lowering because clang walks the methods of the CXXRecordDecl - and we currently don't export anything into the CXXRecordDecl's methods (we do export the fields) - so that's next. This also doesn't teach Clang to affirmatively emit the vtable regardless of the types use in C++ code - or to have Carbon use the vtable in an object's initialization.
This commit is contained in:
@@ -709,6 +709,9 @@ auto FileContext::GetLocForDI(SemIR::InstId inst_id) -> Context::LocForDI {
|
||||
auto FileContext::BuildVtable(const SemIR::Vtable& vtable,
|
||||
SemIR::SpecificId specific_id)
|
||||
-> llvm::GlobalVariable* {
|
||||
if (!vtable.carbon_native_vtable) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto& class_info = sem_ir().classes().Get(vtable.class_id);
|
||||
|
||||
SemIR::Mangler m(sem_ir(), context().total_ir_count());
|
||||
|
||||
Reference in New Issue
Block a user