]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Never make symbols for thunks public
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 20 May 2022 17:06:28 +0000 (19:06 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 2 Jun 2022 09:06:46 +0000 (09:06 +0000)
Thunks are only referenced locally by dispatch tables and never inlined.

gcc/ada/

* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Clear the Is_Public
flag on thunks.

gcc/ada/sem_ch6.adb

index 8fd88ade84e69bc10358eefcd54ab523d151e945..848c234920078e417459033f623ef0134ae32d80 100644 (file)
@@ -4772,6 +4772,13 @@ package body Sem_Ch6 is
          if Nkind (N) /= N_Subprogram_Body
            or else not Was_Expression_Function (N)
          then
+            --  First clear the Is_Public flag on thunks since they are only
+            --  referenced locally by dispatch tables and thus never inlined.
+
+            if Is_Thunk (Body_Id) then
+               Set_Is_Public (Body_Id, False);
+            end if;
+
             Freeze_Before (N, Body_Id);
          end if;