]> gcc.gnu.org Git - gcc.git/commit - gcc/ada/sem_ch3.adb
[Ada] Fix spurious error on limited view with incomplete type
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 3 Mar 2022 14:57:47 +0000 (15:57 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:02 +0000 (08:42 +0000)
commit82ca7489e71d4792b5f242c144bc5bf7b4c4b2c6
treeb7a80fd7c422df5635623b84f3c04289a87d84cb
parent4e8b88f36ce705d20dddc86f999539cc854ef401
[Ada] Fix spurious error on limited view with incomplete type

The problem is that Install_Limited_With_Clause does not fully implement
AI05-0129, in the case where a regular with clause is processed before a
limited_with clause of the same package: the visible "shadow" entity is
that of the incomplete type, instead of that of the full type per the AI.

This requires adjusting Remove_Limited_With_Unit to match the change in
Install_Limited_With_Clause and also Build_Incomplete_Type_Declaration,
which is responsible for synthesizing incomplete types out of full type
declarations for self-referential types.

A small tweak is also needed in Analyze_Subprogram_Body_Helper to align
it with an equivalent processing for CW types in Find_Type_Name. And the
patch also changes the Incomplete_View field in full type declarations
to point to the entity of the view instead of its declaration.

gcc/ada/

* exp_ch3.adb (Build_Assignment): Adjust to the new definition of
Incomplete_View field.
* sem_ch10.ads (Decorate_Type): Declare.
* sem_ch10.adb (Decorate_Type): Move to library level.
(Install_Limited_With_Clause): In the already analyzed case, also
deal with incomplete type declarations present in the sources and
simplify the replacement code.
(Build_Shadow_Entity): Deal with swapped views in package body.
(Restore_Chain_For_Shadow): Deal with incomplete type declarations
present in the sources.
* sem_ch3.adb (Analyze_Full_Type_Declaration): Adjust to the new
definition of Incomplete_View field.
(Build_Incomplete_Type_Declaration): Small consistency tweak.
Set the incomplete type as the Incomplete_View of the full type.
If the scope is a package with a limited view, build a shadow
entity for the incomplete type.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): When replacing
the limited view of a CW type as designated type of an anonymous
access return type, get to the CW type of the incomplete view of
the tagged type, if any.
(Collect_Primitive_Operations): Adjust to the new definition of
Incomplete_View field.
* sinfo.ads (Incomplete_View): Denote the entity itself instead
of its declaration.
* sem_util.adb: Remove call to Defining_Entity.
gcc/ada/exp_ch3.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch10.ads
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_util.adb
gcc/ada/sinfo.ads
This page took 0.062982 seconds and 5 git commands to generate.