diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-06-01 08:41:30 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-06-01 08:41:30 +0000 |
commit | bd769c83256714df9ed384c4ce63e37bd0ffac62 (patch) | |
tree | dc7fc44be39b5f4067e5fcb36e19b514e68f85d6 /gcc/ada | |
parent | 2b50232a5df3dd82d389c4dbcd48940e308605e4 (diff) | |
download | gcc-bd769c83256714df9ed384c4ce63e37bd0ffac62.zip gcc-bd769c83256714df9ed384c4ce63e37bd0ffac62.tar.gz gcc-bd769c83256714df9ed384c4ce63e37bd0ffac62.tar.bz2 |
decl.c (gnat_to_gnu_entity): For a definition of a type coming from a limited_with...
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Incomplete_Type>: For a
definition of a type coming from a limited_with, get to the full view
if it is not in the main code unit.
From-SVN: r223919
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a618372..fe91cc4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,11 @@ 2015-06-01 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Incomplete_Type>: For a + definition of a type coming from a limited_with, get to the full view + if it is not in the main code unit. + +2015-06-01 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/utils.c (create_var_decl_1): If an assembler name is specified, let the target mangle it before settting. (create_subprog_decl): Likewise and move this treatment last. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 21f5f70..35930e0 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4638,13 +4638,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) case E_Record_Type_With_Private: case E_Record_Subtype_With_Private: { + bool is_from_limited_with + = (IN (kind, Incomplete_Kind) && From_Limited_With (gnat_entity)); /* Get the "full view" of this entity. If this is an incomplete entity from a limited with, treat its non-limited view as the full view. Otherwise, use either the full view or the underlying full view, whichever is present. This is used in all the tests below. */ Entity_Id full_view - = (IN (kind, Incomplete_Kind) && From_Limited_With (gnat_entity)) + = is_from_limited_with ? Non_Limited_View (gnat_entity) : Present (Full_View (gnat_entity)) ? Full_View (gnat_entity) @@ -4680,10 +4682,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Otherwise, if we are not defining the type now, get the type from the full view. But always get the type from the full view - for define on use types, since otherwise we won't see them! */ + for define on use types, since otherwise we won't see them. + Likewise if this is a non-limited view not declared in the main + unit, which can happen for incomplete formal types instantiated + on a type coming from a limited_with clause. */ else if (!definition || (Is_Itype (full_view) && No (Freeze_Node (gnat_entity))) - || (Is_Itype (gnat_entity) && No (Freeze_Node (full_view)))) + || (Is_Itype (gnat_entity) && No (Freeze_Node (full_view))) + || (is_from_limited_with + && !In_Extended_Main_Code_Unit (full_view))) { gnu_decl = gnat_to_gnu_entity (full_view, NULL_TREE, 0); maybe_present = true; |