aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2024-12-04 18:30:03 -0500
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-03 16:39:14 +0100
commit586fa60bdb385a94d0c11cca2940b8377df7a185 (patch)
treef1dbe553add7c9ad49648f78d63332690095f640
parentc3c701a5e905aa638605f5bedc6b37dbc5bc2ecf (diff)
downloadgcc-586fa60bdb385a94d0c11cca2940b8377df7a185.zip
gcc-586fa60bdb385a94d0c11cca2940b8377df7a185.tar.gz
gcc-586fa60bdb385a94d0c11cca2940b8377df7a185.tar.bz2
ada: Enclosing_Entity of specless subprogram bodies
Correct Enclosing_Entity of specless subprogram bodies; these are marked as Comes_From_Source = False, so the simple name was missing. gcc/ada/ChangeLog: * sem_util.adb (Append_Entity_Name): Do not skip the simple name for a compilation unit (which includes the case of specless subprogram bodies).
-rw-r--r--gcc/ada/sem_util.adb13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 4a26d96..44a8729 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -649,18 +649,21 @@ package body Sem_Util is
-- recursively print A.B.C, then print D.
begin
-- If E is not a source entity, then skip the simple name and just
- -- recursively print its scope. However, subprogram instances have
- -- Comes_From_Source = False, but we do want to print the simple name
- -- of the instance.
+ -- recursively print its scope. However, certain entities have
+ -- Comes_From_Source = False, even though we DO want to print the
+ -- simple name; this happens for specless child subprogram bodies
+ -- and for subprogram instances.
if not Comes_From_Source (E) then
- if Is_Generic_Instance (E)
+ if Is_Compilation_Unit (E) then
+ null;
+ elsif Is_Generic_Instance (E)
and then Ekind (E) in E_Function | E_Procedure
then
null;
else
Append_Entity_Name (Buf, Scope (E));
- return;
+ return; -- skip the simple name
end if;
end if;