/* no overwriting methods found */
arr = NULL;
} else {
- ir_entity * ent;
arr = NEW_ARR_F(ir_entity *, size);
- foreach_pset(set, ir_entity*, ent) {
+ foreach_pset(set, ir_entity, ent) {
arr[--size] = ent;
}
}
static ir_entity ** get_Sel_arr(ir_node * sel)
{
static ir_entity ** NULL_ARRAY = NULL;
- ir_entity * ent;
- ir_entity ** arr;
-
- assert(is_Sel(sel));
- ent = get_Sel_entity(sel);
+ ir_entity *const ent = get_Sel_entity(sel);
assert(is_Method_type(get_entity_type(ent))); /* what else? */
- arr = (ir_entity**) get_entity_link(ent);
+
+ ir_entity **const arr = (ir_entity**)get_entity_link(ent);
if (arr) {
return arr;
} else {
if (ent->initializer != NULL) {
add_method_address_inititializer(get_entity_initializer(ent), set);
- } else if (entity_has_compound_ent_values(ent)) {
- size_t i, n;
- for (i = 0, n = get_compound_ent_n_values(ent); i < n; ++i) {
- ir_node *irn = get_compound_ent_value(ent, i);
-
- /* let's check if it's the address of a function */
- if (is_SymConst_addr_ent(irn)) {
- ir_entity *ent2 = get_SymConst_entity(irn);
-
- if (is_Method_type(get_entity_type(ent2)))
- pset_insert_ptr(set, ent2);
- }
- }
}
}
pset *free_set = pset_new_ptr_default();
size_t i, n, j, m;
ir_entity **arr;
- ir_entity *ent;
ir_graph *irg;
ir_type *tp;
size_t length;
for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
ir_linkage linkage;
irg = get_irp_irg(i);
- ent = get_irg_entity(irg);
+ ir_entity *const ent = get_irg_entity(irg);
linkage = get_entity_linkage(ent);
if ((linkage & IR_LINKAGE_HIDDEN_USER) || entity_is_externally_visible(ent)) {
/* insert all methods that are used in global variables initializers */
tp = get_glob_type();
for (j = 0, m = get_class_n_members(tp); j < m; ++j) {
- ent = get_class_member(tp, j);
+ ir_entity *const ent = get_class_member(tp, j);
add_method_address(ent, free_set);
}
tp = get_tls_type();
for (j = 0, m = get_compound_n_members(tp); j < m; ++j) {
- ent = get_compound_member(tp, j);
+ ir_entity *const ent = get_compound_member(tp, j);
add_method_address(ent, free_set);
}
length = pset_count(free_set);
arr = XMALLOCN(ir_entity*, length);
i = 0;
- foreach_pset(free_set, ir_entity*, ent) {
+ foreach_pset(free_set, ir_entity, ent) {
arr[i++] = ent;
}
del_pset(free_set);
if (is_Tuple(pred)) {
callee_ana_proj(get_Tuple_pred(pred, get_Proj_proj(node)), n, methods);
} else {
- pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */
+ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
}
}
break;
break;
default:
- pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */
+ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
break;
}
}
case iro_Const:
/* A direct address call. We tread this as an external
call and ignore it completely. */
- pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */
+ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
break;
case iro_SymConst: {
if (ent != NULL) {
pset_insert_ptr(methods, ent);
} else {
- pset_insert_ptr(methods, unknown_entity);
+ pset_insert_ptr(methods, get_unknown_entity());
}
}
break;
case iro_Sub:
case iro_Conv:
/* extern */
- pset_insert_ptr(methods, unknown_entity); /* free method -> unknown */
+ pset_insert_ptr(methods, get_unknown_entity()); /* free method -> unknown */
break;
default:
(void) env;
if (is_Call(call)) {
pset *methods = pset_new_ptr_default();
- ir_entity *ent;
ir_entity **arr;
size_t i;
callee_ana_node(get_Call_ptr(call), methods);
arr = NEW_ARR_F(ir_entity*, pset_count(methods));
i = 0;
- foreach_pset(methods, ir_entity*, ent) {
+ foreach_pset(methods, ir_entity, ent) {
arr[i] = ent;
/* we want the unknown_entity on the zero position for easy tests later */
- if (ent == unknown_entity) {
+ if (is_unknown_entity(ent)) {
arr[i] = arr[0];
- arr[0] = unknown_entity;
+ arr[0] = get_unknown_entity();
}
++i;
}
/** Frees intermediate data structures. */
static void sel_methods_dispose(void)
{
- ir_entity * ent;
assert(entities);
- foreach_pset(entities, ir_entity*, ent) {
+ foreach_pset(entities, ir_entity, ent) {
ir_entity **arr = (ir_entity**) get_entity_link(ent);
if (arr != NULL) {
DEL_ARR_F(arr);