+2018-09-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_disp.adb (Expand_Interface_Conversion): Use Present test.
+ (Expand_Interface_Thunk): Propagate debug info setting from
+ target.
+ * exp_util.ads (Find_Interface_Tag): Adjust comment.
+ * exp_util.adb (Find_Interface_Tag): Remove assertions of
+ success.
+ * sem_util.adb (Is_Variable_Size_Record): Only look at
+ components and robustify the implementation.
+ * fe.h (Find_Interface_Tag): Declare.
+ (Is_Variable_Size_Record): Likewise.
+
2018-09-26 Thomas Quinot <quinot@adacore.com>
* exp_util.adb (Make_CW_Equivalent_Type): Propagate bit order
end if;
Iface_Tag := Find_Interface_Tag (Operand_Typ, Iface_Typ);
- pragma Assert (Iface_Tag /= Empty);
+ pragma Assert (Present (Iface_Tag));
-- Keep separate access types to interfaces because one internal
-- function is used to handle the null value (see following comments)
Set_Ekind (Thunk_Id, Ekind (Prim));
Set_Is_Thunk (Thunk_Id);
Set_Convention (Thunk_Id, Convention (Prim));
+ Set_Needs_Debug_Info (Thunk_Id, Needs_Debug_Info (Target));
Set_Thunk_Entity (Thunk_Id, Target);
-- Procedure case
then
-- Skip the tag associated with the primary table
- pragma Assert (Etype (First_Tag_Component (Typ)) = RTE (RE_Tag));
AI_Tag := Next_Tag_Component (First_Tag_Component (Typ));
pragma Assert (Present (AI_Tag));
-- primary dispatch table.
if Is_Ancestor (Iface, Typ, Use_Full_View => True) then
- pragma Assert (Etype (First_Tag_Component (Typ)) = RTE (RE_Tag));
return First_Tag_Component (Typ);
-- Otherwise we need to search for its associated tag component
else
Find_Tag (Typ);
- pragma Assert (Found);
return AI_Tag;
end if;
end Find_Interface_Tag;
function Find_Interface_Tag
(T : Entity_Id;
Iface : Entity_Id) return Entity_Id;
- -- Ada 2005 (AI-251): Given a type T implementing the interface Iface,
- -- return the record component containing the tag of Iface.
+ -- Ada 2005 (AI-251): Given a type T and an interface Iface, return the
+ -- record component containing the tag of Iface if T implements Iface or
+ -- Empty if it does not.
function Find_Prim_Op (T : Entity_Id; Name : Name_Id) return Entity_Id;
-- Find the first primitive operation of a tagged type T with name Name.
/* exp_util: */
#define Is_Fully_Repped_Tagged_Type exp_util__is_fully_repped_tagged_type
+#define Find_Interface_Tag exp_util__find_interface_tag
extern Boolean Is_Fully_Repped_Tagged_Type (Entity_Id);
+extern Entity_Id Find_Interface_Tag (Entity_Id, Entity_Id);
/* lib: */
#define Defining_Entity sem_util__defining_entity
#define First_Actual sem_util__first_actual
#define Next_Actual sem_util__next_actual
+#define Is_Variable_Size_Record sem_util__is_variable_size_record
#define Requires_Transient_Scope sem_util__requires_transient_scope
extern Entity_Id Defining_Entity (Node_Id);
extern Node_Id First_Actual (Node_Id);
extern Node_Id Next_Actual (Node_Id);
-extern Boolean Requires_Transient_Scope (Entity_Id);
+extern Boolean Is_Variable_Size_Record (Entity_Id Id);
+extern Boolean Requires_Transient_Scope (Entity_Id);
/* sinfo: */
begin
pragma Assert (Is_Record_Type (E));
- Comp := First_Entity (E);
+ Comp := First_Component (E);
while Present (Comp) loop
- Comp_Typ := Etype (Comp);
+ Comp_Typ := Underlying_Type (Etype (Comp));
-- Recursive call if the record type has discriminants
return True;
end if;
- Next_Entity (Comp);
+ Next_Component (Comp);
end loop;
return False;