aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2024-04-26 17:08:08 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-06-13 15:30:32 +0200
commit047135cfed8c4c3950bda207dc87d33ca4c154ea (patch)
treed430cc7171d8bb1b82e27e82c95f2c0953e75cde /gcc/ada/sem_ch6.adb
parent5c45881bf57fa1ae593b5cab8f4db67506470ff9 (diff)
downloadgcc-047135cfed8c4c3950bda207dc87d33ca4c154ea.zip
gcc-047135cfed8c4c3950bda207dc87d33ca4c154ea.tar.gz
gcc-047135cfed8c4c3950bda207dc87d33ca4c154ea.tar.bz2
ada: List subprogram body entities in scopes
Add entities of kind E_Subprogram_Body to the list of entities associated to a given scope. This ensures that representation information is correctly output for object and type declarations inside these subprogram bodies. This is useful for outputing that information fron the compiler with the switch -gnatR, as well as for getting precise representation information inside GNATprove. Remove ad-hoc code inside repinfo.adb that retrieved this information in only some cases. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Skip entities of kind E_Subprogram_Body. * repinfo.adb (List_Entities): Remove special case for subprogram bodies. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): List subprogram body entities in the enclosing scope.
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 50dac5c..3252af7 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4083,6 +4083,15 @@ package body Sem_Ch6 is
else
Set_Corresponding_Spec (N, Spec_Id);
+ -- The body entity is not used for semantics or code generation,
+ -- but it is attached to the entity list of the enclosing scope
+ -- to allow listing its entities when outputting representation
+ -- information.
+
+ if Scope (Spec_Id) /= Standard_Standard then
+ Append_Entity (Body_Id, Scope (Spec_Id));
+ end if;
+
-- Ada 2005 (AI-345): If the operation is a primitive operation
-- of a concurrent type, the type of the first parameter has been
-- replaced with the corresponding record, which is the proper