**
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
# include <stdlib.h>
+# include <stddef.h>
# include "entity_t.h"
# include "entity.h"
# include "mangle.h"
res->visit = 0;
- switch (get_kind(owner)) {
- case k_type_class: {
- add_class_member ((type_class *) owner, res);
+ switch (get_type_tpop_code(owner)) {
+ case tpo_class: {
+ add_class_member (owner, res);
} break;
- case k_type_strct: {
- add_strct_member ((type_strct *) owner, res);
+ case tpo_struct: {
+ add_struct_member (owner, res);
} break;
- case k_type_union: {
- /* not implemented */
+ case tpo_union: {
+ add_union_member (owner, res);
} break;
- case k_type_method: {
- /* not implemented */
+ case tpo_array: {
+ set_array_element_entity(owner, res);
} break;
- default: ;
+ default: assert(0);
}
return res;
}
-#if 0
-inline char *
+inline const char *
get_entity_name (entity *ent) {
assert (ent);
return id_to_str(get_entity_ident(ent));
- /* GL:
- entity.c:52: warning: return discards `const' from pointer target type
- -- ned so guud
- */
}
-#endif
ident *
get_entity_ident (entity *ent) {
inline void /* should this go into type.c? */
assert_legal_owner_of_ent(type *owner) {
- assert (owner->clss.kind == k_type_class ||
- owner->uni.kind == k_type_union ||
- owner->array.kind == k_type_array ||
- owner->method.kind == k_type_method );
+ assert (get_type_tpop_code(owner) == tpo_class ||
+ get_type_tpop_code(owner) == tpo_union ||
+ get_type_tpop_code(owner) == tpo_struct ||
+ get_type_tpop_code(owner) == tpo_array); /* Yes, array has an entity
+ -- to select fields! */
}
inline ident *
ent->type = type;
}
+inline int
+get_entity_offset (entity *ent) {
+ return ent->offset;
+}
+
+inline void
+set_entity_offset (entity *ent, int offset) {
+ ent->offset = offset;
+}
+
inline ir_graph *
get_entity_irg(entity *ent) {
assert (ent);
- assert (get_kind(ent->type) == k_type_method);
+ assert (is_method_type(ent->type));
return ent->irg;
}
set_entity_irg(entity *ent, ir_graph *irg) {
assert (ent && ent->type);
assert (irg);
- assert (get_kind(ent->type) == k_type_method);
+ assert (is_method_type(ent->type));
ent->irg = irg;
}