]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Move aspects when instantiating subprograms as compilation units
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 9 May 2025 15:31:39 +0000 (17:31 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 1 Jul 2025 08:29:41 +0000 (10:29 +0200)
When rewriting N_Subprogram_Instantiation into wrapper packages we must move
the original aspect specifications to the wrapper packages, as otherwise they
will be only accessible via Original_Node. This is similar to how we move
aspect specifications for expression functions and many other constructs.

gcc/ada/ChangeLog:

* sem_ch12.adb (Analyze_Subprogram_Instantiation): Move aspects when
instantiating subprogram as a library unit.

gcc/ada/sem_ch12.adb

index 062251f15a99b453c99b772d55d857f35d8a050a..f492b236857553b9d84e639a87a0815573ac92f3 100644 (file)
@@ -6704,6 +6704,7 @@ package body Sem_Ch12 is
 
             elsif Nkind (Parent (N)) = N_Compilation_Unit then
                Rewrite (N, Unit (Parent (N)));
+               Move_Aspects (From => Original_Node (N), To => N);
                Set_Unit (Parent (N), N);
             end if;
 
@@ -6712,6 +6713,7 @@ package body Sem_Ch12 is
 
          elsif Nkind (Parent (N)) = N_Compilation_Unit then
             Rewrite (N, Unit (Parent (N)));
+            Move_Aspects (From => Original_Node (N), To => N);
             Set_Unit (Parent (N), N);
          end if;