[Ada] Further Ada 2020 work on accessibility checking
authorJustin Squirek <squirek@adacore.com>
Wed, 2 Sep 2020 18:20:55 +0000 (14:20 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 23 Oct 2020 08:25:06 +0000 (04:25 -0400)
commit66e97274cef35ed40584c7a09096fffa061fddf0
tree746562266244eef49baed136304bad56d5096c73
parent15e2ad005b1c815136e8eebff2d82b48b4591503
[Ada] Further Ada 2020 work on accessibility checking

gcc/ada/

* checks.adb (Apply_Accessibility_Check): Skip checks against
the extra accessibility of a function result when in Ada 2005
mode or earlier.
* exp_ch3.adb (Build_Initialization_Call): Modify accessibility
level calls to use Accessibility_Level.
(Expand_N_Object_Declaration): Modify accessibility level calls
to use Accessibility_Level.
* exp_ch4.adb (Expand_Allocator_Expression): Add static check
for anonymous access discriminants. Remove unneeded propagation
of accessibility actual.
(Expand_N_In): Modify accessibility level calls to use
Accessibility_Level.
(Expand_N_Type_Conversion): Modify accessibility level calls to
use Accessibility_Level.
* exp_ch5.adb (Expand_N_Assignment_Statement): Modify
accessibility level calls to use Accessibility_Level.
* exp_ch6.adb (Expand_Call_Helper): Rewrite accessibility
calculation for the extra accessibility of result actual in
function calls, and modify accessibility level calls to use
Accessibility_Level.
(Check_Against_Result_Level): Removed.
* exp_ch9.adb (Expand_N_Requeue_Statement): Add dynamic
accessibility check for requeues
* sem_attr.adb (Resolve_Attribute): Modify accessibility level
calls to use Accessibility_Level.
* sem_ch13.adb (Associate_Storage_Pool): Modify accessibility
level calls to use Accessibility_Level.
* sem_ch4.adb (Analyze_Call): Add static check for explicitly
aliased formals in function calls within return statements.
* sem_ch6.adb (Check_Return_Construct_Accessibility): Rewrite
routine to account for non-aggregate return objects.
(Generate_Minimum_Accessibility): Created.
(Analyze_Call): Modify accessibility level calls to use
Accessibility_Level.
(Analyze_Subprogram_Body_Helper): Add generation of minimum
accessibility for the extra accessibility of the function
result.
* sem_ch9.adb (Analyze_Requeue): Modify accessibility level
calls to use Accessibility_Level.
* sem_res.adb: (Check_Aliased_Parameters): Modify accessibility
level calls to use Accessibility_Level.
(Valid_Conversion): Modify accessibility level calls to use
Accessibility_Level.
* sem_util.adb, sem_util.ads (Accessibility_Level_Helper):
Renamed to Accessibility_Level, add detection for functions in
prefix notation, and add cases where to return zero when
specified. Modified to take new, more descriptive, parameters.
(Accessibility_Level): Created.
(Function_Call_Level): Removed.
(Function_Call_Or_Allocator_Level): Created to centralize the
calculation accessibility levels for function calls and
allocators.
(Static_Accessibility_Level): Removed.
(Dynamic_Accessibility_Level): Removed.
(Get_Dynamic_Accessibility): Renamed from Get_Accessibility.
(In_Return_Value): Created to determine if a given expression
contributes to the current function's return value.
(Is_Master): Created.
(Is_Explicitly_Aliased): Created
14 files changed:
gcc/ada/checks.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch5.adb
gcc/ada/exp_ch6.adb
gcc/ada/exp_ch9.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch9.adb
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads