diff options
author | Javier Miranda <miranda@adacore.com> | 2021-08-26 13:40:14 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-10-04 08:45:04 +0000 |
commit | cf1c69fb8c6b4ce894b95250028ed1ae5982c739 (patch) | |
tree | 540597a02b161989021236496bf1eea281530d7f | |
parent | 2376b04d474656af0234bee68af144a7780253b6 (diff) | |
download | gcc-cf1c69fb8c6b4ce894b95250028ed1ae5982c739.zip gcc-cf1c69fb8c6b4ce894b95250028ed1ae5982c739.tar.gz gcc-cf1c69fb8c6b4ce894b95250028ed1ae5982c739.tar.bz2 |
[Ada] Entities in E_Loop scopes are not library-level entities
gcc/ada/
* sem_util.adb (Is_Library_Level_Entity): Return False for
entities defined in E_Loop scopes. This change is not required
by the frontend; it is required by tools that depend on the
frontend sources.
* einfo-utils.adb (Is_Dynamic_Scope): Code cleanup.
-rw-r--r-- | gcc/ada/einfo-utils.adb | 31 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 13 |
2 files changed, 25 insertions, 19 deletions
diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb index c6c3277..38cfe34 100644 --- a/gcc/ada/einfo-utils.adb +++ b/gcc/ada/einfo-utils.adb @@ -1425,26 +1425,19 @@ package body Einfo.Utils is function Is_Dynamic_Scope (Id : E) return B is begin - return - Ekind (Id) = E_Block - or else - Ekind (Id) = E_Function - or else - Ekind (Id) = E_Procedure - or else - Ekind (Id) = E_Subprogram_Body - or else - Ekind (Id) = E_Task_Type - or else - (Ekind (Id) = E_Limited_Private_Type - and then Present (Full_View (Id)) - and then Ekind (Full_View (Id)) = E_Task_Type) - or else - Ekind (Id) = E_Entry - or else - Ekind (Id) = E_Entry_Family + return Ekind (Id) in E_Block + -- Including an E_Block that came from an N_Expression_With_Actions + | E_Entry + | E_Entry_Family + | E_Function + | E_Procedure + | E_Return_Statement + | E_Subprogram_Body + | E_Task_Type or else - Ekind (Id) = E_Return_Statement; + (Ekind (Id) = E_Limited_Private_Type + and then Present (Full_View (Id)) + and then Ekind (Full_View (Id)) = E_Task_Type); end Is_Dynamic_Scope; -------------------- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index ba0341e..e206e2f 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -18107,6 +18107,19 @@ package body Sem_Util is if Is_Formal (E) then return False; + + -- If we somehow got an empty value for Scope, the tree must be + -- malformed. Rather than blow up we return True in this case. + + elsif No (Scope (E)) then + return True; + + -- Handle loops since Enclosing_Dynamic_Scope skips them; required to + -- properly handle entities local to quantified expressions in library + -- level specifications. + + elsif Ekind (Scope (E)) = E_Loop then + return False; end if; -- Normal test is simply that the enclosing dynamic scope is Standard |