diff options
author | Bob Duff <duff@adacore.com> | 2023-02-06 11:58:52 -0500 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-22 10:44:10 +0200 |
commit | af1914998dcfb9908afe85b2275fd9868d689db9 (patch) | |
tree | dba795b83a20021408187e8bb20c63a38d573819 /gcc/ada/sem_ch6.adb | |
parent | 472f4cb52ac6f47926a19eb2c53cd848fa6b3730 (diff) | |
download | gcc-af1914998dcfb9908afe85b2275fd9868d689db9.zip gcc-af1914998dcfb9908afe85b2275fd9868d689db9.tar.gz gcc-af1914998dcfb9908afe85b2275fd9868d689db9.tar.bz2 |
ada: Add Is_Past_Self_Hiding_Point flag
This patch adds a flag Is_Past_Self_Hiding_Point. When False,
this will replace E_Void as the indicator for a premature use of
a declaration within itself -- for example, "X : T := X;".
One might think this flag should be called something like
Is_Hidden_From_All_Visibility, reversing the sense of
Is_Past_Self_Hiding_Point. We don't do that because we want
Is_Past_Self_Hiding_Point to be initially False by default (and we have
no mechanism for defaulting to True), and because it doesn't exactly
match the RM definition of "hidden from all visibility" (for
example, for record components).
This is work in progress; more changes are needed before we
can remove all Mutate_Ekind(..., E_Void).
gcc/ada/
* einfo.ads (Is_Past_Self_Hiding_Point): Document.
* gen_il-fields.ads (Is_Past_Self_Hiding_Point): Add to list of
fields.
* gen_il-gen-gen_entities.adb (Is_Past_Self_Hiding_Point): Declare
in all entities.
* exp_aggr.adb: Set Is_Past_Self_Hiding_Point as appropriate.
* sem.adb: Likewise.
* sem_aggr.adb: Likewise.
* sem_ch11.adb: Likewise.
* sem_ch12.adb: Likewise.
* sem_ch5.adb: Likewise.
* sem_ch7.adb: Likewise.
* sem_prag.adb: Likewise.
* sem_ch6.adb: Likewise.
(Set_Formal_Mode): Minor cleanup: Move from spec.
* sem_ch6.ads:
(Set_Formal_Mode): Minor cleanup: Move to body.
* cstand.adb: Call Set_Is_Past_Self_Hiding_Point on all entities
as soon as they are created.
* comperr.adb (Compiler_Abort): Minor cleanup -- use 'in' instead
of 'or else'.
* debug.adb: Minor comment cleanups.
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r-- | gcc/ada/sem_ch6.adb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index ba88c07..df06967 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -226,6 +226,10 @@ package body Sem_Ch6 is -- Preanalysis of default expressions of subprogram formals. N is the -- expression to be analyzed and T is the expected type. + procedure Set_Formal_Mode (Formal_Id : Entity_Id); + -- Set proper Ekind to reflect formal mode (in, out, in out), and set + -- miscellaneous other attributes. + procedure Set_Formal_Validity (Formal_Id : Entity_Id); -- Formal_Id is an formal parameter entity. This procedure deals with -- setting the proper validity status for this entity, which depends on @@ -5241,6 +5245,8 @@ package body Sem_Ch6 is Set_Etype (Designator, Standard_Void_Type); end if; + Set_Is_Past_Self_Hiding_Point (Designator); + -- Flag Is_Inlined_Always is True by default, and reversed to False for -- those subprograms which could be inlined in GNATprove mode (because -- Body_To_Inline is non-Empty) but should not be inlined. @@ -13421,6 +13427,8 @@ package body Sem_Ch6 is Mutate_Ekind (Formal_Id, E_In_Parameter); end if; + Set_Is_Past_Self_Hiding_Point (Formal_Id); + -- Set Is_Known_Non_Null for access parameters since the language -- guarantees that access parameters are always non-null. We also set -- Can_Never_Be_Null, since there is no way to change the value. |