Set_SCIL_Controlling_Tag (SCIL_Node,
Parent (Entity (Prefix (Controlling_Tag))));
- -- For a direct reference of the tag of the type the SCIL node
- -- references the internal object declaration containing the tag
- -- of the type.
+ -- Depending on whether a dereference is involved, the SCIL node
+ -- references the corresponding object/parameter declaration or
+ -- the internal object declaration containing the tag of the type.
elsif Nkind (Controlling_Tag) = N_Attribute_Reference
and then Attribute_Name (Controlling_Tag) = Name_Tag
then
- Set_SCIL_Controlling_Tag (SCIL_Node,
- Parent
- (Node
- (First_Elmt
- (Access_Disp_Table (Entity (Prefix (Controlling_Tag)))))));
+ declare
+ Prefix_Node : constant Node_Id := Prefix (Controlling_Tag);
+ Ent : constant Entity_Id := Entity
+ (if Nkind (Prefix_Node) = N_Explicit_Dereference then
+ Prefix (Prefix_Node)
+ else
+ Prefix_Node);
+
+ begin
+ if Ekind (Ent) in E_Record_Type
+ | E_Record_Subtype
+ | E_Record_Type_With_Private
+ then
+ Set_SCIL_Controlling_Tag (SCIL_Node,
+ Parent
+ (Node
+ (First_Elmt
+ (Access_Disp_Table (Ent)))));
+
+ else
+ Set_SCIL_Controlling_Tag (SCIL_Node, Parent (Ent));
+ end if;
+ end;
-- Interfaces are not supported. For now we leave the SCIL node
-- decorated with the Controlling_Tag. More work needed here???
-- object or parameter declaration. Interface types are still
-- unsupported.
- elsif Nkind (Ctrl_Tag) in
- N_Object_Declaration | N_Parameter_Specification
+ elsif Nkind (Ctrl_Tag) in N_Object_Renaming_Declaration
+ | N_Object_Declaration
+ | N_Parameter_Specification
then
Ctrl_Typ := Etype (Defining_Identifier (Ctrl_Tag));