summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_attr.adb
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-11-08 12:36:43 +0100
committerMartin Liska <mliska@suse.cz>2022-11-08 12:36:43 +0100
commit4b13c73bba935443be3207abf26f7ba05f79badc (patch)
treea6bb1525d07859fa8fc6f61dd13df7ddfd1ac254 /gcc/ada/exp_attr.adb
parent33f5dde0cd15df9cf89b29280d4ff5fcf7b30e66 (diff)
parentfa271afb58423014e2feef9f15c1a87428e64ddc (diff)
downloadgcc-devel/sphinx.tar.gz
Merge branch 'master' into devel/sphinxdevel/sphinx
Diffstat (limited to 'gcc/ada/exp_attr.adb')
-rw-r--r--gcc/ada/exp_attr.adb41
1 files changed, 31 insertions, 10 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 25f16276c5e..9c8d80ffe25 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -2316,19 +2316,40 @@ package body Exp_Attr is
if Is_Access_Protected_Subprogram_Type (Btyp) then
Expand_Access_To_Protected_Op (N, Pref, Typ);
- -- If prefix is a subprogram that has class-wide preconditions and
- -- an indirect-call wrapper (ICW) of such subprogram is available
- -- then replace the prefix by the ICW.
-
elsif Is_Access_Subprogram_Type (Btyp)
and then Is_Entity_Name (Pref)
- and then Present (Class_Preconditions (Entity (Pref)))
- and then Present (Indirect_Call_Wrapper (Entity (Pref)))
then
- Rewrite (Pref,
- New_Occurrence_Of
- (Indirect_Call_Wrapper (Entity (Pref)), Loc));
- Analyze_And_Resolve (N, Typ);
+ -- If prefix is a subprogram that has class-wide preconditions
+ -- and an indirect-call wrapper (ICW) of the subprogram is
+ -- available then replace the prefix by the ICW.
+
+ if Present (Class_Preconditions (Entity (Pref)))
+ and then Present (Indirect_Call_Wrapper (Entity (Pref)))
+ then
+ Rewrite (Pref,
+ New_Occurrence_Of
+ (Indirect_Call_Wrapper (Entity (Pref)), Loc));
+ Analyze_And_Resolve (N, Typ);
+ end if;
+
+ -- Ensure the availability of the extra formals to check that
+ -- they match.
+
+ if not Is_Frozen (Entity (Pref))
+ or else From_Limited_With (Etype (Entity (Pref)))
+ then
+ Create_Extra_Formals (Entity (Pref));
+ end if;
+
+ if not Is_Frozen (Btyp_DDT)
+ or else From_Limited_With (Etype (Btyp_DDT))
+ then
+ Create_Extra_Formals (Btyp_DDT);
+ end if;
+
+ pragma Assert
+ (Extra_Formals_Match_OK
+ (E => Entity (Pref), Ref_E => Btyp_DDT));
-- If prefix is a type name, this is a reference to the current
-- instance of the type, within its initialization procedure.