diff options
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 18 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 18 |
2 files changed, 26 insertions, 10 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 255821e49c8..ed393388c5c 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1782,7 +1782,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) case E_String_Type: case E_Array_Type: { - Entity_Id gnat_index; + Entity_Id gnat_index, gnat_name; const bool convention_fortran_p = (Convention (gnat_entity) == Convention_Fortran); const int ndim = Number_Dimensions (gnat_entity); @@ -2066,8 +2066,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) tem, NULL, !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); - /* Give the fat pointer type a name. */ - create_type_decl (create_concat_name (gnat_entity, "XUP"), + /* Give the fat pointer type a name. If this is a packed type, tell + the debugger how to interpret the underlying bits. */ + if (Present (Packed_Array_Type (gnat_entity))) + gnat_name = Packed_Array_Type (gnat_entity); + else + gnat_name = gnat_entity; + create_type_decl (create_concat_name (gnat_name, "XUP"), gnu_fat_type, NULL, true, debug_info_p, gnat_entity); @@ -2075,16 +2080,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) record type for the object and its template with the field offsets shifted to have the template at a negative offset. */ tem = build_unc_object_type (gnu_template_type, tem, - create_concat_name (gnat_entity, "XUT")); + create_concat_name (gnat_name, "XUT")); shift_unc_components_for_thin_pointers (tem); SET_TYPE_UNCONSTRAINED_ARRAY (tem, gnu_type); TYPE_OBJECT_RECORD_TYPE (gnu_type) = tem; - - /* Give the thin pointer type a name. */ - create_type_decl (create_concat_name (gnat_entity, "XUX"), - build_pointer_type (tem), NULL, true, - debug_info_p, gnat_entity); } break; diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index bd6a840b245..31f24ce0340 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -495,8 +495,12 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) TYPE_NAME (tt) = decl; TREE_USED (tt) = TREE_USED (t); TREE_TYPE (decl) = tt; - DECL_ORIGINAL_TYPE (decl) = t; + if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) + DECL_ORIGINAL_TYPE (decl) = DECL_ORIGINAL_TYPE (TYPE_NAME (t)); + else + DECL_ORIGINAL_TYPE (decl) = t; t = NULL_TREE; + DECL_ARTIFICIAL (decl) = 0; } else if (DECL_ARTIFICIAL (TYPE_NAME (t)) && !DECL_ARTIFICIAL (decl)) ; @@ -3665,6 +3669,18 @@ update_pointer_to (tree old_type, tree new_type) TYPE_POINTER_TO (new_type) = TYPE_REFERENCE_TO (new_type) = TREE_TYPE (new_type) = ptr; + /* And show the original pointer NEW_PTR to the debugger. This is the + counterpart of the equivalent processing in gnat_pushdecl when the + unconstrained array type is frozen after access types to it. Note + that update_pointer_to can be invoked multiple times on the same + couple of types because of the type variants. */ + if (TYPE_NAME (ptr) + && TREE_CODE (TYPE_NAME (ptr)) == TYPE_DECL + && !DECL_ORIGINAL_TYPE (TYPE_NAME (ptr))) + { + DECL_ORIGINAL_TYPE (TYPE_NAME (ptr)) = new_ptr; + DECL_ARTIFICIAL (TYPE_NAME (ptr)) = 0; + } for (var = TYPE_MAIN_VARIANT (ptr); var; var = TYPE_NEXT_VARIANT (var)) SET_TYPE_UNCONSTRAINED_ARRAY (var, new_type); |