aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-04-02 12:51:58 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2012-04-02 12:51:58 +0200
commitcf5ba8a881c32483bc11e05cc1ee3bcc990d32c6 (patch)
tree168cc4772edea64b02c164aad0c4c50eb0e7c6fe /gcc/ada/lib-xref.adb
parent5bd5034e244983cb1d6655a759efafcd5b6287aa (diff)
downloadgcc-cf5ba8a881c32483bc11e05cc1ee3bcc990d32c6.zip
gcc-cf5ba8a881c32483bc11e05cc1ee3bcc990d32c6.tar.gz
gcc-cf5ba8a881c32483bc11e05cc1ee3bcc990d32c6.tar.bz2
[multiple changes]
2012-04-02 Robert Dewar <dewar@adacore.com> * s-atopri.ads: Minor reformatting. 2012-04-02 Thomas Quinot <quinot@adacore.com> * sem_util.adb: Minor reformatting, minor code cleanup. 2012-04-02 Ed Schonberg <schonberg@adacore.com> * lib-xref.adb (Generate_Reference): For a reference to an operator symbol, set the sloc to point to the first character of the operator name, and not to the initial quaote. (Output_References): Ditto for the definition of an operator symbol. 2012-04-02 Vincent Celier <celier@adacore.com> * ali.adb (Scan_Ali): Recognize Z lines. Set Implicit_With_From_Instantiation to True in the With_Record for Z lines. * ali.ads (With_Record): New Boolean component Implicit_With_From_Instantiation, defaulted to False. * csinfo.adb: Indicate that Implicit_With_From_Instantiation is special * lib-writ.adb (Write_ALI): New array Implicit_With. (Collect_Withs): Set Implicit_With for the unit is it is not Yes. (Write_With_Lines): Write a Z line instead of a W line if Implicit_With is Yes for the unit. * sem_ch12.adb (Inherit_Context): Only add a unit in the context if it is not there yet. * sinfo.ads: New flag Implicit_With_From_Instantiation (Flag12) added. From-SVN: r186079
Diffstat (limited to 'gcc/ada/lib-xref.adb')
-rw-r--r--gcc/ada/lib-xref.adb28
1 files changed, 25 insertions, 3 deletions
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index af5a69e..b6595b3 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -1031,6 +1031,15 @@ package body Lib.Xref is
Ref := Original_Location (Sloc (Nod));
Def := Original_Location (Sloc (Ent));
+ -- If this is an operator symbol, skip the initial
+ -- quote, for navigation purposes.
+
+ if Nkind (N) = N_Defining_Operator_Symbol
+ or else Nkind (Nod) = N_Operator_Symbol
+ then
+ Ref := Ref + 1;
+ end if;
+
Add_Entry
((Ent => Ent,
Loc => Ref,
@@ -1718,11 +1727,24 @@ package body Lib.Xref is
-- since at the time the reference or definition is made, private
-- types may be swapped, and the Sloc value may be incorrect. We
-- also set up the pointer vector for the sort.
+ -- For user-defined operators we need to skip the initial
+ -- quote and point to the first character of the name, for
+ -- navigation purposes.
for J in 1 .. Nrefs loop
- Rnums (J) := J;
- Xrefs.Table (J).Def :=
- Original_Location (Sloc (Xrefs.Table (J).Key.Ent));
+ declare
+ E : constant Entity_Id := Xrefs.Table (J).Key.Ent;
+ Loc : constant Source_Ptr := Original_Location (Sloc (E));
+
+ begin
+ Rnums (J) := J;
+
+ if Nkind (E) = N_Defining_Operator_Symbol then
+ Xrefs.Table (J).Def := Loc + 1;
+ else
+ Xrefs.Table (J).Def := Loc;
+ end if;
+ end;
end loop;
-- Sort the references