diff options
-rw-r--r-- | src/codegen/mod.rs | 4 | ||||
-rw-r--r-- | src/ir/comp.rs | 21 |
2 files changed, 2 insertions, 23 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index ac28244c..6396e953 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1424,7 +1424,7 @@ impl CodeGenerator for CompInfo { // // FIXME: Once we generate proper vtables, we need to codegen the // vtable, but *not* generate a field for it in the case that - // needs_explicit_vtable is false but has_vtable is true. + // HasVtable::has_vtable_ptr is false but HasVtable::has_vtable is true. // // Also, we need to generate the vtable in such a way it "inherits" from // the parent too. @@ -1434,7 +1434,7 @@ impl CodeGenerator for CompInfo { StructLayoutTracker::new(ctx, self, &canonical_name); if !is_opaque { - if self.needs_explicit_vtable(ctx, item) { + if item.has_vtable_ptr(ctx) { let vtable = Vtable::new(item.id(), self.methods(), self.base_members()); vtable.codegen(ctx, result, item); diff --git a/src/ir/comp.rs b/src/ir/comp.rs index 1227da1d..374dca8d 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -1451,27 +1451,6 @@ impl CompInfo { self.packed } - /// Returns whether this type needs an explicit vtable because it has - /// virtual methods and none of its base classes has already a vtable. - pub fn needs_explicit_vtable( - &self, - ctx: &BindgenContext, - item: &Item, - ) -> bool { - item.has_vtable(ctx) && !self.base_members.iter().any(|base| { - // NB: Ideally, we could rely in all these types being `comp`, and - // life would be beautiful. - // - // Unfortunately, given the way we implement --match-pat, and also - // that you can inherit from templated types, we need to handle - // other cases here too. - ctx.resolve_type(base.ty) - .canonical_type(ctx) - .as_comp() - .map_or(false, |_| base.ty.has_vtable(ctx)) - }) - } - /// Returns true if compound type has been forward declared pub fn is_forward_declaration(&self) -> bool { self.is_forward_declaration |