From: Eric Botcazou <ebotca...@adacore.com>

It is used by CodePeer to recognize the special access pattern.

gcc/ada/ChangeLog:

        * einfo.ads (Original_Access_Type): Restore.
        * gen_il-fields.ads (Opt_Field_Enum): Restore Original_Access_Type.
        * gen_il-gen-gen_entities.adb: Adjust accordingly.
        * exp_ch9.adb (Expand_Access_Protected_Subprogram_Type): Restore the
        call to Set_Original_Access_Type.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/einfo.ads                   | 7 +++++++
 gcc/ada/exp_ch9.adb                 | 6 ++++++
 gcc/ada/gen_il-fields.ads           | 1 +
 gcc/ada/gen_il-gen-gen_entities.adb | 3 ++-
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 152a8b296a0..c07de681045 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -3883,6 +3883,12 @@ package Einfo is
 --       Optimize_Alignment (Off) mode applies to the type/object, then neither
 --       of the flags Optimize_Alignment_Space/Optimize_Alignment_Time is set.
 
+--    Original_Access_Type
+--       Defined in E_Access_Subprogram_Type entities. Set only if the access
+--       type was generated by the expander as part of processing an access-
+--       to-protected-subprogram type. Points to the access-to-protected-
+--       subprogram type. Read by CodePeer.
+
 --    Original_Array_Type
 --       Defined in modular types and array types and subtypes. Set only if
 --       the Is_Packed_Array_Impl_Type flag is set, indicating that the type
@@ -5122,6 +5128,7 @@ package Einfo is
    --  E_Access_Subprogram_Type
    --    Equivalent_Type                       (remote types only)
    --    Directly_Designated_Type
+   --    Original_Access_Type
    --    Needs_No_Actuals
    --    Can_Use_Internal_Rep
    --    Associated_Storage_Pool $$$
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 39ad2b10846..ff5668e08c4 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -5746,6 +5746,12 @@ package body Exp_Ch9 is
 
       Insert_Before_And_Analyze (N, Decl1);
 
+      --  Associate the access to subprogram with its original access to
+      --  protected subprogram type. Needed by CodePeer to know that this
+      --  type corresponds with an access to protected subprogram type.
+
+      Set_Original_Access_Type (D_T2, T);
+
       --  Create Equivalent_Type, a record with two components for an access to
       --  object and an access to subprogram.
 
diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads
index 0092a5728c6..f664449ed96 100644
--- a/gcc/ada/gen_il-fields.ads
+++ b/gcc/ada/gen_il-fields.ads
@@ -839,6 +839,7 @@ package Gen_IL.Fields is
       OK_To_Rename,
       Optimize_Alignment_Space,
       Optimize_Alignment_Time,
+      Original_Access_Type,
       Original_Array_Type,
       Original_Protected_Subprogram,
       Original_Record_Component,
diff --git a/gcc/ada/gen_il-gen-gen_entities.adb 
b/gcc/ada/gen_il-gen-gen_entities.adb
index 86e3f39f6d3..4548789383e 100644
--- a/gcc/ada/gen_il-gen-gen_entities.adb
+++ b/gcc/ada/gen_il-gen-gen_entities.adb
@@ -677,7 +677,8 @@ begin -- Gen_IL.Gen.Gen_Entities
    Cc (E_Access_Subprogram_Type, Access_Subprogram_Kind,
        --  An access-to-subprogram type, created by an access-to-subprogram
        --  declaration.
-       (Sm (Equivalent_Type, Node_Id)));
+       (Sm (Equivalent_Type, Node_Id),
+        Sm (Original_Access_Type, Node_Id)));
 
    Ab (Access_Protected_Kind, Access_Subprogram_Kind,
        (Sm (Equivalent_Type, Node_Id)));
-- 
2.43.0

Reply via email to