[CLASSES]: Add a ->declaration member to struct class

For cases where the compiler doesn't emits the whole struct definition for
things like base classes that don't have any of its members acessed, just the
ones in its descendants.

Will be used to avoid emiting hole anottations, since we don't have the
size of these classes we can't say if its smaller than the space allocated
by the compiler.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2006-12-07 20:54:45 -02:00
parent 9d21d3d72d
commit b45b9f6a95
2 changed files with 8 additions and 2 deletions

View File

@ -582,7 +582,8 @@ static struct label *label__new(uint64_t id, uint64_t type,
static struct class *class__new(const unsigned int tag,
uint64_t id, uint64_t type,
const char *name, uint64_t size,
const char *decl_file, unsigned int decl_line)
const char *decl_file, unsigned int decl_line,
unsigned char declaration)
{
struct class *self = zalloc(sizeof(*self));
@ -591,6 +592,7 @@ static struct class *class__new(const unsigned int tag,
INIT_LIST_HEAD(&self->members);
self->size = size;
self->name = strings__add(name);
self->declaration = declaration;
}
return self;
@ -1272,6 +1274,8 @@ static uint64_t attr_numeric(Dwarf_Die *die, unsigned int name)
if (dwarf_formref(&attr, &ref) == 0)
return (uintmax_t)ref;
}
case DW_FORM_flag:
return 1;
default:
printf("DW_AT_<0x%x>=0x%x\n", name, form);
break;
@ -1291,7 +1295,8 @@ static void cu__create_new_class(Dwarf *dwarf, Dwarf_Die *die, struct cu *cu,
Dwarf_Die child;
uint64_t size = attr_numeric(die, DW_AT_byte_size);
struct class *class = class__new(tag, cu_offset, type, name, size,
decl_file, decl_line);
decl_file, decl_line,
attr_numeric(die, DW_AT_declaration));
if (class == NULL)
oom("class__new");
if (dwarf_haschildren(die) != 0 && dwarf_child(die, &child) == 0)

View File

@ -61,6 +61,7 @@ struct class {
unsigned int refcnt;
signed int diff;
struct class *class_to_diff;
unsigned char declaration:1;
};
struct class_member {