}
struct declaration_struct *
- struct_declaration_new(struct declaration_scope *parent_scope)
+ struct_declaration_new(struct declaration_scope *parent_scope,
+ uint64_t min_align)
{
struct declaration_struct *struct_declaration;
struct declaration *declaration;
DEFAULT_NR_STRUCT_FIELDS);
struct_declaration->scope = new_declaration_scope(parent_scope);
declaration->id = CTF_TYPE_STRUCT;
- declaration->alignment = 1;
+ declaration->alignment = max(1, min_align);
declaration->declaration_free = _struct_declaration_free;
declaration->definition_new = _struct_definition_new;
declaration->definition_free = _struct_definition_free;
_struct->p.ref = 1;
_struct->p.index = index;
_struct->p.name = field_name;
+ _struct->p.path = new_definition_path(parent_scope, field_name);
_struct->scope = new_definition_scope(parent_scope, field_name);
_struct->fields = g_ptr_array_sized_new(DEFAULT_NR_STRUCT_FIELDS);
g_ptr_array_set_size(_struct->fields, struct_declaration->fields->len);
return NULL;
return g_ptr_array_index(_struct->fields, index);
}
+
+uint64_t struct_declaration_len(struct declaration_struct *struct_declaration)
+{
+ return struct_declaration->fields->len;
+}