aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2024-12-12 09:13:16 -0500
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-06 10:14:48 +0100
commite3a67dcc1ab950176a62f3cebd61938332d31887 (patch)
treec4322ca66715b675ece8c0cdf45eb3b95253a58c /gcc
parente4ed78faa3eb0f6b9b28d4491c22e5edb39339bf (diff)
downloadgcc-e3a67dcc1ab950176a62f3cebd61938332d31887.zip
gcc-e3a67dcc1ab950176a62f3cebd61938332d31887.tar.gz
gcc-e3a67dcc1ab950176a62f3cebd61938332d31887.tar.bz2
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).
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_util.adb13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index ffc631a..2b5b51b 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