Adjust the offsets of ivars in derived classes.

As ivar structs are not independent, their starting offset is not
necessarily zero (almost never will be for derived classes).
This commit is contained in:
Bill Currie 2011-02-09 22:02:52 +09:00
parent d66a441867
commit 1b8edc07c9

View file

@ -870,6 +870,13 @@ class_new_ivars (class_t *class)
void
class_add_ivars (class_t *class, symtab_t *ivars)
{
int base = 0;
symbol_t *sym;
if (class->super_class)
base = type_size (class->super_class->type);
for (sym = ivars->symbols; sym; sym = sym->next)
sym->s.offset += base;
class->ivars = ivars;
}