From: Bob Duff <d...@adacore.com> For an expression function body that is an operator, make sure the xref entry in the ALI file points one past the double quote mark. For example, if the name is ">", point to the greater-than symbol, not the double quote. This was already the case for proper bodies.
gcc/ada/ChangeLog: * sem_util.adb (Copy_Subprogram_Spec): When copying an N_Defining_Operator_Symbol, create an N_Defining_Operator_Symbol rather than an N_Defining_Identifier. This will cause Lib.Xref to "skip the initial quote for navigation purposes" (as per comments in Lib.Xref body). Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index ffc631a7bee..2b5b51b40ad 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -6228,8 +6228,17 @@ package body Sem_Util is -- Create a new entity for the defining unit name Def_Id := Defining_Unit_Name (Result); - Set_Defining_Unit_Name (Result, - Make_Defining_Identifier (Sloc (Def_Id), Chars (Def_Id))); + + case Nkind (Def_Id) is + when N_Defining_Identifier => + Def_Id := Make_Defining_Identifier (Sloc (Def_Id), Chars (Def_Id)); + when N_Defining_Operator_Symbol => + Def_Id := + Make_Defining_Operator_Symbol (Sloc (Def_Id), Chars (Def_Id)); + when others => raise Program_Error; + end case; + + Set_Defining_Unit_Name (Result, Def_Id); -- Create new entities for the formal parameters -- 2.43.0