with Osint.C; use Osint.C;
with Sem_Aux; use Sem_Aux;
with Sem_Eval; use Sem_Eval;
+with Sem_Util;
with Sinfo; use Sinfo;
with Sinfo.Nodes; use Sinfo.Nodes;
with Sinfo.Utils; use Sinfo.Utils;
end if;
-- Alignment is not always set for task, protected, and class-wide
- -- types.
+ -- types. Representation aspects are not computed for types in a
+ -- generic unit.
else
pragma Assert
- (Is_Concurrent_Type (Ent) or else Is_Class_Wide_Type (Ent));
+ (Is_Concurrent_Type (Ent) or else
+ Is_Class_Wide_Type (Ent) or else
+ Sem_Util.In_Generic_Scope (Ent));
end if;
end List_Common_Type_Info;
procedure List_Object_Info (Ent : Entity_Id) is
begin
+ -- The information has not been computed in a generic unit, so don't try
+ -- to print it.
+
+ if Sem_Util.In_Generic_Scope (Ent) then
+ return;
+ end if;
+
Write_Separator;
if List_Representation_Info_To_JSON then
Write_Str (" range ");
end if;
- Sbit := Starting_First_Bit + Fbit;
+ if Known_Static_Normalized_First_Bit (Ent) then
+ Sbit := Starting_First_Bit + Fbit;
- if Sbit >= SSU then
- Sbit := Sbit - SSU;
- end if;
+ if Sbit >= SSU then
+ Sbit := Sbit - SSU;
+ end if;
- UI_Write (Sbit, Decimal);
+ UI_Write (Sbit, Decimal);
+ else
+ Write_Unknown_Val;
+ end if;
if List_Representation_Info_To_JSON then
Write_Line (", ");
end if;
-- Skip the following warnings if overlap was detected; programmer
- -- should fix the errors first.
+ -- should fix the errors first. Also skip the warnings for types in
+ -- generics, because their representation information is not fully
+ -- computed.
- if not Overlap_Detected then
+ if not Overlap_Detected and then not In_Generic_Scope (Rectype) then
-- Check for record holes (gaps)
if Warn_On_Record_Holes then