This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] On going work on AI-318

Tested on i686-linux, committed on trunk.

Ongoing work on AI-318. Implement build-in-place function calls that appear as
a component in an aggregate, or as the ancestor part in an extension

The default expression of a record component can contain a self-reference
nested at any level within the expression. When an aggregate for the
type has defaulted components, self-references must be rewritten as
references to the target object of the aggregate. The replacement
requires a full tree traversal of each expression in every aggregate
that is a flagged as containing a self-reference.

gnat.dg/test_self_ref.adb must compile and execute quietly.

Similarly, in Ada 2005 a limited self-referential record can be initialized
with a defaulted aggregate. The expression for a self-referential component has
the form Typ'Acc, where Typ is the enclosing record type. Within the
aggregate, Typ designates the current instance, but its identity is only
established when the aggregate is expanded into individual assignments.

gnat.dg/test_self.adb must compile and execute quietly.

2006-10-31  Bob Duff  <>
	    Ed Schonberg  <>

	* exp_aggr.adb (Build_Record_Aggr_Code): For extension aggregates, if
	the parent part is a build-in-place function call, generate assignments.
	(Expand_Record_Aggregate): Call Convert_To_Assignments if any components
	are build-in-place function calls.
	(Replace_Self_Reference): New subsidiary of
	Make_OK_Assignment_Statement, to replace an access attribute that is a
	self-reference into an access to the appropriate component of the
	target object. Generalizes previous mechanism to handle self-references
	nested at any level.
	(Is_Self_Referential_Init): Remove, not needed.
	(Is_Self_Referential_Init): New predicate to simplify handling of self
	referential components in record aggregates.
	(Has_Default_Init_Comps, Make_OK_Assignment_Statement): Add guard to
	check for presence of entity before checking for self-reference.
	(Has_Default_Init_Comps): Return True if a component association is a
	self-reference to the enclosing type, which can only come from a
	default initialization.
	(Make_OK_Assignment_Statement): If the expression is of the form
	Typ'Acc, where Acc is an access attribute, the expression comes from a
	default initialized self-referential component.
	(Build_Record_Aggr_Code): If the type of the aggregate is a tagged type
	that has been derived from several abstract interfaces we must also
	initialize the tags of the secondary dispatch tables.

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]