ada: Small cleanup in the finalization machinery

The generic finalization machinery and the finalization machinery for
transient objects disagree on which controlled objects should be finalized
indirectly, i.e. through an access value: the former only considers return
objects of (selected) function calls, whereas the latter considers all
objects designated by a reference, which means that it must be careful
about not finalizing them twice.

The discrepancy does not seem to cause problems in practice, but is awkward
and creates additional work for the finalization machinery for transient
objects, as well as code duplication.

gcc/ada/ChangeLog:

	* exp_util.ads (Is_Finalizable_Access): New predicate.
	(Is_Non_BIP_Func_Call): Delete.
	(Is_Secondary_Stack_BIP_Func_Call): Likewise.
	* exp_util.adb (Is_Finalizable_Access): New predicate.
	(Initialized_By_Aliased_BIP_Func_Call): Delete.
	(Initialized_By_Reference): Likewise.
	(Is_Aliased): Only consider the nontransient object serviced by
	the transient scope.
	(Is_Part_Of_BIP_Return_Statement): Minor tweak.
	(Is_Finalizable_Transient): Remove calls to Initialized_By_Reference
	and Initialized_By_Aliased_BIP_Func_Call.
	Call Is_Finalizable_Access for access objects.
	(Is_Non_BIP_Func_Call): Delete.
	(Is_Secondary_Stack_BIP_Func_Call): Likewise.
	(Requires_Cleanup_Actions): Call Is_Finalizable_Access for access
	objects.
	(Side_Effect_Free): Return True for N_Reference.
	* exp_ch7.adb (Build_Finalizer.Process_Declarations): Call
	Is_Finalizable_Access for access objects.
3 files changed