Skip to content
Snippets Groups Projects
Commit a714ca80 authored by Piotr Trojanek's avatar Piotr Trojanek Committed by Pierre-Marie de Rodat
Browse files

[Ada] Handle bodies-to-inline just like generic templates

Originally bodies-to-inline created for the frontend inlining were
analyzed with expansion disabled. Then, to facilitate inlining in
GNATprove mode, the analysis was changed to preanalysis.

However, preanalysis in this context works badly for calls in prefix
notation, because preanalysis assigns entities and types to nodes but
doesn't convert calls from prefix to ordinary notation. When the
body-to-inline is actually inlined, the (re)analysis of calls in prefix
notation fails.

The proper solution is rather to handle bodies-to-inline just like
generic templates.

From the user point of view, this patch fixes spurious errors both in
GNATprove (which uses frontend inlining by default) and in GNAT (where
frontend inlining is typically explicitly requested with -gnatN and
pragma Inline_Always).

gcc/ada/

	* inline.adb (Build_Body_To_Inline): Instead of manipulating the
	Full_Analysis flag, use the Inside_A_Generic flag (which is
	conveniently manipulated by Start_Generic/End_Generic, together
	with Expander_Active).
	* sem_attr.adb (Analyze_Attribute_Old_Result): Adapt comment and
	assertion to different flag that is set while building
	body-to-inline.
parent 4621bae8
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment