-void
-set_type_size_bits(type *tp, int size) {
- assert(tp && tp->kind == k_type);
- /* For pointer enumeration and primitive size depends on the mode.
- Methods don't have a size. */
- if ((tp->type_op != type_pointer) && (tp->type_op != type_primitive) &&
- (tp->type_op != type_enumeration) && (tp->type_op != type_method)) {
- if (tp->type_op == type_primitive)
- tp->size = size;
- else {
- /* argh: we must allow to set negative values as "invalid size" */
- tp->size = (size >= 0) ? (size + 7) & ~7 : size;
- assert(tp->size == size && "setting a bit size is NOT allowed for this type");
+
+visibility get_type_visibility (const ir_type *tp) {
+#if 0
+ visibility res = visibility_local;
+ if (is_compound_type(tp)) {
+
+ if (is_Array_type(tp)) {
+ entity *mem = get_array_element_entity(tp);
+ if (get_entity_visibility(mem) != visibility_local)
+ res = visibility_external_visible;
+ } else {
+ int i, n_mems = get_compound_n_members(tp);
+ for (i = 0; i < n_mems; ++i) {
+ entity *mem = get_compound_member(tp, i);
+ if (get_entity_visibility(mem) != visibility_local)
+ res = visibility_external_visible;
+ }
+ }
+ }
+ return res;
+#endif
+ assert(is_type(tp));
+ return tp->visibility;
+}
+
+void set_type_visibility (ir_type *tp, visibility v) {
+ assert(is_type(tp));
+#if 0
+ /* check for correctness */
+ if (v != visibility_external_allocated) {
+ visibility res = visibility_local;
+ if (is_compound_type(tp)) {
+ if (is_Array_type(tp)) {
+ entity *mem = get_array_element_entity(tp);
+ if (get_entity_visibility(mem) > res)
+ res = get_entity_visibility(mem);
+ } else {
+ int i, n_mems = get_compound_n_members(tp);
+ for (i = 0; i < n_mems; ++i) {
+ entity *mem = get_compound_member(tp, i);
+ if (get_entity_visibility(mem) > res)
+ res = get_entity_visibility(mem);
+ }
+ }