#include <stdbool.h>
+#include <libfirm/firm_types.h>
+
#include "type.h"
#include "symbol.h"
#include "token_t.h"
TYPE_COMPOUND_STRUCT,
TYPE_COMPOUND_UNION,
TYPE_ENUM,
- TYPE_METHOD,
+ TYPE_FUNCTION,
TYPE_POINTER,
TYPE_ARRAY,
TYPE_BUILTIN,
TYPE_TYPEOF
} type_type_t;
+/* note that the constant values represent the rank of the types as defined
+ * in ยง 6.3.1 */
typedef enum {
- ATOMIC_TYPE_INVALID,
+ ATOMIC_TYPE_INVALID = 0,
ATOMIC_TYPE_VOID,
ATOMIC_TYPE_CHAR,
ATOMIC_TYPE_SCHAR,
} atomic_type_type_t;
typedef enum {
+ TYPE_QUALIFIER_NONE = 0,
TYPE_QUALIFIER_CONST = 1 << 0,
TYPE_QUALIFIER_RESTRICT = 1 << 1,
TYPE_QUALIFIER_VOLATILE = 1 << 2,
- TYPE_QUALIFIER_INLINE = 1 << 3,
} type_qualifier_t;
struct type_t {
type_type_t type;
type_qualifier_t qualifiers;
+
+ ir_type *firm_type;
};
struct atomic_type_t {
struct builtin_type_t {
type_t type;
symbol_t *symbol;
+ type_t *real_type;
};
struct pointer_type_t {
expression_t *size;
};
-struct method_parameter_t {
- type_t *type;
- method_parameter_t *next;
+struct function_parameter_t {
+ type_t *type;
+ function_parameter_t *next;
};
-struct method_type_t {
- type_t type;
- type_t *result_type;
- method_parameter_t *parameters;
- bool variadic;
- bool unspecified_parameters;
+struct function_type_t {
+ type_t type;
+ type_t *result_type;
+ function_parameter_t *parameters;
+ bool variadic;
+ bool unspecified_parameters;
};
struct compound_type_t {
type_t type;
- /** the declaration of the compound type, it's context field
+ /** the declaration of the compound type, its context field
* contains the compound entries. */
declaration_t *declaration;
};