aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/einfo.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2023-02-06 11:58:52 -0500
committerMarc Poulhiès <poulhies@adacore.com>2023-05-22 10:44:10 +0200
commitaf1914998dcfb9908afe85b2275fd9868d689db9 (patch)
treedba795b83a20021408187e8bb20c63a38d573819 /gcc/ada/einfo.ads
parent472f4cb52ac6f47926a19eb2c53cd848fa6b3730 (diff)
downloadgcc-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/einfo.ads')
-rw-r--r--gcc/ada/einfo.ads13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 6748533..c67731c 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -3104,6 +3104,18 @@ package Einfo is
-- procedure which verifies the invariants of the partial view of a
-- private type or private extension.
+-- Is_Past_Self_Hiding_Point
+-- Defined in all entities. Roughly speaking, this is False if the
+-- declaration of the entity is hidden from all visibility because
+-- we are within its declaration, as defined by 8.3(16-18). When
+-- we reach the end of the declaration or other place defined by
+-- 8.3(16-18), this is set to True. However, this flag is not used
+-- for most overloaded declarations (but is used for enumeration
+-- literals), and is also used for other cases of premature usage
+-- such as defined in 3.8(10) for record components and the like.
+-- In addition, there are cases involving discriminants where we
+-- set this True, then temporarily False again.
+
-- Is_Potentially_Use_Visible
-- Defined in all entities. Set if entity is potentially use visible,
-- i.e. it is defined in a package that appears in a currently active
@@ -4945,6 +4957,7 @@ package Einfo is
-- Is_Obsolescent
-- Is_Package_Body_Entity
-- Is_Packed_Array_Impl_Type
+ -- Is_Past_Self_Hiding_Point
-- Is_Potentially_Use_Visible
-- Is_Preelaborated
-- Is_Primitive_Wrapper