diff options
Diffstat (limited to 'gcc/ada/sem_util.ads')
-rw-r--r-- | gcc/ada/sem_util.ads | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 7ea5657aa2b..8227ee2735b 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -43,10 +43,21 @@ package Sem_Util is -- Add A to the list of access types to process when expanding the -- freeze node of E. - procedure Add_Contract_Item (Item : Node_Id; Subp_Id : Entity_Id); - -- Add a contract item (pragma Precondition, Postcondition, Test_Case, - -- Contract_Cases, Global, Depends) to the contract of a subprogram. Item - -- denotes a pragma and Subp_Id is the related subprogram. + procedure Add_Contract_Item (Prag : Node_Id; Id : Entity_Id); + -- Add pragma Prag to the contract of an entry, a package [body] or a + -- subprogram [body] denoted by Id. The following are valid pragmas: + -- Abstract_States + -- Contract_Cases + -- Depends + -- Global + -- Initial_Condition + -- Initializes + -- Postcondition + -- Precondition + -- Refined_Depends + -- Refined_Global + -- Refined_States + -- Test_Case procedure Add_Global_Declaration (N : Node_Id); -- These procedures adds a declaration N at the library level, to be @@ -319,6 +330,13 @@ package Sem_Util is -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag of -- Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false). + function Contains_Refined_State (Prag : Node_Id) return Boolean; + -- Determine whether pragma Prag contains a reference to the entity of an + -- abstract state with a visible refinement. Prag must denote one of the + -- following pragmas: + -- Depends + -- Global + function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id; -- Utility to create a parameter profile for a new subprogram spec, when -- the subprogram has a body that acts as spec. This is done for some cases @@ -463,6 +481,10 @@ package Sem_Util is -- Note: Enter_Name is not used for overloadable entities, instead these -- are entered using Sem_Ch6.Enter_Overloadable_Entity. + function Entity_Of (N : Node_Id) return Entity_Id; + -- Return the entity of N or Empty. If N is a renaming, return the entity + -- of the root renamed object. + procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id); -- This procedure is called after issuing a message complaining about an -- inappropriate use of limited type T. If useful, it adds additional @@ -735,6 +757,17 @@ package Sem_Util is -- Use_Full_View controls if the check is done using its full view (if -- available). + function Has_No_Obvious_Side_Effects (N : Node_Id) return Boolean; + -- This is a simple minded function for determining whether an expression + -- has no obvious side effects. It is used only for determining whether + -- warnings are needed in certain situations, and is not guaranteed to + -- be accurate in either direction. Exceptions may mean an expression + -- does in fact have side effects, but this may be ignored and True is + -- returned, or a complex expression may in fact be side effect free + -- but we don't recognize it here and return False. The Side_Effect_Free + -- routine in Remove_Side_Effects is much more extensive and perhaps could + -- be shared, so that this routine would be more accurate. + function Has_Null_Exclusion (N : Node_Id) return Boolean; -- Determine whether node N has a null exclusion @@ -874,6 +907,9 @@ package Sem_Util is -- Determines if the given node denotes an atomic object in the sense of -- the legality checks described in RM C.6(12). + function Is_Attribute_Result (N : Node_Id) return Boolean; + -- Determine whether node N denotes attribute 'Result + function Is_Body_Or_Package_Declaration (N : Node_Id) return Boolean; -- Determine whether node N denotes a body or a package declaration @@ -913,6 +949,16 @@ package Sem_Util is -- This is the RM definition, a type is a descendent of another type if it -- is the same type or is derived from a descendent of the other type. + function Is_Child_Or_Sibling + (Pack_1 : Entity_Id; + Pack_2 : Entity_Id; + Private_Child : Boolean) return Boolean; + -- Determine the following relations between two arbitrary packages: + -- 1) One package is the parent of a child package + -- 2) Both packages are siblings and share a common parent + -- If flag Private_Child is set, then the child in case 1) or both siblings + -- in case 2) must be private. + function Is_Concurrent_Interface (T : Entity_Id) return Boolean; -- First determine whether type T is an interface and then check whether -- it is of protected, synchronized or task kind. @@ -1340,6 +1386,16 @@ package Sem_Util is -- convenience, qualified expressions applied to object names are also -- allowed as actuals for this function. + function Original_Aspect_Name (N : Node_Id) return Name_Id; + -- N is a pragma node or aspect specification node. This function returns + -- the name of the pragma or aspect in original source form, taking into + -- account possible rewrites, and also cases where a pragma comes from an + -- aspect (in such cases, the name can be different from the pragma name, + -- e.g. a Pre aspect generates a Precondition pragma). This also deals with + -- the presence of 'Class, which results in one of the special names + -- Name_uPre, Name_uPost, Name_uInvariant, or Name_uType_Invariant being + -- returned to represent the corresponding aspects with x'Class names. + function Primitive_Names_Match (E1, E2 : Entity_Id) return Boolean; -- Returns True if the names of both entities correspond with matching -- primitives. This routine includes support for the case in which one |