-- kinds of entities. In the latter case the attribute should only be set or
-- accessed if the Ekind field indicates an appropriate entity.
--- There are two kinds of attributes that apply to entities, stored and
--- synthesized. Stored attributes correspond to a field or flag in the entity
--- itself. Such attributes are identified in the table below by giving the
--- field or flag in the attribute that is used to hold the attribute value.
--- Synthesized attributes are not stored directly, but are rather computed as
--- needed from other attributes, or from information in the tree. These are
--- marked "synthesized" in the table below. The stored attributes have both
--- access functions and set procedures to set the corresponding values, while
--- synthesized attributes have only access functions.
+-- Attributes that apply to entities are either "stored" or "synthesized".
+-- Stored attributes are stored as fields in the entity node, and have
+-- automatically-generated access functions and Set_... procedures.
+-- Synthesized attributes are marked "(synthesized)" in the documentation
+-- below, and are computed as needed; these have only (hand-written) access
+-- functions.
-- Note: in the case of Node, Uint, or Elist fields, there are cases where the
-- same physical field is used for different purposes in different entities,
-- Deal with matching entry in List_Pragmas table
if Full_List
- and then List_Pragmas_Index <= List_Pragmas.Last
+ and then List_Pragmas_Index in
+ List_Pragmas.First .. List_Pragmas.Last
and then S = List_Pragmas.Table (List_Pragmas_Index).Ploc
then
case List_Pragmas.Table (List_Pragmas_Index).Ptyp is
Process_Package_Body (Decl);
elsif Nkind (Decl) = N_Package_Body_Stub
- and then Present (Library_Unit (Decl))
+ and then Present (Stub_Subunit (Decl))
then
- Process_Package_Body (Proper_Body (Unit (Library_Unit (Decl))));
+ Process_Package_Body
+ (Proper_Body (Unit (Stub_Subunit (Decl))));
end if;
Decl := Prev;
Build_Dispatch_Tables (Declarations (D));
elsif Nkind (D) = N_Package_Body_Stub
- and then Present (Library_Unit (D))
+ and then Present (Stub_Subunit (D))
then
Build_Dispatch_Tables
- (Declarations (Proper_Body (Unit (Library_Unit (D)))));
+ (Declarations (Proper_Body (Unit (Stub_Subunit (D)))));
-- Handle full type declarations and derivations of library level
-- tagged types
-- is a semantic descendant of the stub.
when N_Body_Stub =>
- Visit (Library_Unit (N));
+ Visit (Stub_Subunit (N));
-- A declaration of a wrapper package indicates a subprogram
-- instance for which there is no explicit body. Enter the
-- recursively in Visit_Node.
elsif Nkind (N) in N_Body_Stub then
- Do_Search (Library_Unit (N));
+ Do_Search (Stub_Subunit (N));
-- Skip generic packages
or else (Nkind (Unit (N)) = N_Subprogram_Body
and then not Acts_As_Spec (N))
then
- Do_Search (Library_Unit (N));
+ Do_Search (Spec_Lib_Unit (N));
end if;
Do_Search (N);
-- declarations of the package spec.
if Nkind (U) = N_Package_Body then
- U := Unit (Library_Unit (Cunit (Current_Sem_Unit)));
+ U := Unit (Spec_Lib_Unit (Cunit (Current_Sem_Unit)));
end if;
if Nkind (U) = N_Package_Declaration then
/* sinfo: */
+#define Spec_Lib_Unit sinfo__utils__spec_lib_unit
+#define Body_Lib_Unit sinfo__utils__body_lib_unit
+#define Subunit_Parent sinfo__utils__subunit_parent
+#define Stub_Subunit sinfo__utils__stub_subunit
+#define Withed_Lib_Unit sinfo__utils__withed_lib_unit
#define End_Location sinfo__utils__end_location
#define Set_Has_No_Elaboration_Code sinfo__nodes__set_has_no_elaboration_code
#define Set_Present_Expr sinfo__nodes__set_present_expr
+extern Node_Id Spec_Lib_Unit (Node_Id);
+extern Node_Id Body_Lib_Unit (Node_Id);
+extern Node_Id Subunit_Parent (Node_Id);
+extern Node_Id Stub_Subunit (Node_Id);
+extern Node_Id Withed_Lib_Unit (Node_Id);
extern Source_Ptr End_Location (Node_Id);
extern void Set_Has_No_Elaboration_Code (Node_Id, Boolean);
extern void Set_Present_Expr (Node_Id, Uint);
(Sm (Corresponding_Spec, Node_Id),
Sm (Was_Originally_Stub, Flag)));
- Ab (N_Unit_Body, N_Proper_Body);
+ Ab (N_Lib_Unit_Body, N_Proper_Body);
- Cc (N_Package_Body, N_Unit_Body,
+ Cc (N_Package_Body, N_Lib_Unit_Body,
(Sy (Defining_Unit_Name, Node_Id),
Sy (Declarations, List_Id, Default_No_List),
Sy (Handled_Statement_Sequence, Node_Id, Default_Empty),
Sy (At_End_Proc, Node_Id, Default_Empty),
Sy (Aspect_Specifications, List_Id, Default_No_List)));
- Cc (N_Subprogram_Body, N_Unit_Body,
+ Cc (N_Subprogram_Body, N_Lib_Unit_Body,
(Sy (Specification, Node_Id),
Sy (Declarations, List_Id, Default_No_List),
Sy (Handled_Statement_Sequence, Node_Id, Default_Empty),
N_Variant));
-- Nodes that can be alternatives in case contructs
+ Union (N_Lib_Unit_Declaration,
+ Children =>
+ (N_Package_Declaration,
+ N_Subprogram_Declaration,
+ N_Generic_Declaration,
+ N_Generic_Instantiation));
+ -- Nodes corresponding to the library_unit_declaration syntactic category
+
+ Union (N_Lib_Unit_Renaming_Declaration,
+ Children =>
+ (N_Package_Renaming_Declaration,
+ N_Subprogram_Renaming_Declaration,
+ N_Generic_Renaming_Declaration));
+ -- Nodes corresponding to the library_unit_renaming_declaration syntactic
+ -- category.
+
end Gen_IL.Gen.Gen_Nodes;
Type_Table (T).First := Type_Table (Children (1)).First;
Type_Table (T).Last :=
Type_Table (Children (Last_Index (Children))).Last;
+
+ -- We know that each abstract type has at least two
+ -- children. The concrete types must be ordered so
+ -- that each abstract type is a contiguous subrange.
+
+ if Type_Table (T).First >= Type_Table (T).Last then
+ raise Illegal with
+ Image (T) & " children out of order";
+ end if;
end;
when Between_Abstract_Entity_And_Concrete_Node_Types =>
N_Subexpr,
N_Subprogram_Specification,
N_Unary_Op,
- N_Unit_Body,
+ N_Lib_Unit_Declaration,
+ N_Lib_Unit_Renaming_Declaration,
+ N_Lib_Unit_Body,
-- End of abstract node types.
-- package of the subprogram to find more calls to be inlined.
if Comp = Cunit (Main_Unit)
- or else Comp = Library_Unit (Cunit (Main_Unit))
+ or else Comp = Spec_Or_Body_Lib_Unit (Cunit (Main_Unit))
then
Add_Call (E);
return Inline_Package;
then
Child_Spec :=
Defining_Entity
- ((Unit (Library_Unit (Cunit (Main_Unit)))));
+ ((Unit (Spec_Lib_Unit (Cunit (Main_Unit)))));
Comp :=
Parent (Unit_Declaration_Node (Body_Entity (P)));
-- done in Analyze_Inlined_Bodies.
while Nkind (Unit (Comp)) = N_Subunit loop
- Comp := Library_Unit (Comp);
+ Comp := Subunit_Parent (Comp);
end loop;
return Comp = Cunit (Main_Unit)
- or else Comp = Library_Unit (Cunit (Main_Unit));
+ or else Comp = Spec_Or_Body_Lib_Unit (Cunit (Main_Unit));
end In_Main_Unit_Or_Subunit;
----------------
--------------------------
procedure Make_Child_Decl_Unit (N : Node_Id) is
- Unit_Decl : constant Node_Id := Library_Unit (N);
+ Unit_Decl : constant Node_Id := Spec_Lib_Unit (N);
Unit_Num : constant Unit_Number_Type := Get_Cunit_Unit_Number (N);
begin
if In_Main then
Units.Table (Units.Last) := Units.Table (Main_Unit);
- Units.Table (Units.Last).Cunit := Library_Unit (N);
+ Units.Table (Units.Last).Cunit := Spec_Lib_Unit (N);
Init_Unit_Name (Units.Last, Unit_Name (Main_Unit));
Units.Table (Main_Unit).Cunit := N;
Units.Table (Main_Unit).Version := Source_Checksum (Sind);
Init_Unit_Name (Main_Unit,
Get_Body_Name
- (Unit_Name (Get_Cunit_Unit_Number (Library_Unit (N)))));
+ (Unit_Name (Get_Cunit_Unit_Number (Spec_Lib_Unit (N)))));
else
-- Duplicate information from instance unit, for the body. The unit
-- units table when first loaded as a declaration.
Units.Table (Units.Last) := Units.Table (Get_Cunit_Unit_Number (N));
- Units.Table (Units.Last).Cunit := Library_Unit (N);
+ Units.Table (Units.Last).Cunit := Spec_Lib_Unit (N);
end if;
end Make_Instance_Unit;
-- the unit anywhere else.
if Nkind (Item) = N_With_Clause then
- Unum := Get_Cunit_Unit_Number (Library_Unit (Item));
+ Unum := Get_Cunit_Unit_Number (Withed_Lib_Unit (Item));
With_Flags (Unum) := True;
if not Limited_Present (Item) then
if Ukind in N_Generic_Declaration
or else
- (Present (Library_Unit (Unode))
- and then
- Nkind (Unit (Library_Unit (Unode))) in N_Generic_Declaration)
+ (Ukind in N_Lib_Unit_Body
+ and then Present (Spec_Lib_Unit (Unode))
+ and then Nkind (Unit (Spec_Lib_Unit (Unode)))
+ in N_Generic_Declaration)
then
Write_Info_Str (" GE");
end if;
-- it and which have context clauses of their own, since these
-- with'ed units are part of its own elaboration dependencies.
- if Nkind (Unit (Unode)) in N_Unit_Body then
+ if Nkind (Unit (Unode)) in N_Lib_Unit_Body then
for S in Units.First .. Last_Unit loop
-- We are only interested in subunits. For preproc. data and
if Cunit (S) /= Empty
and then Nkind (Unit (Cunit (S))) = N_Subunit
then
- Pnode := Library_Unit (Cunit (S));
+ Pnode := Subunit_Parent (Cunit (S));
-- In gnatc mode, the errors in the subunits will not have
-- been recorded, but the analysis of the subunit may have
-- Find ultimate parent of the subunit
while Nkind (Unit (Pnode)) = N_Subunit loop
- Pnode := Library_Unit (Pnode);
+ Pnode := Subunit_Parent (Pnode);
end loop;
-- See if it belongs to current unit, and if so, include
if Nkind (U) = N_Package_Body then
U := Parent (Parent (
Alias (Related_Instance (Defining_Unit_Name
- (Specification (Unit (Library_Unit (Parent (U)))))))));
+ (Specification (Unit (Spec_Lib_Unit (Parent (U)))))))));
end if;
S := Specification (U);
with Output; use Output;
with Sinfo; use Sinfo;
with Sinfo.Nodes; use Sinfo.Nodes;
+with Sinfo.Utils; use Sinfo.Utils;
with Sinput; use Sinput;
with Stand; use Stand;
with Stringt; use Stringt;
-- earlier.
if Nkind (Unit1) in N_Subprogram_Body | N_Package_Body then
- if Library_Unit (Cunit (Unum1)) = Cunit (Unum2) then
+ if Spec_Lib_Unit (Cunit (Unum1)) = Cunit (Unum2) then
return Yes_After;
end if;
elsif Nkind (Unit2) in N_Subprogram_Body | N_Package_Body then
- if Library_Unit (Cunit (Unum2)) = Cunit (Unum1) then
+ if Spec_Lib_Unit (Cunit (Unum2)) = Cunit (Unum1) then
return Yes_Before;
end if;
end if;
end if;
end loop;
- -- If not in the table, must be a spec created for a main unit that is a
- -- child subprogram body which we have not inserted into the table yet.
+ -- Not in the table. Empty N is some already-detected error; otherwise,
+ -- it must be a spec created for a main unit that is a child subprogram
+ -- body which we have not inserted into the table yet.
- if N = Library_Unit (Cunit (Main_Unit)) then
+ if No (N) then
+ pragma Assert (Serious_Errors_Detected > 0);
+ return Main_Unit;
+ end if;
+
+ if N = Spec_Lib_Unit (Cunit (Main_Unit)) then
return Main_Unit;
-- If it is anything else, something is seriously wrong, and we really
if Nkind (Context_Item) = N_With_Clause
and then not Limited_Present (Context_Item)
then
- pragma Assert (Present (Library_Unit (Context_Item)));
+ pragma Assert (Present (Withed_Lib_Unit (Context_Item)));
Write_Unit_Name
(Unit_Name
- (Get_Cunit_Unit_Number (Library_Unit (Context_Item))));
+ (Get_Cunit_Unit_Number
+ (Withed_Lib_Unit (Context_Item))));
if Is_Implicit_With (Context_Item) then
Write_Str (" -- implicit");
Traverse (Spec_Of (N));
when N_Package_Body_Stub =>
- if Present (Library_Unit (N)) then
- Traverse (Proper_Body (Unit (Library_Unit (N))));
+ if Present (Subunit_Parent (N)) then
+ Traverse (Proper_Body (Unit (Stub_Subunit (N))));
end if;
when N_Package_Body =>
Traverse (Spec_Of (N));
when N_Package_Body_Stub =>
- if Present (Library_Unit (N)) then
- Traverse (Proper_Body (Unit (Library_Unit (N))));
+ if Present (Stub_Subunit (N)) then
+ Traverse (Proper_Body (Unit (Stub_Subunit (N))));
end if;
when N_Package_Body =>
end if;
when N_Package_Body_Stub =>
- if Present (Library_Unit (N)) then
- Traverse (Proper_Body (Unit (Library_Unit (N))));
+ if Present (Stub_Subunit (N)) then
+ Traverse (Proper_Body (Unit (Stub_Subunit (N))));
end if;
when N_Expanded_Name
-- have set our Fatal_Error flag to propagate this condition.
if Unum /= No_Unit then
- Set_Library_Unit (Curunit, Cunit (Unum));
- Set_Library_Unit (Cunit (Unum), Curunit);
+ Set_Spec_Lib_Unit (Curunit, Cunit (Unum));
+ Set_Body_Lib_Unit (Cunit (Unum), Curunit);
-- If this is a separate spec for the main unit, then we reset
-- Main_Unit_Entity to point to the entity for this separate spec
elsif Nkind (Unit (Curunit)) = N_Subprogram_Body then
Set_Acts_As_Spec (Curunit, True);
- Set_Library_Unit (Curunit, Curunit);
+ Set_Spec_Lib_Unit (Curunit, Curunit);
-- Otherwise we do have an error, repeat the load request for the spec
-- with Required set True to generate an appropriate error message.
Error_Node => Name (Unit (Curunit)));
if Unum /= No_Unit then
- Set_Library_Unit (Curunit, Cunit (Unum));
+ Set_Subunit_Parent (Curunit, Cunit (Unum));
end if;
end if;
-- unit gets a fatal error, so we don't need to worry about that.
if Unum /= No_Unit then
- Set_Library_Unit (With_Node, Cunit (Unum));
+ Set_Withed_Lib_Unit (With_Node, Cunit (Unum));
-- If the spec isn't found, then try finding the corresponding
-- body, since it is possible that we have a subprogram body
Renamings => True);
-- If we got a subprogram body, then mark that we are using
- -- the body as a spec in the file table, and set the spec
- -- pointer in the N_With_Clause to point to the body entity.
+ -- the body as a spec in the file table, and set
+ -- Withed_Lib_Unit of the N_With_Clause to point to
+ -- the body entity.
if Unum /= No_Unit
and then Nkind (Unit (Cunit (Unum))) = N_Subprogram_Body
then
With_Cunit := Cunit (Unum);
- Set_Library_Unit (With_Node, With_Cunit);
- Set_Acts_As_Spec (With_Cunit, True);
- Set_Library_Unit (With_Cunit, With_Cunit);
+ Set_Withed_Lib_Unit (With_Node, With_Cunit);
+
+ -- If we have errors, Acts_As_Spec and Spec_Lib_Unit might
+ -- not be set; set them for better error recovery.
+
+ if Serious_Errors_Detected > 0 then
+ Set_Acts_As_Spec (With_Cunit, True);
+ Set_Spec_Lib_Unit (With_Cunit, With_Cunit);
+
+ -- Otherwise, these field should already by set
+
+ else
+ pragma Assert (Acts_As_Spec (With_Cunit));
+ pragma Assert (Spec_Lib_Unit (With_Cunit) = With_Cunit);
+ end if;
-- If we couldn't find the body, or if it wasn't a body spec
-- then we are in trouble. We make one more call to Load to
-- Here we create a dummy package unit for the missing unit
Unum := Create_Dummy_Package_Unit (With_Node, Spec_Name);
- Set_Library_Unit (With_Node, Cunit (Unum));
+ Set_Withed_Lib_Unit (With_Node, Cunit (Unum));
end if;
end if;
end if;
(U, Defining_Unit_Name (Specification (LibUnit))));
Ghost_Mode := Saved_GM;
- Set_Corresponding_Spec (Withn, U.Entity);
- Set_First_Name (Withn);
- Set_Is_Implicit_With (Withn);
- Set_Library_Unit (Withn, Cunit (U.Unum));
- Set_Next_Implicit_With (Withn, U.First_Implicit_With);
+ Set_Corresponding_Spec (Withn, U.Entity);
+ Set_First_Name (Withn);
+ Set_Is_Implicit_With (Withn);
+ Set_Withed_Lib_Unit (Withn, Cunit (U.Unum));
+ Set_Next_Implicit_With (Withn, U.First_Implicit_With);
U.First_Implicit_With := Withn;
Curunit = Main_Unit
or else
(Nkind (Unit (Cunit (Main_Unit))) = N_Package_Body
- and then Library_Unit (Cunit (Main_Unit)) = Cunit (Curunit));
+ and then Spec_Lib_Unit (Cunit (Main_Unit)) = Cunit (Curunit));
-- Configuration flags have special settings when compiling a predefined
-- file as a main unit. This applies to its spec as well.
while Present (CL) loop
if Nkind (CL) = N_With_Clause
- and then Library_Unit (CL) = Main_CU
- and then not Done (Get_Cunit_Unit_Number (Library_Unit (CL)))
+ and then Withed_Lib_Unit (CL) = Main_CU
+ and then not Done (Get_Cunit_Unit_Number (Withed_Lib_Unit (CL)))
then
return True;
end if;
if Nkind (Unit (Withed_Unit)) = N_Package_Body
and then Is_Generic_Instance
- (Defining_Entity (Unit (Library_Unit (Withed_Unit))))
+ (Defining_Entity (Unit (Spec_Lib_Unit (Withed_Unit))))
then
- Do_Withed_Unit (Library_Unit (Withed_Unit));
+ Do_Withed_Unit (Spec_Lib_Unit (Withed_Unit));
end if;
end Do_Withed_Unit;
else
Seen (Unit_Num) := True;
- if CU = Library_Unit (Main_CU) then
+ if CU = Spec_Or_Body_Lib_Unit (Main_CU) then
Process_Bodies_In_Context (CU);
-- If main is a child unit, examine parent unit contexts
Clause := First (Context_Items (Comp));
while Present (Clause) loop
if Nkind (Clause) = N_With_Clause then
- Spec := Library_Unit (Clause);
- Body_CU := Library_Unit (Spec);
+ Spec := Withed_Lib_Unit (Clause);
+ Body_CU := Body_Lib_Unit (Spec);
-- If we are processing the spec of the main unit, load bodies
-- only if the with_clause indicates that it forced the loading
and then Is_Generic_Instance (Defining_Entity (N))
then
Append_List
- (Context_Items (CU), Context_Items (Library_Unit (CU)));
+ (Context_Items (CU), Context_Items (Spec_Lib_Unit (CU)));
end if;
Next_Elmt (Cur);
if CU = Main_CU
and then Nkind (Original_Node (Unit (Main_CU))) in
N_Generic_Instantiation
- and then Present (Library_Unit (Main_CU))
+ and then Present (Spec_Lib_Unit (Main_CU))
then
Do_Unit_And_Dependents
- (Library_Unit (Main_CU),
- Unit (Library_Unit (Main_CU)));
+ (Spec_Lib_Unit (Main_CU),
+ Unit (Spec_Lib_Unit (Main_CU)));
end if;
-- It is a spec, process it, and the units it depends on,
-- after all other specs.
if Nkind (Unit (CU)) = N_Package_Declaration
- and then Library_Unit (CU) = Main_CU
+ and then Body_Lib_Unit (CU) = Main_CU
and then CU /= Main_CU
then
Spec_CU := CU;
begin
if Present (U) and then Nkind (Unit (U)) = N_Subunit then
- Lib := Library_Unit (U);
+ Lib := Subunit_Parent (U);
return Lib = Main_CU or else Is_Subunit_Of_Main (Lib);
else
return False;
while Is_Child_Unit (Child) loop
Parent_CU :=
Cunit (Get_Cunit_Entity_Unit_Number (Scope (Child)));
- Body_CU := Library_Unit (Parent_CU);
+ Body_CU := Body_Lib_Unit (Parent_CU);
if Present (Body_CU)
and then not Seen (Get_Cunit_Unit_Number (Body_CU))
-- and which have context clauses of their own, since these with'ed
-- units are part of its own dependencies.
- if Nkind (Unit (CU)) in N_Unit_Body then
+ if Nkind (Unit (CU)) in N_Lib_Unit_Body then
for S in Main_Unit .. Last_Unit loop
-- We are only interested in subunits. For preproc. data and def.
Pnode : Node_Id;
begin
- Pnode := Library_Unit (Cunit (S));
+ Pnode := Subunit_Parent (Cunit (S));
-- In -gnatc mode, the errors in the subunits will not have
-- been recorded, but the analysis of the subunit may have
-- Find ultimate parent of the subunit
while Nkind (Unit (Pnode)) = N_Subunit loop
- Pnode := Library_Unit (Pnode);
+ Pnode := Subunit_Parent (Pnode);
end loop;
-- See if it belongs to current unit, and if so, include its
and then (Include_Limited
or else not Limited_Present (Context_Item))
then
- Lib_Unit := Library_Unit (Context_Item);
+ Lib_Unit := Withed_Lib_Unit (Context_Item);
Action (Lib_Unit);
end if;
Install_Parent_Policy_Pragmas (Parent_Spec (Lib_Unit));
elsif Nkind (Lib_Unit) = N_Package_Body then
- Install_Parent_Policy_Pragmas (Library_Unit (N));
+ Install_Parent_Policy_Pragmas (Spec_Lib_Unit (N));
elsif Nkind (Lib_Unit) = N_Subprogram_Body
and then not Acts_As_Spec (N)
then
- Install_Parent_Policy_Pragmas (Library_Unit (N));
+ Install_Parent_Policy_Pragmas (Spec_Lib_Unit (N));
end if;
-- Search for check policy pragmas defined at the start of the
Install_Parent_Policy_Pragmas (Parent_Spec (Lib_Unit));
elsif Nkind (Lib_Unit) = N_Package_Body then
- Install_Parent_Policy_Pragmas (Library_Unit (Comp_Unit));
+ Install_Parent_Policy_Pragmas (Spec_Lib_Unit (Comp_Unit));
elsif Nkind (Lib_Unit) = N_Subprogram_Body
and then not Acts_As_Spec (Comp_Unit)
then
- Install_Parent_Policy_Pragmas (Library_Unit (Comp_Unit));
+ Install_Parent_Policy_Pragmas (Spec_Lib_Unit (Comp_Unit));
end if;
return Last_Policy_Pragma;
-- Local variables
Main_Cunit : constant Node_Id := Cunit (Main_Unit);
- Lib_Unit : Node_Id := Library_Unit (N);
+ Lib_Unit : Node_Id := Other_Comp_Unit (N);
Par_Spec_Name : Unit_Name_Type;
Spec_Id : Entity_Id;
Unum : Unit_Number_Type;
-- If the subprogram body is a child unit, we must create a
-- declaration for it, in order to properly load the parent(s).
- -- After this, the original unit does not acts as a spec, because
+ -- After this, the original unit does not act as a spec, because
-- there is an explicit one. If this unit appears in a context
-- clause, then an implicit with on the parent will be added when
-- installing the context. If this is the main unit, there is no
Make_Compilation_Unit_Aux (Loc));
Set_Context_Items (N, Empty_List);
- Set_Library_Unit (N, Lib_Unit);
+ Set_Spec_Lib_Unit (N, Lib_Unit);
Set_Parent_Spec (Unit (Lib_Unit), Cunit (Unum));
Make_Child_Decl_Unit (N);
-- Skip analyzing with clause if no unit; this happens for a with
-- that references a non-existent unit.
- if Present (Library_Unit (Item)) then
+ if Present (Withed_Lib_Unit (Item)) then
Analyze (Item);
end if;
-- Do version update (skipped for implicit with)
if not Is_Implicit_With (Item) then
- Version_Update (N, Library_Unit (Item));
+ Version_Update (N, Withed_Lib_Unit (Item));
end if;
-- Skip pragmas. Configuration pragmas at the start were handled in
-- limited with P.Q;
-- package P.Q is ...
- elsif Unit (Library_Unit (Item)) = Unit (N) then
+ elsif Unit (Withed_Lib_Unit (Item)) = Unit (N) then
Error_Msg_N ("wrong use of limited-with clause", Item);
-- Check wrong use of limited-with clause applied to some
elsif Is_Child_Spec (Unit (N)) then
declare
- Lib_U : constant Entity_Id := Unit (Library_Unit (Item));
- P : Node_Id;
+ Lib_U : constant Entity_Id :=
+ Unit (Withed_Lib_Unit (Item));
+ P : Node_Id;
begin
P := Parent_Spec (Unit (N));
if Item /= It
and then Nkind (It) = N_With_Clause
and then not Limited_Present (It)
- and then Nkind (Unit (Library_Unit (It))) in
+ and then Nkind (Unit (Withed_Lib_Unit (It))) in
N_Package_Declaration |
N_Package_Renaming_Declaration
then
- if Nkind (Unit (Library_Unit (It))) =
+ if Nkind (Unit (Withed_Lib_Unit (It))) =
N_Package_Declaration
then
Unit_Name := Name (It);
else
- Unit_Name := Name (Unit (Library_Unit (It)));
+ Unit_Name := Name (Unit (Withed_Lib_Unit (It)));
end if;
-- Check if the named package (or some ancestor)
-- Skip analyzing with clause if no unit, see above
- if Present (Library_Unit (Item)) then
+ if Present (Withed_Lib_Unit (Item)) then
Analyze (Item);
end if;
-- is a semantic dependency for recompilation purposes.
if not Is_Implicit_With (Item) then
- Version_Update (N, Library_Unit (Item));
+ Version_Update (N, Withed_Lib_Unit (Item));
end if;
-- Pragmas and use clauses and with clauses other than limited with's
else
Set_Corresponding_Stub (Unit (Comp_Unit), N);
Analyze_Subunit (Comp_Unit);
- Set_Library_Unit (N, Comp_Unit);
+ Set_Stub_Subunit (N, Comp_Unit);
Set_Corresponding_Body (N, Defining_Entity (Unit (Comp_Unit)));
end if;
-- If the proper body is already linked to the stub node, the stub is
-- in a generic unit and just needs analyzing.
- if Present (Library_Unit (N)) then
- Set_Corresponding_Stub (Unit (Library_Unit (N)), N);
+ if Present (Stub_Subunit (N)) then
+ Set_Corresponding_Stub (Unit (Stub_Subunit (N)), N);
- -- If the subunit has severe errors, the spec of the enclosing
- -- body may not be available, in which case do not try analysis.
+ -- If the subunit has errors, the spec of the enclosing body might
+ -- not be available, in which case do not try analysis.
if Serious_Errors_Detected > 0
- and then No (Library_Unit (Library_Unit (N)))
+ and then No (Subunit_Parent (Stub_Subunit (N)))
then
return;
end if;
and then In_Extended_Main_Source_Unit
(Cunit_Entity (Current_Sem_Unit))
then
- SCO_Record_Raw (Get_Cunit_Unit_Number (Library_Unit (N)));
+ SCO_Record_Raw (Get_Cunit_Unit_Number (Stub_Subunit (N)));
end if;
- Analyze_Subunit (Library_Unit (N));
+ Analyze_Subunit (Stub_Subunit (N));
-- Otherwise we must load the subunit and link to it
Set_Corresponding_Stub (Unit (Cunit (Unum)), N);
Analyze_Subunit (Cunit (Unum));
- Set_Library_Unit (N, Cunit (Unum));
+ Set_Stub_Subunit (N, Cunit (Unum));
end if;
end if;
-- substitution of subunits, it makes sense to include it in the
-- version identification.
- if Present (Library_Unit (N)) then
- Set_Corresponding_Stub (Unit (Library_Unit (N)), N);
- Analyze_Subunit (Library_Unit (N));
- Version_Update (Cunit (Main_Unit), Library_Unit (N));
+ if Present (Stub_Subunit (N)) then
+ Set_Corresponding_Stub (Unit (Stub_Subunit (N)), N);
+ Analyze_Subunit (Stub_Subunit (N));
+ Version_Update (Cunit (Main_Unit), Stub_Subunit (N));
-- Otherwise we must load the subunit and link to it
else
Set_Corresponding_Stub (Unit (Comp_Unit), N);
- Set_Library_Unit (N, Comp_Unit);
+ Set_Stub_Subunit (N, Comp_Unit);
-- We update the version. Although we are not technically
-- semantically dependent on the subunit, given our approach
and then Limited_Present (Item)
and then not Is_Implicit_With (Item)
then
- Semantics (Library_Unit (Item));
+ Semantics (Withed_Lib_Unit (Item));
end if;
Next (Item);
-- SPARK mode.
procedure Analyze_Subunit (N : Node_Id) is
- Lib_Unit : constant Node_Id := Library_Unit (N);
+ Lib_Unit : constant Node_Id := Subunit_Parent (N);
Par_Unit : constant Entity_Id := Current_Scope;
- Lib_Spec : Node_Id := Library_Unit (Lib_Unit);
+ Lib_Spec : Node_Id := Other_Comp_Unit (Lib_Unit);
Num_Scopes : Nat := 0;
Use_Clauses : array (1 .. Scope_Stack.Last) of Node_Id;
Enclosing_Child : Entity_Id := Empty;
begin
if Nkind (Unit (L)) = N_Subunit then
- Re_Install_Parents (Library_Unit (L), Scope (Scop));
+ Re_Install_Parents (Subunit_Parent (L), Scope (Scop));
end if;
Install_Context (L, False);
Remove_Context (Lib_Spec);
while Nkind (Unit (Lib_Spec)) = N_Subunit loop
- Lib_Spec := Library_Unit (Lib_Spec);
+ Lib_Spec := Subunit_Parent (Lib_Spec);
Remove_Scope;
Remove_Context (Lib_Spec);
end loop;
if Nkind (Unit (Lib_Spec)) in N_Package_Body | N_Subprogram_Body
then
- Remove_Context (Library_Unit (Lib_Spec));
+ Remove_Context (Spec_Lib_Unit (Lib_Spec));
end if;
end if;
-- instantiation appears indirectly elsewhere in the context, it will
-- have been analyzed already.
- Unit_Kind : constant Node_Kind :=
- Nkind (Original_Node (Unit (Library_Unit (N))));
+ U : constant Node_Id := Unit (Withed_Lib_Unit (N));
+ Unit_Kind : constant Node_Kind := Nkind (Original_Node (U));
Nam : constant Node_Id := Name (N);
E_Name : Entity_Id;
Par_Name : Entity_Id;
Pref : Node_Id;
- U : constant Node_Id := Unit (Library_Unit (N));
Intunit : Boolean;
-- Set True if the unit currently being compiled is an internal unit
-- legality of subsequent (also useless) use clauses depend on the
-- presence of the with clause.
- if Library_Unit (N) = Library_Unit (Cunit (Current_Sem_Unit)) then
+ if Withed_Lib_Unit (N) = Spec_Or_Body_Lib_Unit (Cunit (Current_Sem_Unit))
+ then
Set_Is_Implicit_With (N);
-- Self-referential withs are always useless, so warn
-- Normal (non-self-referential) case
else
- Semantics (Library_Unit (N));
+ Semantics (Withed_Lib_Unit (N));
end if;
Intunit := Is_Internal_Unit (Current_Sem_Unit);
-- visibility purposes we need the entity of its spec.
elsif (Unit_Kind = N_Package_Instantiation
- or else Nkind (Original_Node (Unit (Library_Unit (N)))) =
- N_Package_Instantiation)
+ or else Nkind (Original_Node (Unit (Withed_Lib_Unit (N)))) =
+ N_Package_Instantiation)
and then Nkind (U) = N_Package_Body
then
E_Name := Corresponding_Spec (U);
elsif Unit_Kind = N_Subprogram_Body
and then Nkind (Name (N)) = N_Selected_Component
- and then not Acts_As_Spec (Library_Unit (N))
+ and then not Acts_As_Spec (Withed_Lib_Unit (N))
then
-- For a child unit that has no spec, one has been created and
-- analyzed. The entity required is that of the spec.
-- with_clause for the child unit (e.g. in separate subunits).
if Unit_Kind = N_Subprogram_Declaration
- and then Analyzed (Library_Unit (N))
- and then not Comes_From_Source (Library_Unit (N))
+ and then Analyzed (Withed_Lib_Unit (N))
+ and then not Comes_From_Source (Withed_Lib_Unit (N))
then
- Set_Library_Unit (N,
+ Set_Library_Unit (N, Empty); -- overwritten by Set_Withed_Lib_Unit
+ Set_Withed_Lib_Unit (N,
Cunit (Get_Source_Unit (Corresponding_Body (U))));
end if;
end if;
-- Propagate Fatal_Error setting from with'ed unit to current unit
- case Fatal_Error (Get_Source_Unit (Library_Unit (N))) is
+ case Fatal_Error (Get_Source_Unit (Withed_Lib_Unit (N))) is
-- Nothing to do if with'ed unit had no error
begin
if Nkind (Lib_Unit) in N_Package_Body | N_Subprogram_Body then
- Curr_Unit := Defining_Entity (Unit (Library_Unit (N)));
+ Curr_Unit := Defining_Entity (Unit (Spec_Lib_Unit (N)));
Par_Lib := Curr_Unit;
elsif Nkind (Lib_Unit) = N_Subunit then
-- The parent is itself a body. The parent entity is to be found in
-- the corresponding spec.
- Sub_Parent := Library_Unit (N);
- Curr_Unit := Defining_Entity (Unit (Library_Unit (Sub_Parent)));
+ Sub_Parent := Subunit_Parent (N);
+ Curr_Unit := Defining_Entity (Unit (Other_Comp_Unit (Sub_Parent)));
-- If the parent itself is a subunit, Curr_Unit is the entity of the
-- enclosing body, retrieve the spec entity which is the proper
begin
Set_Corresponding_Spec (Withn, Ent);
Set_Is_Implicit_With (Withn);
- Set_Library_Unit (Withn, Parent (Unit_Declaration_Node (Ent)));
+ Set_Withed_Lib_Unit (Withn, Parent (Unit_Declaration_Node (Ent)));
Set_Parent_With (Withn);
-- If the unit is a [generic] package or subprogram declaration
begin
Set_Corresponding_Spec (Withn, P_Name);
Set_Is_Implicit_With (Withn);
- Set_Library_Unit (Withn, P);
+ Set_Withed_Lib_Unit (Withn, P);
Set_Parent_With (Withn);
-- Node is placed at the beginning of the context items, so that
elsif Nkind (Decl_Node) = N_Subprogram_Body
and then not Acts_As_Spec (Parent (Decl_Node))
- and then Is_Child_Spec (Unit (Library_Unit (Parent (Decl_Node))))
+ and then
+ Is_Child_Spec (Unit (Subunit_Parent (Parent (Decl_Node))))
then
Implicit_With_On_Parent
- (Unit (Library_Unit (Parent (Decl_Node))), N);
+ (Unit (Subunit_Parent (Parent (Decl_Node))), N);
end if;
-- Check license conditions unless this is a dummy unit
- if Sloc (Library_Unit (Item)) /= No_Location then
+ if Sloc (Withed_Lib_Unit (Item)) /= No_Location then
License_Check : declare
Withu : constant Unit_Number_Type :=
- Get_Source_Unit (Library_Unit (Item));
+ Get_Source_Unit (Withed_Lib_Unit (Item));
Withl : constant License_Type :=
License (Source_Index (Withu));
Unitl : constant License_Type :=
or else (Nkind (Lib_Unit) = N_Subprogram_Body
and then not Acts_As_Spec (N))
then
- Install_Context (Library_Unit (N), Chain);
+ Install_Context (Spec_Lib_Unit (N), Chain);
-- Only install private with-clauses of a spec that comes from
-- source, excluding specs created for a subprogram body that is
-- a child unit.
- if Comes_From_Source (Library_Unit (N)) then
+ if Comes_From_Source (Spec_Lib_Unit (N)) then
Install_Private_With_Clauses
- (Defining_Entity (Unit (Library_Unit (N))));
+ (Defining_Entity (Unit (Spec_Lib_Unit (N))));
end if;
- if Is_Child_Spec (Unit (Library_Unit (N))) then
+ if Is_Child_Spec (Unit (Spec_Lib_Unit (N))) then
-- If the unit is the body of a public child unit, the private
-- declarations of the parent must be made visible. If the child
P_Name : Entity_Id;
begin
- Lib_Spec := Unit (Library_Unit (N));
+ Lib_Spec := Unit (Spec_Lib_Unit (N));
while Is_Child_Spec (Lib_Spec) loop
P := Unit (Parent_Spec (Lib_Spec));
P_Name := Defining_Entity (P);
-- For a package body, children in context are immediately visible
- Install_Siblings (Defining_Entity (Unit (Library_Unit (N))), N);
+ Install_Siblings (Defining_Entity (Unit (Spec_Lib_Unit (N))), N);
end if;
if Nkind (Lib_Unit) in N_Generic_Package_Declaration
-- Protect the frontend against previous critical errors
- case Nkind (Unit (Library_Unit (W))) is
+ case Nkind (Unit (Withed_Lib_Unit (W))) is
when N_Generic_Package_Declaration
| N_Generic_Subprogram_Declaration
| N_Package_Declaration
-- Check "use + renamings"
- WEnt := Defining_Unit_Name (Specification (Unit (Library_Unit (W))));
+ WEnt :=
+ Defining_Unit_Name (Specification (Unit (Withed_Lib_Unit (W))));
Spec := Specification (Unit (P));
Item := First (Visible_Declarations (Spec));
begin
-- Compilation unit of the parent of the withed library unit
- Child_Parent := Library_Unit (Item);
+ Child_Parent := Withed_Lib_Unit (Item);
-- If the child unit is a public child, then locate its nearest
-- private ancestor, if any, then Child_Parent will then be set to
-- the parent of that ancestor.
- if not Private_Present (Library_Unit (Item)) then
+ if not Private_Present (Withed_Lib_Unit (Item)) then
while Present (Child_Parent)
and then not Private_Present (Child_Parent)
loop
begin
-- A limited with_clause cannot appear in the same context_clause
- -- as a nonlimited with_clause which mentions the same library.
+ -- as a nonlimited with_clause which mentions the same library
+ -- unit.
Item := First (Context_Items (Comp_Unit));
while Present (Item) loop
if Nkind (Item) = N_With_Clause
- and then Library_Unit (Item) = Library_Unit (W)
+ and then Withed_Lib_Unit (Item) = Withed_Lib_Unit (W)
then
return True;
end if;
return;
end if;
- Set_Library_Unit (Withn, Cunit (Unum));
+ Set_Withed_Lib_Unit (Withn, Cunit (Unum));
Set_Corresponding_Spec
(Withn, Specification (Unit (Cunit (Unum))));
-- the private clause is installed before analyzing the private
-- part of the current unit.
- if Library_Unit (Item) /= Cunit (Current_Sem_Unit)
+ if Withed_Lib_Unit (Item) /= Cunit (Current_Sem_Unit)
and then not Limited_View_Installed (Item)
and then
not Is_Ancestor_Unit
- (Library_Unit (Item), Cunit (Current_Sem_Unit))
+ (Withed_Lib_Unit (Item), Cunit (Current_Sem_Unit))
then
if not Private_Present (Item)
or else Private_Present (N)
if Limited_Present (Item) then
if not Limited_View_Installed (Item)
and then
- not Is_Ancestor_Unit (Library_Unit (Item),
+ not Is_Ancestor_Unit (Withed_Lib_Unit (Item),
Cunit (Current_Sem_Unit))
then
Install_Limited_With_Clause (Item);
---------------------------------
procedure Install_Limited_With_Clause (N : Node_Id) is
- P_Unit : constant Entity_Id := Unit (Library_Unit (N));
+ P_Unit : constant Entity_Id := Unit (Withed_Lib_Unit (N));
E : Entity_Id;
P : Entity_Id;
Is_Child_Package : Boolean := False;
and then Nkind (Decl) = N_Pragma
loop
if Get_Pragma_Id (Decl) = Pragma_Elaborate_Body then
- Set_Body_Required (Library_Unit (N));
+ Set_Body_Required (Withed_Lib_Unit (N));
return;
end if;
-- If no completion, this is a TAT, and a body is needed
if No (Decl) then
- Set_Body_Required (Library_Unit (N));
+ Set_Body_Required (Withed_Lib_Unit (N));
return;
end if;
null;
else
- Set_Body_Required (Library_Unit (N));
+ Set_Body_Required (Withed_Lib_Unit (N));
return;
end if;
if Is_Child_Unit
(Defining_Entity
- (Unit (Library_Unit (Cunit (Current_Sem_Unit)))))
+ (Unit (Spec_Lib_Unit (Cunit (Current_Sem_Unit)))))
then
return;
end if;
Set_Is_Visible_Lib_Unit
(Related_Instance
- (Defining_Entity (Unit (Library_Unit (With_Clause)))));
+ (Defining_Entity (Unit (Withed_Lib_Unit (With_Clause)))));
end if;
-- The parent unit may have been installed already, and may have
E2 : Entity_Id;
begin
if Nkind (Unit (U2)) in N_Package_Body | N_Subprogram_Body then
- E2 := Defining_Entity (Unit (Library_Unit (U2)));
+ E2 := Defining_Entity (Unit (Spec_Lib_Unit (U2)));
return Is_Ancestor_Package (E1, E2);
else
return False;
while Present (Item) loop
if Nkind (Item) = N_With_Clause
and then not Limited_Present (Item)
- and then Nkind (Unit (Library_Unit (Item))) =
+ and then Nkind (Unit (Withed_Lib_Unit (Item))) =
N_Package_Declaration
then
Decl :=
First (Visible_Declarations
- (Specification (Unit (Library_Unit (Item)))));
+ (Specification (Unit (Withed_Lib_Unit (Item)))));
while Present (Decl) loop
if Nkind (Decl) = N_Package_Renaming_Declaration
and then Entity (Name (Decl)) = P
and then not Is_Limited_Withed_Unit
- (Lib_Unit => Library_Unit (Item),
+ (Lib_Unit => Withed_Lib_Unit (Item),
Pkg_Ent => Entity (Name (Decl)))
then
-- Generate the error message only if the current unit
-- If it is a body not acting as spec, follow pointer to the
-- corresponding spec, otherwise follow pointer to parent spec.
- if Present (Library_Unit (Aux_Unit))
- and then Nkind (Unit (Aux_Unit)) in
- N_Package_Body | N_Subprogram_Body
+ if Nkind (Unit (Aux_Unit)) in N_Package_Body | N_Subprogram_Body
+ and then Present (Spec_Lib_Unit (Aux_Unit))
then
- if Aux_Unit = Library_Unit (Aux_Unit) then
+ if Aux_Unit = Spec_Lib_Unit (Aux_Unit) then
-- Aux_Unit is a body that acts as a spec. Clause has
-- already been flagged as illegal.
return False;
else
- Aux_Unit := Library_Unit (Aux_Unit);
+ Aux_Unit := Spec_Lib_Unit (Aux_Unit);
end if;
else
procedure Build_Limited_Views (N : Node_Id) is
Unum : constant Unit_Number_Type :=
- Get_Source_Unit (Library_Unit (N));
+ Get_Source_Unit (Withed_Lib_Unit (N));
Is_Analyzed : constant Boolean := Analyzed (Cunit (Unum));
Shadow_Pack : Entity_Id;
-- declaration, not a subprogram declaration, generic declaration,
-- generic instantiation, or package renaming declaration.
- case Nkind (Unit (Library_Unit (N))) is
+ case Nkind (Unit (Withed_Lib_Unit (N))) is
when N_Package_Declaration =>
null;
-- Check if the chain is already built
- Spec := Specification (Unit (Library_Unit (N)));
+ Spec := Specification (Unit (Withed_Lib_Unit (N)));
if Limited_View_Installed (Spec) then
return;
while Present (CI) loop
if Nkind (CI) = N_With_Clause
and then not
- No_Elab_Code_All (Get_Source_Unit (Library_Unit (CI)))
+ No_Elab_Code_All (Get_Source_Unit (Withed_Lib_Unit (CI)))
-- In GNATprove mode, some runtime units are implicitly
-- loaded to make their entities available for analysis. In
and then not Is_Implicit_With (Item)
then
Set_Is_Immediately_Visible
- (Defining_Entity (Unit (Library_Unit (Item))), False);
+ (Defining_Entity (Unit (Withed_Lib_Unit (Item))), False);
end if;
end if;
--------------------------------
procedure Remove_Limited_With_Clause (N : Node_Id) is
- Pack_Decl : constant Entity_Id := Unit (Library_Unit (N));
+ Pack_Decl : constant Entity_Id := Unit (Withed_Lib_Unit (N));
begin
pragma Assert (Limited_View_Installed (N));
end if;
if Ekind (Curr_Unit) = E_Package_Body then
- Remove_Context (Library_Unit (Curr_Comp));
+ Remove_Context (Spec_Lib_Unit (Curr_Comp));
end if;
end if;
Body_Cunit := Parent (N);
- -- The two compilation unit nodes are linked by the Library_Unit field
+ -- Set spec/body links for the two compilation units
- Set_Library_Unit (Decl_Cunit, Body_Cunit);
- Set_Library_Unit (Body_Cunit, Decl_Cunit);
+ Set_Body_Lib_Unit (Decl_Cunit, Body_Cunit);
+ Set_Spec_Lib_Unit (Body_Cunit, Decl_Cunit);
-- Preserve the private nature of the package if needed
-- stub in the original generic unit with the subunit, in order
-- to preserve non-local references within.
- -- Only the proper body needs to be copied. Library_Unit and
- -- context clause are simply inherited by the generic copy.
- -- Note that the copy (which may be recursive if there are
- -- nested subunits) must be done first, before attaching it to
- -- the enclosing generic.
+ -- Only the proper body needs to be copied. The context clause
+ -- and Spec_Or_Body_Lib_Unit are simply inherited by the
+ -- generic copy. Note that the copy (which may be recursive
+ -- if there are nested subunits) must be done first, before
+ -- attaching it to the enclosing generic.
New_Body :=
Copy_Generic_Node
-- copy, which does not have stubs any longer.
Set_Proper_Body (Unit (Subunit), New_Body);
- Set_Library_Unit (New_N, Subunit);
+ Set_Stub_Subunit (New_N, Subunit);
Inherit_Context (Unit (Subunit), N);
end;
<<Subunit_Not_Found>> null;
- -- If the node is a compilation unit, it is the subunit of a stub, which
- -- has been loaded already (see code below). In this case, the library
- -- unit field of N points to the parent unit (which is a compilation
- -- unit) and need not (and cannot) be copied.
+ -- If the node is a compilation unit, it is the subunit of a stub that
+ -- has already been loaded. The parent unit is a compilation unit and
+ -- need not (and cannot) be copied.
- -- When the proper body of the stub is analyzed, the library_unit link
- -- is used to establish the proper context (see sem_ch10).
+ -- When the proper body of the stub is analyzed, the Subunit_Parent
+ -- field is used to establish the proper context (see Sem_Ch10).
-- The other fields of a compilation unit are copied as usual
elsif Nkind (N) = N_Compilation_Unit then
+ pragma Assert (Unit (N) in N_Subunit_Id);
-- This code can only be executed when not instantiating, because in
-- the copy made for an instantiation, the compilation unit node has
if Nkind (B) = N_Package_Body then
Id := Corresponding_Spec (B);
else pragma Assert (Nkind (B) = N_Package_Body_Stub);
- Id := Corresponding_Spec (Proper_Body (Unit (Library_Unit (B))));
+ Id := Corresponding_Spec (Proper_Body (Unit (Stub_Subunit (B))));
end if;
Ensure_Freeze_Node (Id);
begin
if Nkind (Enc_N) = N_Package_Body_Stub then
- Enclosing_Body := Proper_Body (Unit (Library_Unit (Enc_N)));
+ Enclosing_Body := Proper_Body (Unit (Stub_Subunit (Enc_N)));
else
Enclosing_Body := Enc_N;
end if;
Item := First (Context_Items (Parent (Gen_Decl)));
while Present (Item) loop
if Nkind (Item) = N_With_Clause then
- Lib_Unit := Library_Unit (Item);
+ Lib_Unit := Withed_Lib_Unit (Item);
-- Take care to prevent direct cyclic with's
OK := True;
while Present (Clause) loop
if Nkind (Clause) = N_With_Clause
- and then Library_Unit (Clause) = Lib_Unit
+ and then Withed_Lib_Unit (Clause) = Lib_Unit
then
OK := False;
exit;
not In_Same_Source_Unit (Generic_Parent (Par_Inst), Inst)
then
while Present (Decl) loop
- if ((Nkind (Decl) in N_Unit_Body
+ if ((Nkind (Decl) in N_Lib_Unit_Body
or else
Nkind (Decl) in N_Body_Stub)
and then Comes_From_Source (Decl))
return
Current_Unit = Cunit (Main_Unit)
- or else Current_Unit = Library_Unit (Cunit (Main_Unit))
+ or else Current_Unit = Other_Comp_Unit (Cunit (Main_Unit))
or else (Present (Current_Unit)
- and then Present (Library_Unit (Current_Unit))
- and then Is_In_Main_Unit (Library_Unit (Current_Unit)));
+ and then Present (Other_Comp_Unit (Current_Unit))
+ and then Is_In_Main_Unit (Other_Comp_Unit (Current_Unit)));
end Is_In_Main_Unit;
----------------------------
begin
if Id = Cunit_Entity (Main_Unit)
- or else Parent (Decl) = Library_Unit (Cunit (Main_Unit))
+ or else Parent (Decl) = Other_Comp_Unit (Cunit (Main_Unit))
then
Generate_Reference (Id, Scope (Id), 'k', False);
begin
if Nkind (Main_Spec) = N_Package_Body then
- Main_Spec := Unit (Library_Unit (Cunit (Main_Unit)));
+ Main_Spec := Unit (Other_Comp_Unit (Cunit (Main_Unit)));
end if;
U := Parent_Spec (Main_Spec);
or else (Nkind (The_Unit) = N_Subprogram_Body
and then not Acts_As_Spec (Cunit (Current_Sem_Unit))))
then
- With_Sys := Find_System (Library_Unit (Cunit (Current_Sem_Unit)));
+ With_Sys :=
+ Find_System (Spec_Or_Body_Lib_Unit (Cunit (Current_Sem_Unit)));
end if;
if No (With_Sys) and then Present (N) then
Set_Corresponding_Spec (Withn, System_Aux_Id);
Set_First_Name (Withn);
Set_Is_Implicit_With (Withn);
- Set_Library_Unit (Withn, Cunit (Unum));
+ Set_Withed_Lib_Unit (Withn, Cunit (Unum));
Insert_After (With_Sys, Withn);
Mark_Rewrite_Insertion (Withn);
Set_Context_Items (Main_Cunit, Items);
end if;
- -- Locate the with clause for the unit. Note that there may not be a
- -- clause if the unit is visible through a subunit-body, body-spec,
- -- or spec-parent relationship.
+ -- Locate the with clause for the unit. Note that there might not be
+ -- a with clause if the unit is visible through a subunit-body,
+ -- body-spec, or spec-parent relationship.
Clause :=
Find_With_Clause
-- Note that adding implicit with clauses is safe because analysis,
-- resolution, and expansion have already taken place and it is not
- -- possible to interfere with visibility.
+ -- possible to interfere with visibility. Note that this implicit
+ -- with clause can point at (for example) a package body, which
+ -- is not the case for normal with clauses.
if No (Clause) then
Clause :=
Make_With_Clause (Loc,
Name => New_Occurrence_Of (Unit_Id, Loc));
-
Set_Is_Implicit_With (Clause);
- Set_Library_Unit (Clause, Unit_Cunit);
-
+ Set_Withed_Lib_Unit (Clause, Unit_Cunit);
Append_To (Items, Clause);
end if;
elsif Nkind (Item) = N_Package_Body_Stub
and then Chars (Defining_Entity (Item)) = Spec_Nam
then
- Lib_Unit := Library_Unit (Item);
+ Lib_Unit := Stub_Subunit (Item);
-- The corresponding subunit was previously loaded
-- This procedure is called when the elaborate indication must be
-- applied to a unit not in the context of the referencing unit. The
-- unit gets added to the context as an implicit with.
+ -- Note that we can be with-ing (for example) a package body, which
+ -- is not the case for normal with clauses.
function In_Withs_Of (UEs : Entity_Id) return Boolean;
-- UEs is the spec entity of a unit. If the unit to be marked is
begin
Set_Is_Implicit_With (CW);
- Set_Library_Unit (CW, Library_Unit (Itm));
+ Set_Withed_Lib_Unit (CW, Withed_Lib_Unit (Itm));
-- Set elaborate all desirable on copy and then append the copy to
-- the list of body with's and we are done.
while Present (Itm) loop
if Nkind (Itm) = N_With_Clause then
Ent :=
- Cunit_Entity (Get_Cunit_Unit_Number (Library_Unit (Itm)));
+ Cunit_Entity (Get_Cunit_Unit_Number (Withed_Lib_Unit (Itm)));
if U = Ent then
return True;
Itm := First (CI);
while Present (Itm) loop
if Nkind (Itm) = N_With_Clause then
- Ent := Cunit_Entity (Get_Cunit_Unit_Number (Library_Unit (Itm)));
+ Ent :=
+ Cunit_Entity (Get_Cunit_Unit_Number (Withed_Lib_Unit (Itm)));
-- If we find it, then mark elaborate all desirable and return
elsif Nkind (Nod) = N_Package_Body_Stub
and then Chars (Defining_Identifier (Nod)) = Chars (E)
then
- if Present (Library_Unit (Nod)) then
- return Unit (Library_Unit (Nod));
+ if Present (Stub_Subunit (Nod)) then
+ return Unit (Stub_Subunit (Nod));
else
return Load_Package_Body (Get_Unit_Name (Nod));
-- in each N_Compilation_Unit node, but that would involve
-- rearranging N_Compilation_Unit_Aux to make room.
- Helper (Get_Cunit_Unit_Number (Library_Unit (Item)));
+ Helper (Get_Cunit_Unit_Number (Withed_Lib_Unit (Item)));
if Result then
return;
then
Set_Has_Pragma_Unreferenced
(Cunit_Entity
- (Get_Source_Unit
- (Library_Unit (Citem))));
+ (Get_Source_Unit (Withed_Lib_Unit (Citem))));
Set_Elab_Unit_Name (Arg_Expr, Name (Citem));
exit;
end if;
Decl : Node_Id;
Err : Boolean;
- function Same_Convention (Decl : Node_Id) return Boolean;
+ function Matching_Convention (Decl : Node_Id) return Boolean;
-- Decl is a pragma node. This function returns True if this
-- pragma has a first argument that is an identifier with a
-- Chars field corresponding to the Convention_Id C.
- function Same_Name (Decl : Node_Id) return Boolean;
+ function Matching_Name (Decl : Node_Id) return Boolean;
-- Decl is a pragma node. This function returns True if this
-- pragma has a second argument that is an identifier with a
-- Chars field that matches the Chars of the current subprogram.
- ---------------------
- -- Same_Convention --
- ---------------------
+ -------------------------
+ -- Matching_Convention --
+ -------------------------
- function Same_Convention (Decl : Node_Id) return Boolean is
+ function Matching_Convention (Decl : Node_Id) return Boolean is
Arg1 : constant Node_Id :=
First (Pragma_Argument_Associations (Decl));
end if;
return False;
- end Same_Convention;
+ end Matching_Convention;
- ---------------
- -- Same_Name --
- ---------------
+ -------------------
+ -- Matching_Name --
+ -------------------
- function Same_Name (Decl : Node_Id) return Boolean is
+ function Matching_Name (Decl : Node_Id) return Boolean is
Arg1 : constant Node_Id :=
First (Pragma_Argument_Associations (Decl));
Arg2 : Node_Id;
end;
return False;
- end Same_Name;
+ end Matching_Name;
-- Start of processing for Diagnose_Multiple_Pragmas
-- Look for pragma with same name as us
if Nkind (Decl) = N_Pragma
- and then Same_Name (Decl)
+ and then Matching_Name (Decl)
then
-- Give error if same as our pragma or Export/Convention
-- they specify the same convention. If so, all OK,
-- and set special flags to stop other messages
- if Same_Convention (Decl) then
+ if Matching_Convention (Decl) then
Set_Import_Interface_Present (N);
Set_Import_Interface_Present (Decl);
Err := False;
while Present (Encl_Unit)
and then Nkind (Unit (Encl_Unit)) = N_Subunit
loop
- Encl_Unit := Library_Unit (Encl_Unit);
+ Encl_Unit := Subunit_Parent (Encl_Unit);
end loop;
pragma Assert (Nkind (Encl_Unit) = N_Compilation_Unit);
function Get_Body_From_Stub (N : Node_Id) return Node_Id is
begin
- return Proper_Body (Unit (Library_Unit (N)));
+ return Proper_Body (Unit (Stub_Subunit (N)));
end Get_Body_From_Stub;
---------------------
return Is_RCI_Pkg_Decl_Cunit (Cunit)
or else
(Nkind (Unit (Cunit)) = N_Package_Body
- and then Is_RCI_Pkg_Decl_Cunit (Library_Unit (Cunit)));
+ and then Is_RCI_Pkg_Decl_Cunit (Spec_Lib_Unit (Cunit)));
end Is_RCI_Pkg_Spec_Or_Body;
-----------------------------------------
K2 : constant Node_Kind := Nkind (N2);
begin
- if (K1 = N_Identifier or else K1 = N_Defining_Identifier)
- and then (K2 = N_Identifier or else K2 = N_Defining_Identifier)
+ if K1 in N_Identifier | N_Defining_Identifier
+ and then K2 in N_Identifier | N_Defining_Identifier
then
return Chars (N1) = Chars (N2);
- elsif (K1 = N_Selected_Component or else K1 = N_Expanded_Name)
- and then (K2 = N_Selected_Component or else K2 = N_Expanded_Name)
+ elsif K1 in N_Selected_Component | N_Expanded_Name
+ and then K2 in N_Selected_Component | N_Expanded_Name
then
return Same_Name (Selector_Name (N1), Selector_Name (N2))
and then Same_Name (Prefix (N1), Prefix (N2));
Clause := First (Context_Items (Comp_Unit));
while Present (Clause) loop
if Nkind (Clause) = N_With_Clause then
- if Library_Unit (Clause) = U then
+ if Withed_Lib_Unit (Clause) = U then
return True;
-- The with_clause may denote a renaming of the unit we are
(Nkind (Unit (Curr)) = N_Subprogram_Body
and then not Acts_As_Spec (Unit (Curr)))
then
- if Unit_In_Context (Library_Unit (Curr)) then
+ if Unit_In_Context (Spec_Lib_Unit (Curr)) then
return True;
end if;
end if;
-- If the spec is a child unit, examine the parents
if Is_Child_Unit (Curr_Entity) then
- if Nkind (Unit (Curr)) in N_Unit_Body then
+ if Nkind (Unit (Curr)) in N_Lib_Unit_Body then
return
Unit_In_Parent_Context
- (Parent_Spec (Unit (Library_Unit (Curr))));
+ (Parent_Spec (Unit (Spec_Lib_Unit (Curr))));
else
return Unit_In_Parent_Context (Parent_Spec (Unit (Curr)));
end if;
-- capture actual value information, but we can capture conditional tests.
function Same_Name (N1, N2 : Node_Id) return Boolean;
- -- Determine if two (possibly expanded) names are the same name. This is
- -- a purely syntactic test, and N1 and N2 need not be analyzed.
+ -- True if two identifiers or expanded names are the same name. This
+ -- is a purely syntactic test, and N1 and N2 need not be analyzed.
function Same_Object (Node1, Node2 : Node_Id) return Boolean;
-- Determine if Node1 and Node2 are known to designate the same object.
package body Sinfo.Utils is
+ function Spec_Lib_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id
+ is
+ pragma Assert (Unit (N) in N_Lib_Unit_Body_Id);
+ begin
+ return Val : constant Opt_N_Compilation_Unit_Id :=
+ Spec_Or_Body_Lib_Unit (N)
+ do
+ pragma Assert
+ (if Present (Val) then
+ Unit (Val) in N_Lib_Unit_Declaration_Id
+ | N_Lib_Unit_Renaming_Declaration_Id -- only in case of error
+ or else (N = Val
+ and then Unit (N) in N_Subprogram_Body_Id
+ and then Acts_As_Spec (N)));
+ end return;
+ end Spec_Lib_Unit;
+
+ procedure Set_Spec_Lib_Unit (N, Val : N_Compilation_Unit_Id) is
+ pragma Assert (Unit (N) in N_Lib_Unit_Body_Id);
+ pragma Assert
+ (Unit (Val) in N_Lib_Unit_Declaration_Id
+ | N_Lib_Unit_Renaming_Declaration_Id -- only in case of error
+ or else (N = Val
+ and then Unit (N) in N_Subprogram_Body_Id
+ and then Acts_As_Spec (N)));
+ begin
+ Set_Library_Unit (N, Val);
+ end Set_Spec_Lib_Unit;
+
+ function Body_Lib_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id
+ is
+ pragma Assert
+ (Unit (N) in N_Lib_Unit_Declaration_Id
+ | N_Lib_Unit_Renaming_Declaration_Id); -- only in case of error
+ begin
+ return Val : constant Opt_N_Compilation_Unit_Id :=
+ Spec_Or_Body_Lib_Unit (N)
+ do
+ pragma Assert
+ (if Present (Val) then Unit (Val) in N_Lib_Unit_Body_Id);
+ end return;
+ end Body_Lib_Unit;
+
+ procedure Set_Body_Lib_Unit (N, Val : N_Compilation_Unit_Id) is
+ pragma Assert
+ (Unit (N) in N_Lib_Unit_Declaration_Id
+ | N_Lib_Unit_Renaming_Declaration_Id); -- only in case of error
+ pragma Assert (Unit (Val) in N_Lib_Unit_Body_Id);
+ begin
+ Set_Library_Unit (N, Val);
+ end Set_Body_Lib_Unit;
+
+ function Spec_Or_Body_Lib_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id
+ is
+ pragma Assert
+ (Unit (N) in
+ N_Lib_Unit_Declaration_Id | N_Lib_Unit_Body_Id
+ | N_Lib_Unit_Renaming_Declaration_Id);
+ begin
+ return Other_Comp_Unit (N);
+ end Spec_Or_Body_Lib_Unit;
+
+ function Subunit_Parent
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id
+ is
+ pragma Assert (Unit (N) in N_Subunit_Id);
+ begin
+ return Val : constant Opt_N_Compilation_Unit_Id := Other_Comp_Unit (N) do
+ pragma Assert
+ (if Present (Val) then
+ Unit (Val) in N_Lib_Unit_Body_Id | N_Subunit_Id);
+ end return;
+ end Subunit_Parent;
+
+ procedure Set_Subunit_Parent (N, Val : N_Compilation_Unit_Id) is
+ pragma Assert (Unit (N) in N_Subunit_Id);
+ pragma Assert (Unit (Val) in N_Lib_Unit_Body_Id | N_Subunit_Id);
+ begin
+ Set_Library_Unit (N, Val);
+ end Set_Subunit_Parent;
+
+ function Other_Comp_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id
+ is
+ pragma Assert (N in N_Compilation_Unit_Id);
+ Val : constant Opt_N_Compilation_Unit_Id := Library_Unit (N);
+ begin
+ if Unit (N) in N_Subunit_Id then
+ pragma Assert
+ (if Present (Val) then
+ Unit (Val) in N_Lib_Unit_Body_Id | N_Subunit_Id);
+ end if;
+
+ return Library_Unit (N);
+ end Other_Comp_Unit;
+
+ function Stub_Subunit
+ (N : N_Body_Stub_Id) return Opt_N_Compilation_Unit_Id is
+ begin
+ return Val : constant Opt_N_Compilation_Unit_Id := Library_Unit (N) do
+ pragma Assert (if Present (Val) then Unit (Val) in N_Subunit_Id);
+ end return;
+ end Stub_Subunit;
+
+ procedure Set_Stub_Subunit
+ (N : N_Body_Stub_Id; Val : N_Compilation_Unit_Id)
+ is
+ pragma Assert (Unit (Val) in N_Subunit_Id);
+ begin
+ Set_Library_Unit (N, Val);
+ end Set_Stub_Subunit;
+
+ function Withed_Lib_Unit
+ (N : N_With_Clause_Id) return Opt_N_Compilation_Unit_Id is
+ begin
+ return Val : constant Opt_N_Compilation_Unit_Id := Library_Unit (N) do
+ pragma Assert
+ (if Present (Val) then
+ Unit (Val) in N_Lib_Unit_Declaration_Id
+ | N_Lib_Unit_Renaming_Declaration_Id
+ | N_Package_Body_Id | N_Subprogram_Body_Id
+ | N_Null_Statement_Id); -- for ignored ghost code
+ end return;
+ end Withed_Lib_Unit;
+
+ procedure Set_Withed_Lib_Unit
+ (N : N_With_Clause_Id; Val : N_Compilation_Unit_Id)
+ is
+ pragma Assert
+ (Unit (Val) in N_Lib_Unit_Declaration_Id
+ | N_Lib_Unit_Renaming_Declaration_Id
+ | N_Package_Body_Id | N_Subprogram_Body_Id);
+ begin
+ Set_Library_Unit (N, Val);
+ end Set_Withed_Lib_Unit;
+
---------------
-- Debugging --
---------------
package Sinfo.Utils is
+ -- We would like to get rid of the Library_Unit field, and replace it with
+ -- Other_Comp_Unit (on N_Compilation_Unit), Withed_Lib_Unit (on
+ -- N_With_Clause), and Subunit (on N_Body_Stub). Or we could split
+ -- Other_Comp_Unit into Spec_Lib_Unit, Body_Lib_Unit, Subunit_Parent.
+ -- However, gnat-llvm, codepeer, and spark are still using Library_Unit.
+ -- Therefore, we use the wrappers below.
+ --
+ -- The call site should always know whether it has an N_Compilation_Unit,
+ -- N_Body_Stub, or N_With_Clause. In the N_Compilation_Unit case, it should
+ -- also know whether it's looking for the spec of a body, the body of a
+ -- spec, or the parent of a subunit. Spec_Or_Body_Lib_Unit and
+ -- Other_Comp_Unit should be avoided when possible; these are for the
+ -- N_Compilation_Unit cases where the call site does NOT know what it's
+ -- looking for.
+
+ function Spec_Lib_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id;
+ procedure Set_Spec_Lib_Unit (N, Val : N_Compilation_Unit_Id);
+ -- The spec compilation unit of a body compilation unit.
+ -- It can be an acts-as-spec subprogram body; in that case
+ -- Spec_Lib_Unit points to itself.
+
+ function Body_Lib_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id;
+ procedure Set_Body_Lib_Unit (N, Val : N_Compilation_Unit_Id);
+ -- The body compilation unit of a spec compilation unit.
+ -- Empty if not present.
+
+ function Spec_Or_Body_Lib_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id;
+ -- Same as Spec_Lib_Unit or Body_Lib_Unit, depending on whether
+ -- N is a body or spec. Used when we know N is a library unit
+ -- (not a subunit), but we don't know whether it's the spec
+ -- or the body.
+
+ function Subunit_Parent
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id;
+ procedure Set_Subunit_Parent (N, Val : N_Compilation_Unit_Id);
+ -- The parent body of a subunit
+
+ function Other_Comp_Unit
+ (N : N_Compilation_Unit_Id) return Opt_N_Compilation_Unit_Id;
+ -- Same as Spec_Lib_Unit, Body_Lib_Unit, or Subunit_Parent,
+ -- as appropriate. Used when we don't know whether N is a
+ -- a library unit spec, library unit body, or subunit.
+
+ function Stub_Subunit (N : N_Body_Stub_Id) return Opt_N_Compilation_Unit_Id;
+ procedure Set_Stub_Subunit
+ (N : N_Body_Stub_Id; Val : N_Compilation_Unit_Id);
+ -- Subunit corresponding to a stub
+
+ function Withed_Lib_Unit
+ (N : N_With_Clause_Id) return Opt_N_Compilation_Unit_Id;
+ procedure Set_Withed_Lib_Unit
+ (N : N_With_Clause_Id; Val : N_Compilation_Unit_Id);
+ -- The compilation unit that a with clause refers to.
+ -- Note that the Sem_Elab creates with clauses that point to bodies
+ -- (including non-Acts_As_Spec bodies).
+
-------------------------------
-- Parent-related operations --
-------------------------------
-- Miscellaneous Tree Access Subprograms --
-------------------------------------------
- function First_Real_Statement -- ????
+ function First_Real_Statement -- ???
(Ignored : N_Handled_Sequence_Of_Statements_Id) return Node_Id is (Empty);
- -- The First_Real_Statement field is going away, but it is referenced in
+ -- The First_Real_Statement field has been removed, but it is referenced in
-- codepeer and gnat-llvm. This is a temporary version, always returning
-- Empty, to ease the transition.
-- handler.
-- Library_Unit
- -- In a stub node, Library_Unit points to the compilation unit node of
- -- the corresponding subunit.
+ -- Direct use of this field should be avoided; use the wrappers in
+ -- Sinfo.Utils instead.
--
- -- In a with clause node, Library_Unit points to the spec of the with'ed
- -- unit.
+ -- This field is used to store the following:
--
- -- In a compilation unit node, the usage depends on the unit type:
+ -- In N_Compilation_Unit: Spec_Lib_Unit, Body_Lib_Unit, Subunit_Parent.
--
- -- For a library unit body, Library_Unit points to the compilation unit
- -- node of the corresponding spec, unless it's a subprogram body with
- -- Acts_As_Spec set, in which case it points to itself.
+ -- In N_Body_Stub: Stub_Subunit.
--
- -- For a spec, Library_Unit points to the compilation unit node of the
- -- corresponding body, if present. The body will be present if the spec
- -- is or contains generics that we needed to instantiate. Similarly, the
- -- body will be present if we needed it for inlining purposes. Thus, if
- -- we have a spec/body pair, both of which are present, they point to
- -- each other via Library_Unit.
+ -- In N_With_Clause: Withed_Lib_Unit
--
- -- For a subunit, Library_Unit points to the compilation unit node of
- -- the parent body.
- -- ??? not (always) true, in (at least some, maybe all?) cases it points
- -- to the corresponding spec for the parent body.
- --
- -- Note that this field is not used to hold the parent pointer for child
- -- unit (which might in any case need to use it for some other purpose as
- -- described above). Instead for a child unit, implicit with's are
- -- generated for all parents.
+ -- See Sinfo.Utils for details.
-- Local_Raise_Statements
-- This field is present in exception handler nodes. It is set to
-- | CONTEXT_CLAUSE SUBUNIT
-- The N_Compilation_Unit node itself represents the above syntax.
- -- However, there are two additional items not reflected in the above
+ -- However, there are additional items not reflected in the above
-- syntax. First we have the global declarations that are added by the
-- code generator. These are outer level declarations (so they cannot
-- be represented as being inside the units). An example is the wrapper
-- of elaboration of the library unit (notably the statement that sets
-- the Boolean flag indicating that elaboration is complete).
- -- The third item not reflected in the syntax is pragmas that appear
- -- after the compilation unit. As always pragmas are a problem since
- -- they are not part of the formal syntax, but can be stuck into the
- -- source following a set of ad hoc rules, and we have to find an ad
- -- hoc way of sticking them into the tree. For pragmas that appear
- -- before the library unit, we just consider them to be part of the
- -- context clause, and pragmas can appear in the Context_Items list
- -- of the compilation unit. However, pragmas can also appear after
- -- the library item.
+ -- Pragmas that appear after the compilation unit are not reflected
+ -- in the syntax. (Pragmas that appear before the library unit, are
+ -- considered part of the context clause. Pragmas can also appear in
+ -- the Context_Items list of the compilation unit.)
- -- To deal with all these problems, we create an auxiliary node for
- -- a compilation unit, referenced from the N_Compilation_Unit node,
- -- that contains these items.
+ -- ???For historical reasons, the above information is stored in a
+ -- separate N_Compilation_Unit_Aux node associated with each
+ -- N_Compilation_Unit node. This information could be moved into
+ -- N_Compilation_Unit at this point.
-- N_Compilation_Unit
-- Sloc points to first token of defining unit name
-- Context_Pending
-- Has_No_Elaboration_Code
+ -- Note: The Unit field can be any of N_Lib_Unit_Declaration,
+ -- N_Lib_Unit_Body, N_Lib_Unit_Renaming_Declaration, N_Subunit,
+ -- or (in the case of ignored ghost code) N_Null_Statement.
+
-- N_Compilation_Unit_Aux
-- Sloc is a copy of the Sloc from the N_Compilation_Unit node
-- Declarations (set to No_List if no global declarations)
-- Private_Present set if with_clause has private keyword
-- Limited_Present set if LIMITED is present
-- Next_Implicit_With
- -- Library_Unit
+ -- Library_Unit (i.e. Withed_Lib_Unit)
-- Corresponding_Spec
-- First_Name (set to True if first name or only one name)
-- Last_Name (set to True if last name or only one name)
-- Sloc points to FUNCTION or PROCEDURE
-- Specification
-- Corresponding_Spec_Of_Stub
- -- Library_Unit points to the subunit
+ -- Library_Unit (i.e. Stub_Subunit)
-- Corresponding_Body
-------------------------------
-- Sloc points to PACKAGE
-- Defining_Identifier
-- Corresponding_Spec_Of_Stub
- -- Library_Unit points to the subunit
+ -- Library_Unit (i.e. Stub_Subunit)
-- Corresponding_Body
----------------------------
-- Sloc points to TASK
-- Defining_Identifier
-- Corresponding_Spec_Of_Stub
- -- Library_Unit points to the subunit
+ -- Library_Unit (i.e. Stub_Subunit)
-- Corresponding_Body
-- At_End_Proc (set to Empty if no clean up procedure)
-- Sloc points to PROTECTED
-- Defining_Identifier
-- Corresponding_Spec_Of_Stub
- -- Library_Unit points to the subunit
+ -- Library_Unit (i.e. Stub_Subunit)
-- Corresponding_Body
---------------------