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

This is modeled on the existing Is_Init_Proc predicate.

gcc/ada/ChangeLog:
        * exp_tss.ads (Is_Rep_To_Pos): New function declaration.
        * exp_tss.adb (Is_Rep_To_Pos): New function body.
        * fe.h (Is_Rep_To_Pos): New macro and extern declaration.

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

---
 gcc/ada/exp_tss.adb | 12 ++++++++++++
 gcc/ada/exp_tss.ads |  5 +++++
 gcc/ada/fe.h        |  2 ++
 3 files changed, 19 insertions(+)

diff --git a/gcc/ada/exp_tss.adb b/gcc/ada/exp_tss.adb
index 098e001808e..78eb27e1554 100644
--- a/gcc/ada/exp_tss.adb
+++ b/gcc/ada/exp_tss.adb
@@ -355,6 +355,18 @@ package body Exp_Tss is
       return C1 = TSS_Init_Proc (1) and then C2 = TSS_Init_Proc (2);
    end Is_Init_Proc;
 
+   -------------------
+   -- Is_Rep_To_Pos --
+   -------------------
+
+   function Is_Rep_To_Pos (E : Entity_Id) return Boolean is
+      C1 : Character;
+      C2 : Character;
+   begin
+      Get_Last_Two_Chars (Chars (E), C1, C2);
+      return C1 = TSS_Rep_To_Pos (1) and then C2 = TSS_Rep_To_Pos (2);
+   end Is_Rep_To_Pos;
+
    ------------
    -- Is_TSS --
    ------------
diff --git a/gcc/ada/exp_tss.ads b/gcc/ada/exp_tss.ads
index e7f312047a0..aed6a68fabe 100644
--- a/gcc/ada/exp_tss.ads
+++ b/gcc/ada/exp_tss.ads
@@ -154,6 +154,11 @@ package Exp_Tss is
 
    --  WARNING: There is a matching C declaration of this subprogram in fe.h
 
+   function Is_Rep_To_Pos (E : Entity_Id) return Boolean;
+   --  Version for Rep to Pos conversions, same as Is_TSS (E, TSS_Rep_To_Pos);
+
+   --  WARNING: There is a matching C declaration of this subprogram in fe.h
+
    function Is_TSS (E : Entity_Id; Nam : TSS_Name_Type) return Boolean;
    --  Determines if given entity (E) is the name of a TSS identified by Nam
 
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index 9d3606ce0a7..36f5e9bfe9e 100644
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -179,8 +179,10 @@ extern void Get_Variant_Encoding   (Entity_Id);
 /* exp_tss: */
 
 #define Is_Init_Proc   exp_tss__is_init_proc
+#define Is_Rep_To_Pos  exp_tss__is_rep_to_pos
 
 extern Boolean Is_Init_Proc            (Entity_Id);
+extern Boolean Is_Rep_To_Pos           (Entity_Id);
 
 /* exp_util: */
 
-- 
2.43.0

Reply via email to