This patch removes much of the logic relating to static and dynamic
accessibility level checks and replaces it with a simplified and
centralized implementation.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * checks.adb (Apply_Accessibility_Check): Modify condition to
        avoid flawed optimization and use Get_Accessibility over
        Extra_Accessibility.
        * exp_attr.adb: Remove inclusion of Exp_Ch2.adb.
        * exp_ch2.adb, exp_ch2.ads (Param_Entity): Moved to sem_util.
        * exp_ch3.ads (Init_Proc_Level_Formal): New function.
        * exp_ch3.adb (Build_Init_Procedure): Add extra accessibility
        formal for init procs when the associated type is a limited
        record.
        (Build_Initialization_Call): Add condition to handle propagation
        of the new extra accessibility paramter actual needed for init
        procs.
        (Init_Proc_Level_Formal): Created to fetch a the extra
        accessibility parameter associated with init procs if one
        exists.
        * exp_ch4.adb (Build_Attribute_Reference): Modify static check
        to be dynamic.
        * exp_ch6.adb (Add_Cond_Expression_Extra_Actual): Move logic
        used to expand conditional expressions used as actuals for
        anonymous access formals.
        (Expand_Call_Helper): Remove extranious accessibility
        calculation logic.
        * exp_util.adb: Remove inclusion of Exp_Ch2.adb.
        * par-ch3.adb (P_Array_Type_Definition): Properly set
        Aliased_Present on access definitions
        * sem_attr.adb (Resolve_Attribute): Replace instances for
        Object_Access_Level with Static_Accessibility_Level.
        * sem_ch13.adb (Storage_Pool): Replace instances for
        Object_Access_Level with Static_Accessibility_Level.
        * sem_ch6.adb (Check_Return_Construct_Accessibility): Replace
        instances for Object_Access_Level with
        Static_Accessibility_Level.
        * sem_ch9.adb (Analyze_Requeue): Replace instances for
        Object_Access_Level with Static_Accessibility_Level.
        * sem_res.adb (Check_Aliased_Parameter,
        Check_Allocator_Discrim_Accessibility, Valid_Conversion):
        Replace instances for Object_Access_Level with
        Static_Accessibility_Level.
        * sem_util.adb, sem_util.ads (Accessibility_Level_Helper):
        Created to centralize calculation of accessibility levels.
        (Build_Component_Subtype): Replace instances for
        Object_Access_Level with Static_Accessibility_Level.
        (Defining_Entity): Add extra parameter to dictate whether an
        error is raised or empty is return in the case of an irrelevant
        N.
        (Dynamic_Accessibility_Level): Rewritten to use
        Accessibility_Level_Helper.
        (Is_View_Conversion): Check membership against Etype to capture
        nodes like explicit dereferences which have types but are not
        expanded names or identifers.
        (Object_Access_LeveL): Removed.
        (Param_Entity): Moved from sem_util.
        (Static_Accessibility_Level): Created as a replacement to
        Object_Access_Level, it also uses Accessibility_Level_Helper for
        its implementation.
        * snames.ads-tmpl: Added new name for extra accessibility
        parameter in init procs.

Attachment: patch.diff.gz
Description: application/gzip

Reply via email to