*/
static ir_type *create_atomic_type(const atomic_type_t *type)
{
- dbg_info *dbgi = get_dbg_info(&type->base.source_position);
- atomic_type_kind_t kind = type->akind;
- ir_mode *mode = _atomic_modes[kind];
- ident *id = get_mode_ident(mode);
- ir_type *irtype = new_d_type_primitive(id, mode, dbgi);
+ atomic_type_kind_t kind = type->akind;
+ ir_mode *mode = _atomic_modes[kind];
+ ident *id = get_mode_ident(mode);
+ ir_type *irtype = new_type_primitive(id, mode);
set_type_alignment_bytes(irtype, type->base.alignment);
*/
static ir_type *create_complex_type(const complex_type_t *type)
{
- dbg_info *dbgi = get_dbg_info(&type->base.source_position);
- atomic_type_kind_t kind = type->akind;
- ir_mode *mode = _atomic_modes[kind];
- ident *id = get_mode_ident(mode);
+ atomic_type_kind_t kind = type->akind;
+ ir_mode *mode = _atomic_modes[kind];
+ ident *id = get_mode_ident(mode);
(void) id;
- (void) dbgi;
/* FIXME: finish the array */
return NULL;
*/
static ir_type *create_imaginary_type(const imaginary_type_t *type)
{
- dbg_info *dbgi = get_dbg_info(&type->base.source_position);
atomic_type_kind_t kind = type->akind;
ir_mode *mode = _atomic_modes[kind];
ident *id = get_mode_ident(mode);
- ir_type *irtype = new_d_type_primitive(id, mode, dbgi);
+ ir_type *irtype = new_type_primitive(id, mode);
set_type_alignment_bytes(irtype, type->base.alignment);
ident *id = id_unique("functiontype.%u");
int n_parameters = count_parameters(function_type);
int n_results = return_type == type_void ? 0 : 1;
- dbg_info *dbgi = get_dbg_info(&function_type->base.source_position);
- ir_type *irtype = new_d_type_method(id, n_parameters, n_results, dbgi);
+ ir_type *irtype = new_type_method(id, n_parameters, n_results);
if (return_type != type_void) {
ir_type *restype = get_ir_type(return_type);
case CC_THISCALL:
/* Hmm, leave default, not accepted by the parser yet. */
- warningf(&function_type->base.source_position, "THISCALL calling convention not supported yet");
break;
}
return irtype;
{
type_t *points_to = type->points_to;
ir_type *ir_points_to = get_ir_type_incomplete(points_to);
- dbg_info *dbgi = get_dbg_info(&type->base.source_position);
- ir_type *ir_type = new_d_type_pointer(id_unique("pointer.%u"),
- ir_points_to, mode_P_data, dbgi);
+ ir_type *ir_type = new_type_pointer(id_unique("pointer.%u"),
+ ir_points_to, mode_P_data);
return ir_type;
}
ir_type *ir_element_type = get_ir_type(element_type);
ident *id = id_unique("array.%u");
- dbg_info *dbgi = get_dbg_info(&type->base.source_position);
- ir_type *ir_type = new_d_type_array(id, 1, ir_element_type, dbgi);
+ ir_type *ir_type = new_type_array(id, 1, ir_element_type);
const int align = get_type_alignment_bytes(ir_element_type);
set_type_alignment_bytes(ir_type, align);
id = id_unique("__anonymous_struct.%u");
}
}
- dbg_info *dbgi = get_dbg_info(&type->base.source_position);
+ dbg_info *dbgi = get_dbg_info(&declaration->source_position);
if (is_union) {
irtype = new_d_type_union(id, dbgi);
((void)(current_parent = (stmt)))
#define POP_PARENT ((void)(current_parent = prev_parent))
-static source_position_t null_position = { NULL, 0 };
-
/** special symbol used for anonymous entities. */
static const symbol_t *sym_anonymous = NULL;
* fields with zero.
*
* @param kind type kind to allocate
- * @param source_position the source position of the type definition
*/
-static type_t *allocate_type_zero(type_kind_t kind, const source_position_t *source_position)
+static type_t *allocate_type_zero(type_kind_t kind)
{
size_t size = get_type_struct_size(kind);
type_t *res = obstack_alloc(type_obst, size);
memset(res, 0, size);
+ res->base.kind = kind;
- res->base.kind = kind;
- res->base.source_position = *source_position;
return res;
}
record_declaration(declaration, false);
- type_t *typedef_type = allocate_type_zero(TYPE_TYPEDEF, &builtin_source_position);
+ type_t *typedef_type = allocate_type_zero(TYPE_TYPEDEF);
typedef_type->typedeft.declaration = declaration;
return typedef_type;
declaration->parent_scope = scope;
}
- type_t *const type = allocate_type_zero(TYPE_ENUM, &declaration->source_position);
+ type_t *const type = allocate_type_zero(TYPE_ENUM);
type->enumt.declaration = declaration;
if (token.type == '{') {
rem_anchor_token(')');
expect(')');
- type_t *typeof_type = allocate_type_zero(TYPE_TYPEOF, &expression->base.source_position);
+ type_t *typeof_type = allocate_type_zero(TYPE_TYPEOF);
typeof_type->typeoft.expression = expression;
typeof_type->typeoft.typeof_type = type;
static type_t *create_builtin_type(symbol_t *const symbol,
type_t *const real_type)
{
- type_t *type = allocate_type_zero(TYPE_BUILTIN, &builtin_source_position);
+ type_t *type = allocate_type_zero(TYPE_BUILTIN);
type->builtin.symbol = symbol;
type->builtin.real_type = real_type;
declaration->storage_class != STORAGE_CLASS_TYPEDEF)
return NULL;
- type_t *type = allocate_type_zero(TYPE_TYPEDEF, &declaration->source_position);
+ type_t *type = allocate_type_zero(TYPE_TYPEDEF);
type->typedeft.declaration = declaration;
return type;
break;
case T_struct: {
- type = allocate_type_zero(TYPE_COMPOUND_STRUCT, HERE);
+ type = allocate_type_zero(TYPE_COMPOUND_STRUCT);
type->compound.declaration = parse_compound_type_specifier(true);
finish_struct_type(&type->compound);
break;
}
case T_union: {
- type = allocate_type_zero(TYPE_COMPOUND_UNION, HERE);
+ type = allocate_type_zero(TYPE_COMPOUND_UNION);
type->compound.declaration = parse_compound_type_specifier(false);
if (type->compound.declaration->modifiers & DM_TRANSPARENT_UNION)
modifiers |= TYPE_MODIFIER_TRANSPARENT_UNION;
declaration_t *const decl =
create_error_declaration(token.v.symbol, STORAGE_CLASS_TYPEDEF);
- type = allocate_type_zero(TYPE_TYPEDEF, HERE);
+ type = allocate_type_zero(TYPE_TYPEDEF);
type->typedeft.declaration = decl;
next_token();
}
if (type_specifiers & SPECIFIER_COMPLEX) {
- type = allocate_type_zero(TYPE_COMPLEX, &builtin_source_position);
+ type = allocate_type_zero(TYPE_COMPLEX);
type->complex.akind = atomic_type;
} else if (type_specifiers & SPECIFIER_IMAGINARY) {
- type = allocate_type_zero(TYPE_IMAGINARY, &builtin_source_position);
+ type = allocate_type_zero(TYPE_IMAGINARY);
type->imaginary.akind = atomic_type;
} else {
- type = allocate_type_zero(TYPE_ATOMIC, &builtin_source_position);
+ type = allocate_type_zero(TYPE_ATOMIC);
type->atomic.akind = atomic_type;
}
newtype = true;
{
type_t *type;
if (declaration != NULL) {
- type = allocate_type_zero(TYPE_FUNCTION, &declaration->source_position);
+ type = allocate_type_zero(TYPE_FUNCTION);
unsigned mask = declaration->modifiers & (DM_CDECL|DM_STDCALL|DM_FASTCALL|DM_THISCALL);
else if (declaration->modifiers & DM_THISCALL)
type->function.calling_convention = CC_THISCALL;
} else {
- type = allocate_type_zero(TYPE_FUNCTION, HERE);
+ type = allocate_type_zero(TYPE_FUNCTION);
}
declaration_t *last;
case CONSTRUCT_ARRAY: {
parsed_array_t *parsed_array = (parsed_array_t*) iter;
- type_t *array_type = allocate_type_zero(TYPE_ARRAY, &null_position);
+ type_t *array_type = allocate_type_zero(TYPE_ARRAY);
expression_t *size_expression = parsed_array->size;
if (size_expression != NULL) {
source_position_t *source_position,
const symbol_t *symbol)
{
- type_t *type = allocate_type_zero(TYPE_BITFIELD, source_position);
+ type_t *type = allocate_type_zero(TYPE_BITFIELD);
type->bitfield.base_type = base_type;
type->bitfield.size_expression = size;
static declaration_t *create_implicit_function(symbol_t *symbol,
const source_position_t *source_position)
{
- type_t *ntype = allocate_type_zero(TYPE_FUNCTION, source_position);
+ type_t *ntype = allocate_type_zero(TYPE_FUNCTION);
ntype->function.return_type = type_int;
ntype->function.unspecified_parameters = true;
parameter1->type = argument_type1;
parameter1->next = parameter2;
- type_t *type = allocate_type_zero(TYPE_FUNCTION, &builtin_source_position);
+ type_t *type = allocate_type_zero(TYPE_FUNCTION);
type->function.return_type = return_type;
type->function.parameters = parameter1;
memset(parameter, 0, sizeof(parameter[0]));
parameter->type = argument_type;
- type_t *type = allocate_type_zero(TYPE_FUNCTION, &builtin_source_position);
+ type_t *type = allocate_type_zero(TYPE_FUNCTION);
type->function.return_type = return_type;
type->function.parameters = parameter;
static type_t *make_function_0_type(type_t *return_type)
{
- type_t *type = allocate_type_zero(TYPE_FUNCTION, &builtin_source_position);
+ type_t *type = allocate_type_zero(TYPE_FUNCTION);
type->function.return_type = return_type;
type->function.parameters = NULL;
type_wchar_t_ptr = make_pointer_type(type_wchar_t, TYPE_QUALIFIER_NONE);
/* const version of wchar_t */
- type_const_wchar_t = allocate_type_zero(TYPE_TYPEDEF, &builtin_source_position);
+ type_const_wchar_t = allocate_type_zero(TYPE_TYPEDEF);
type_const_wchar_t->typedeft.declaration = type_wchar_t->typedeft.declaration;
type_const_wchar_t->base.qualifiers |= TYPE_QUALIFIER_CONST;