X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=entity.c;h=353c7702a6f7421ce6ad26bffb17e29186df91e3;hb=d7384b0b065dd6195ac6649c4d48a06905bc8fe7;hp=528e3a15d949cc11fe4a8a2f23a4736bf683d0d3;hpb=81877f87c8abb6e39d38622b289ac6f3059f1eb6;p=cparser diff --git a/entity.c b/entity.c index 528e3a1..353c770 100644 --- a/entity.c +++ b/entity.c @@ -45,7 +45,7 @@ const char *get_entity_kind_name(entity_kind_t kind) case ENTITY_NAMESPACE: return "namespace"; } - panic("Invalid entity kind encountered in get_entity_kind_name"); + panic("invalid entity kind"); } /** @@ -57,7 +57,7 @@ static size_t get_entity_struct_size(entity_kind_t kind) { static const size_t sizes[] = { [ENTITY_VARIABLE] = sizeof(variable_t), - [ENTITY_PARAMETER] = sizeof(parameter_t), + [ENTITY_PARAMETER] = sizeof(variable_t), [ENTITY_COMPOUND_MEMBER] = sizeof(compound_member_t), [ENTITY_FUNCTION] = sizeof(function_t), [ENTITY_TYPEDEF] = sizeof(typedef_t), @@ -80,13 +80,14 @@ static size_t get_entity_struct_size(entity_kind_t kind) * * @param kind the kind of the entity to allocate */ -entity_t *allocate_entity_zero(entity_kind_t const kind, entity_namespace_t const namespc, symbol_t *const symbol) +entity_t *allocate_entity_zero(entity_kind_t const kind, entity_namespace_t const namespc, symbol_t *const symbol, source_position_t const *const pos) { - size_t size = get_entity_struct_size(kind); - entity_t *entity = allocate_ast_zero(size); - entity->kind = kind; - entity->base.namespc = namespc; - entity->base.symbol = symbol; + size_t const size = get_entity_struct_size(kind); + entity_t *const entity = allocate_ast_zero(size); + entity->kind = kind; + entity->base.namespc = namespc; + entity->base.symbol = symbol; + entity->base.source_position = *pos; return entity; }