From 8b22ebf65b67cecaf1281629409e895fa23e6b92 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 30 Mar 2012 09:26:59 +0000 Subject: [PATCH] 2012-03-30 Yannick Moy * lib-xref-alfa.adb, alloc.ads, lib-xref.ads: Minor addition of comments and refactoring. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186004 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/alloc.ads | 5 ++++- gcc/ada/lib-xref-alfa.adb | 42 ++++++++++++------------------------------ gcc/ada/lib-xref.ads | 9 ++++++--- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f342fa8..9c0d479 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2012-03-30 Yannick Moy + + * lib-xref-alfa.adb, alloc.ads, lib-xref.ads: Minor addition of + comments and refactoring. + 2012-03-30 Robert Dewar * lib-xref.adb, lib-xref-alfa.adb: Minor reformatting & code diff --git a/gcc/ada/alloc.ads b/gcc/ada/alloc.ads index c5cad72..18a2be6 100644 --- a/gcc/ada/alloc.ads +++ b/gcc/ada/alloc.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -157,4 +157,7 @@ package Alloc is Xrefs_Initial : constant := 5_000; -- Cross-refs Xrefs_Increment : constant := 300; + Drefs_Initial : constant := 5; -- Dereferences + Drefs_Increment : constant := 1_000; + end Alloc; diff --git a/gcc/ada/lib-xref-alfa.adb b/gcc/ada/lib-xref-alfa.adb index 5081dfd..e3ef7b0 100644 --- a/gcc/ada/lib-xref-alfa.adb +++ b/gcc/ada/lib-xref-alfa.adb @@ -73,15 +73,13 @@ package body Alfa is Table_Component_Type => Xref_Entry, Table_Index_Type => Xref_Entry_Number, Table_Low_Bound => 1, - Table_Initial => Alloc.Xrefs_Initial, - Table_Increment => Alloc.Xrefs_Increment, + Table_Initial => Alloc.Drefs_Initial, + Table_Increment => Alloc.Drefs_Increment, Table_Name => "Drefs"); -- Table of cross-references for reads and writes through explicit -- dereferences, that are output as reads/writes to the special variable -- "Heap". These references are added to the regular references when -- computing Alfa cross-references. - -- - -- Why is Alloc.Xrefs_* used here ??? seems clearly wrong. ----------------------- -- Local Subprograms -- @@ -338,16 +336,17 @@ package body Alfa is package Sorting is new GNAT.Heap_Sort_G (Move, Lt); - -- Comment required for this package ??? - -- Why is an internal package used here at all ??? + -- Internal package to build a correspondance between entities and scope + -- numbers used in Alfa cross references. package Scopes is No_Scope : constant Nat := 0; + function Get_Scope_Num (N : Entity_Id) return Nat; - -- Comment required ??? + -- Return the scope number associated to entity N procedure Set_Scope_Num (N : Entity_Id; Num : Nat); - -- Comment required ??? + -- Associate entity N to scope number Num end Scopes; ------------ @@ -395,7 +394,8 @@ package body Alfa is -- not suitable for local cross-references. Nrefs_Add : constant Nat := Drefs.Last; - -- Comment needed ??? + -- Number of additional references which correspond to dereferences in + -- the source code. Rnums : array (0 .. Nrefs + Nrefs_Add) of Nat; -- This array contains numbers of references in the Xrefs table. This @@ -1150,18 +1150,8 @@ package body Alfa is elsif Nkind (Lu) = N_Package_Body then Traverse_Package_Body (Lu, Process, Inside_Stubs); - -- ??? TBD - - elsif Nkind (Lu) = N_Generic_Package_Declaration then - null; - - -- ??? TBD - - elsif Nkind (Lu) in N_Generic_Instantiation then - null; - -- All other cases of compilation units (e.g. renamings), are not - -- declarations. + -- declarations, or else generic declarations which are ignored. else null; @@ -1200,11 +1190,6 @@ package body Alfa is when N_Package_Declaration => Traverse_Package_Declaration (N, Process, Inside_Stubs); - -- Generic package declaration ??? TBD - - when N_Generic_Package_Declaration => - null; - -- Package body when N_Package_Body => @@ -1231,11 +1216,6 @@ package body Alfa is when N_Subprogram_Declaration => null; - -- Generic subprogram declaration ??? TBD - - when N_Generic_Subprogram_Declaration => - null; - -- Subprogram body when N_Subprogram_Body => @@ -1322,6 +1302,8 @@ package body Alfa is Traverse_Declarations_Or_Statements (Statements (N), Process, Inside_Stubs); + -- Generic declarations are ignored + when others => null; end case; diff --git a/gcc/ada/lib-xref.ads b/gcc/ada/lib-xref.ads index ecac26f..7bdc158 100644 --- a/gcc/ada/lib-xref.ads +++ b/gcc/ada/lib-xref.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1998-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1998-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -605,10 +605,13 @@ package Lib.Xref is (CU : Node_Id; Process : Node_Processing; Inside_Stubs : Boolean); - -- This procedure is undocumented ??? + -- Call Process on all declarations in compilation unit CU. If + -- Inside_Stubs is True, then the body of stubs is also traversed. + -- Generic declarations are ignored. procedure Traverse_All_Compilation_Units (Process : Node_Processing); - -- Call Process on all declarations through all compilation units + -- Call Process on all declarations through all compilation units. + -- Generic declarations are ignored. procedure Collect_Alfa (Sdep_Table : Unit_Ref_Table; Num_Sdep : Nat); -- Collect Alfa information from library units (for files and scopes) -- 2.7.4