This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR ada/35050: Fix xref "Ref:" information for function renaming


gnatxref didn't expect an ALI line with a renaming information followed by
a return type. As a consequence, only procedure renamings could be present in
"Ref:" output while function renamings couldn't.

This patch moves the parsing (and ignoring) of renaming information before
the parsing of the return type.

The incorrectly parsed lines, from the referenced test case, was:

  3V12*My_plus=3:58{integer} 2|13r20
  4V12*Add=4:54{integer} 2|13r8

    gcc/ada/
    	PR ada/35050
	* xref_lib.adb (Parse_Identifier_Info): Correctly parse and ignore the
	renaming information.
---
 gcc/ada/xref_lib.adb |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb
index 7f22dce..0c940d2 100644
--- a/gcc/ada/xref_lib.adb
+++ b/gcc/ada/xref_lib.adb
@@ -896,6 +896,22 @@ package body Xref_Lib is
          Skip_To_Matching_Closing_Bracket;
       end if;
 
+      --  Skip any renaming indication
+
+      if Ali (Ptr) = '=' then
+         declare
+            P_Line, P_Column : Natural;
+            pragma Warnings (Off, P_Line);
+            pragma Warnings (Off, P_Column);
+
+         begin
+            Ptr := Ptr + 1;
+            Parse_Number (Ali, Ptr, P_Line);
+            Ptr := Ptr + 1;
+            Parse_Number (Ali, Ptr, P_Column);
+         end;
+      end if;
+
       if Ali (Ptr) = '<'
         or else Ali (Ptr) = '('
         or else Ali (Ptr) = '{'
@@ -1036,19 +1052,6 @@ package body Xref_Lib is
             end loop;
             Ptr := Ptr + 1;
          end if;
-
-      elsif Ali (Ptr) = '=' then
-         declare
-            P_Line, P_Column : Natural;
-            pragma Warnings (Off, P_Line);
-            pragma Warnings (Off, P_Column);
-
-         begin
-            Ptr := Ptr + 1;
-            Parse_Number (Ali, Ptr, P_Line);
-            Ptr := Ptr + 1;
-            Parse_Number (Ali, Ptr, P_Column);
-         end;
       end if;
 
       --  To find the body, we will have to parse the file too
-- 
1.5.4.3.220.g99d8e


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]