https://gcc.gnu.org/g:e3a67dcc1ab950176a62f3cebd61938332d31887
commit r15-6590-ge3a67dcc1ab950176a62f3cebd61938332d31887 Author: Bob Duff <d...@adacore.com> Date: Thu Dec 12 09:13:16 2024 -0500 ada: Correct xref of operator expression function body 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). Diff: --- 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 ffc631a7beeb..2b5b51b40ad3 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