Commit 59f5c969 by Eric Botcazou Committed by Eric Botcazou

decl.c (gnat_to_gnu_entity): Remove obsolete code for type_annotate_only mode...

	* gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Component>: Remove
	obsolete code for type_annotate_only mode, simplify code and slightly
	improve wording of comments.

From-SVN: r206794
parent 621955cb
2014-01-20 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Component>: Remove
obsolete code for type_annotate_only mode, simplify code and slightly
improve wording of comments.
2014-01-12 Eric Botcazou <ebotcazou@adacore.com> 2014-01-12 Eric Botcazou <ebotcazou@adacore.com>
PR ada/59772 PR ada/59772
......
...@@ -491,19 +491,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -491,19 +491,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
run-time library. */ run-time library. */
goto object; goto object;
case E_Discriminant:
case E_Component: case E_Component:
case E_Discriminant:
{ {
/* The GNAT record where the component was defined. */ /* The GNAT record where the component was defined. */
Entity_Id gnat_record = Underlying_Type (Scope (gnat_entity)); Entity_Id gnat_record = Underlying_Type (Scope (gnat_entity));
/* If the variable is an inherited record component (in the case of /* If the entity is an inherited component (in the case of extended
extended record types), just return the inherited entity, which tagged record types), just return the original entity, which must
must be a FIELD_DECL. Likewise for discriminants. be a FIELD_DECL. Likewise for discriminants. If the entity is a
For discriminants of untagged records which have explicit non-girder discriminant (in the case of derived untagged record
stored discriminants, return the entity for the corresponding types), return the stored discriminant it renames. */
stored discriminant. Also use Original_Record_Component
if the record has a private extension. */
if (Present (Original_Record_Component (gnat_entity)) if (Present (Original_Record_Component (gnat_entity))
&& Original_Record_Component (gnat_entity) != gnat_entity) && Original_Record_Component (gnat_entity) != gnat_entity)
{ {
...@@ -514,18 +512,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -514,18 +512,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
break; break;
} }
/* If the enclosing record has explicit stored discriminants, /* If this is a discriminant of an extended tagged type used to rename
then it is an untagged record. If the Corresponding_Discriminant a discriminant of the parent type, return the latter. */
is not empty then this must be a renamed discriminant and its else if (Present (Corresponding_Discriminant (gnat_entity)))
Original_Record_Component must point to the corresponding explicit
stored discriminant (i.e. we should have taken the previous
branch). */
else if (Present (Corresponding_Discriminant (gnat_entity))
&& Is_Tagged_Type (gnat_record))
{ {
/* A tagged record has no explicit stored discriminants. */ /* If the derived type is untagged, then this is a non-girder
gcc_assert (First_Discriminant (gnat_record) discriminant and its Original_Record_Component must point to
== First_Stored_Discriminant (gnat_record)); the stored discriminant it renames (i.e. we should have taken
the previous branch). */
gcc_assert (Is_Tagged_Type (gnat_record));
gnu_decl gnu_decl
= gnat_to_gnu_entity (Corresponding_Discriminant (gnat_entity), = gnat_to_gnu_entity (Corresponding_Discriminant (gnat_entity),
gnu_expr, definition); gnu_expr, definition);
...@@ -533,26 +529,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -533,26 +529,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
break; break;
} }
else if (Present (CR_Discriminant (gnat_entity))
&& type_annotate_only)
{
gnu_decl = gnat_to_gnu_entity (CR_Discriminant (gnat_entity),
gnu_expr, definition);
saved = true;
break;
}
/* If the enclosing record has explicit stored discriminants, then
it is an untagged record. If the Corresponding_Discriminant
is not empty then this must be a renamed discriminant and its
Original_Record_Component must point to the corresponding explicit
stored discriminant (i.e. we should have taken the first
branch). */
else if (Present (Corresponding_Discriminant (gnat_entity))
&& (First_Discriminant (gnat_record)
!= First_Stored_Discriminant (gnat_record)))
gcc_unreachable ();
/* Otherwise, if we are not defining this and we have no GCC type /* Otherwise, if we are not defining this and we have no GCC type
for the containing record, make one for it. Then we should for the containing record, make one for it. Then we should
have made our own equivalent. */ have made our own equivalent. */
...@@ -586,7 +562,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -586,7 +562,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
else else
/* Here we have no GCC type and this is a reference rather than a /* Here we have no GCC type and this is a reference rather than a
definition. This should never happen. Most likely the cause is definition. This should never happen. Most likely the cause is
reference before declaration in the gnat tree for gnat_entity. */ reference before declaration in the GNAT tree for gnat_entity. */
gcc_unreachable (); gcc_unreachable ();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment