diff options
| author | Eric Botcazou <ebotcazou@adacore.com> | 2012-07-19 15:44:00 +0000 |
|---|---|---|
| committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2012-07-19 15:44:00 +0000 |
| commit | 638eeae8042febc7cf5b01b9330558543e874f58 (patch) | |
| tree | 0267038b3e69b3d7fa32dd94de5363494d3bd72a /gcc/ada/gcc-interface/decl.c | |
| parent | 9786913b86c31058adf21f8f093a672b9c0170de (diff) | |
| download | gcc-638eeae8042febc7cf5b01b9330558543e874f58.zip gcc-638eeae8042febc7cf5b01b9330558543e874f58.tar.gz gcc-638eeae8042febc7cf5b01b9330558543e874f58.tar.bz2 | |
decl.c (gnat_to_gnu_entity): Do not look up the REP part of the base type in advance.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Do not
look up the REP part of the base type in advance. Deal with that of
the variant types.
(get_rep_part): Be prepared for record types with fields.
From-SVN: r189666
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
| -rw-r--r-- | gcc/ada/gcc-interface/decl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ef7c87c..2aa20e7 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -3287,9 +3287,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) else gnu_unpad_base_type = gnu_base_type; - /* Look for a REP part in the base type. */ - gnu_rep_part = get_rep_part (gnu_unpad_base_type); - /* Look for a variant part in the base type. */ gnu_variant_part = get_variant_part (gnu_unpad_base_type); @@ -3415,7 +3412,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) and put the field either in the new type if there is a selected variant or in one of the new variants. */ if (gnu_context == gnu_unpad_base_type - || (gnu_rep_part + || ((gnu_rep_part = get_rep_part (gnu_unpad_base_type)) && gnu_context == TREE_TYPE (gnu_rep_part))) gnu_cont_type = gnu_type; else @@ -3425,7 +3422,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) t = NULL_TREE; FOR_EACH_VEC_ELT (variant_desc, gnu_variant_list, i, v) - if (v->type == gnu_context) + if (gnu_context == v->type + || ((gnu_rep_part = get_rep_part (v->type)) + && gnu_context == TREE_TYPE (gnu_rep_part))) { t = v->type; break; @@ -8172,7 +8171,8 @@ get_rep_part (tree record_type) /* The REP part is the first field, internal, another record, and its name starts with an 'R'. */ - if (DECL_INTERNAL_P (field) + if (field + && DECL_INTERNAL_P (field) && TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE && IDENTIFIER_POINTER (DECL_NAME (field)) [0] == 'R') return field; |
