https://gcc.gnu.org/g:017aad48e805579cd2104230d7caeb1bf04dbb80

commit r16-3765-g017aad48e805579cd2104230d7caeb1bf04dbb80
Author: Tucker Taft <t...@adacore.com>
Date:   Mon Aug 11 21:33:52 2025 +0000

    ada: Set Related_Expression on compiler-generated Valid_Scalars functions
    
    When creating the local functions to implement the Valid_Scalars
    attribute for array and record types, set a Related_Expression that
    points to the original attribute reference (blah'Valid_Scalars).
    This allows the Inspector to give a more user-friendly name
    when these functions are called and they are known, for example,
    to always return True.
    
    gcc/ada/ChangeLog:
    
            * exp_attr.adb
            (Build_Array_VS_Func and Build_Record_VS_Func): Pass in the
            Attr as the Related_Node parametr when calling
            Make_Temporary for the Func_Id for the array and record
            Valid_Scalars local functions.

Diff:
---
 gcc/ada/exp_attr.adb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 4eb0a6720f7e..7fc104d173bc 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -479,7 +479,8 @@ package body Exp_Attr is
 
       --  Local variables
 
-      Func_Id : constant Entity_Id := Make_Temporary (Loc, 'V');
+      Func_Id : constant Entity_Id := Make_Temporary (Loc, 'V',
+                                        Related_Node => Attr);
       Indexes : constant List_Id   := New_List;
       Obj_Id  : constant Entity_Id := Make_Temporary (Loc, 'A');
       Stmts   : List_Id;
@@ -836,7 +837,8 @@ package body Exp_Attr is
 
       --  Local variables
 
-      Func_Id  : constant Entity_Id := Make_Temporary (Loc, 'V');
+      Func_Id  : constant Entity_Id := Make_Temporary (Loc, 'V',
+                                         Related_Node => Attr);
       Obj_Id   : constant Entity_Id := Make_Temporary (Loc, 'R');
       Comps    : Node_Id;
       Stmts    : List_Id;

Reply via email to