[Ada] Lift restriction on instantiations that are compilation units
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 19 Aug 2019 08:36:53 +0000 (08:36 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 19 Aug 2019 08:36:53 +0000 (08:36 +0000)
commit6c87c83bb2a8a65f6f73d23ebb863a5c67e4c6c2
treeb582d19735f1d5a68c96a8932cda41a4b7c7ccff
parent92b635e518dfb3bc6829601c38a2c55ea8791887
[Ada] Lift restriction on instantiations that are compilation units

This change lifts the restriction that was still present in the new
on-demand instantiation scheme for the body of generics instantiated in
non-main units.

The instantiations that are compilation units were still dealt with in
the old-fashioned way, that is to say the decision of instantiating the
body was still made up front during the analysis of the instance
declaration, instead of being deferred until after a call to an inlined
subprogram is encountered.

This should save a few more cycles when full inlining across units is
enabled, but there should otherwise be no functional changes.

2019-08-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* inline.adb (Add_Inlined_Body): Do not special-case instances
that are compilation units.
(Add_Pending_Instantiation): Likewise.
(Instantiate_Body): Skip instantiations that are compilation
units and have already been performed.
* sem_ch12.adb (Needs_Body_Instantiated): Do not special-case
instances that are compilation units.
(Load_Parent_Of_Generic): Be prepared for parent that is a
compilation unit but whose instantiation node has not been
replaced.

gcc/testsuite/

* gnat.dg/generic_inst12.adb, gnat.dg/generic_inst12_pkg1.adb,
gnat.dg/generic_inst12_pkg1.ads,
gnat.dg/generic_inst12_pkg2.ads: New testcase.

From-SVN: r274657
gcc/ada/ChangeLog
gcc/ada/inline.adb
gcc/ada/sem_ch12.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/generic_inst12.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst12_pkg1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst12_pkg1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst12_pkg2.ads [new file with mode: 0644]