diff options
Diffstat (limited to 'gcc/ada/sem_util.ads')
-rw-r--r-- | gcc/ada/sem_util.ads | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index fd749c4..0e97806 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -619,7 +619,21 @@ package Sem_Util is -- Find whether there is a previous definition for name or identifier N in -- the current scope. Because declarations for a scope are not necessarily -- contiguous (e.g. for packages) the first entry on the visibility chain - -- for N is not necessarily in the current scope. + -- for N is not necessarily in the current scope. Take, for example: + -- + -- package P is + -- X : constant := 13; + -- + -- package Q is + -- X : constant := 67; + -- end Q; + -- + -- Y : constant := X; + -- end P; + -- + -- When the declaration of Y is analyzed, the first entry on the visibility + -- chain is the X equal to 67, but Current_Entity_In_Scope returns the X + -- equal to 13. function Current_Scope return Entity_Id; -- Get entity representing current scope @@ -647,6 +661,10 @@ package Sem_Util is -- as Needs_Finalization except with pragma Restrictions (No_Finalization), -- in which case we know that class-wide objects do not need finalization. + function Default_Constructor (Typ : Entity_Id) return Entity_Id; + -- Determine the default constructor (e.g. the constructor with only one + -- formal parameter) for a given type Typ. + function Defining_Entity (N : Node_Id) return Entity_Id; -- Given a declaration N, returns the associated defining entity. If the -- declaration has a specification, the entity is obtained from the @@ -880,14 +898,18 @@ package Sem_Util is -- loop are nested within the block. procedure Find_Overlaid_Entity - (N : Node_Id; - Ent : out Entity_Id; - Off : out Boolean); + (N : Node_Id; + Ent : out Entity_Id; + Ovrl_Typ : out Entity_Id; + Off : out Boolean); -- The node N should be an address representation clause. Determines if the -- target expression is the address of an entity with an optional offset. -- If so, set Ent to the entity and, if there is an offset, set Off to -- True, otherwise to False. If it is not possible to determine that the -- address is of this form, then set Ent to Empty. + -- Ovrl_Typ is set to the type being overlaid and can be different than the + -- type of Ent, for example when the address clause is applied to a record + -- component or to an element of an array. function Find_Parameter_Type (Param : Node_Id) return Entity_Id; -- Return the type of formal parameter Param as determined by its @@ -2095,6 +2117,10 @@ package Sem_Util is -- Determine whether arbitrary declaration Decl denotes a generic package, -- a generic subprogram or a generic body. + function Is_In_Context_Clause (N : Node_Id) return Boolean; + -- Returns True if N appears within the context clause of a unit, and False + -- for any other placement. + function Is_Independent_Object (N : Node_Id) return Boolean; -- Determine whether arbitrary node N denotes a reference to an independent -- object as per RM C.6(8). @@ -2377,6 +2403,7 @@ package Sem_Util is -- Pre -- Pre_Class -- Precondition + -- Program_Exit -- Refined_Depends -- Refined_Global -- Refined_Post @@ -2536,12 +2563,6 @@ package Sem_Util is -- if the entity Ent is not for an object. Last_Assignment_Only has the -- same meaning as for the call with no Ent. - procedure Kill_Size_Check_Code (E : Entity_Id); - -- Called when an address clause or pragma Import is applied to an entity. - -- If the entity is a variable or a constant, and size check code is - -- present, this size check code is killed, since the object will not be - -- allocated by the program. - function Known_Non_Null (N : Node_Id) return Boolean; -- Given a node N for a subexpression of an access type, determines if -- this subexpression yields a value that is known at compile time to @@ -2862,6 +2883,9 @@ package Sem_Util is -- WARNING: this routine should be used in debugging scenarios such as -- tracking down undefined symbols as it is fairly low level. + function Parameter_Count (Subp : Entity_Id) return Nat; + -- Return the number of parameters for a given subprogram Subp. + function Param_Entity (N : Node_Id) return Entity_Id; -- Given an expression N, determines if the expression is a reference -- to a formal (of a subprogram or entry), and if so returns the Id |