mirror of git://gcc.gnu.org/git/gcc.git
lib-xref-alfa.adb, [...]: Minor addition of comments and refactoring.
2012-03-30 Yannick Moy <moy@adacore.com> * lib-xref-alfa.adb, alloc.ads, lib-xref.ads: Minor addition of comments and refactoring. From-SVN: r186004
This commit is contained in:
parent
5b0113d671
commit
ce5c2061b4
|
@ -1,3 +1,8 @@
|
||||||
|
2012-03-30 Yannick Moy <moy@adacore.com>
|
||||||
|
|
||||||
|
* lib-xref-alfa.adb, alloc.ads, lib-xref.ads: Minor addition of
|
||||||
|
comments and refactoring.
|
||||||
|
|
||||||
2012-03-30 Robert Dewar <dewar@adacore.com>
|
2012-03-30 Robert Dewar <dewar@adacore.com>
|
||||||
|
|
||||||
* lib-xref.adb, lib-xref-alfa.adb: Minor reformatting & code
|
* lib-xref.adb, lib-xref-alfa.adb: Minor reformatting & code
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
-- --
|
-- --
|
||||||
-- S p e c --
|
-- 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 --
|
-- 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- --
|
-- 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_Initial : constant := 5_000; -- Cross-refs
|
||||||
Xrefs_Increment : constant := 300;
|
Xrefs_Increment : constant := 300;
|
||||||
|
|
||||||
|
Drefs_Initial : constant := 5; -- Dereferences
|
||||||
|
Drefs_Increment : constant := 1_000;
|
||||||
|
|
||||||
end Alloc;
|
end Alloc;
|
||||||
|
|
|
@ -73,15 +73,13 @@ package body Alfa is
|
||||||
Table_Component_Type => Xref_Entry,
|
Table_Component_Type => Xref_Entry,
|
||||||
Table_Index_Type => Xref_Entry_Number,
|
Table_Index_Type => Xref_Entry_Number,
|
||||||
Table_Low_Bound => 1,
|
Table_Low_Bound => 1,
|
||||||
Table_Initial => Alloc.Xrefs_Initial,
|
Table_Initial => Alloc.Drefs_Initial,
|
||||||
Table_Increment => Alloc.Xrefs_Increment,
|
Table_Increment => Alloc.Drefs_Increment,
|
||||||
Table_Name => "Drefs");
|
Table_Name => "Drefs");
|
||||||
-- Table of cross-references for reads and writes through explicit
|
-- Table of cross-references for reads and writes through explicit
|
||||||
-- dereferences, that are output as reads/writes to the special variable
|
-- dereferences, that are output as reads/writes to the special variable
|
||||||
-- "Heap". These references are added to the regular references when
|
-- "Heap". These references are added to the regular references when
|
||||||
-- computing Alfa cross-references.
|
-- computing Alfa cross-references.
|
||||||
--
|
|
||||||
-- Why is Alloc.Xrefs_* used here ??? seems clearly wrong.
|
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
-- Local Subprograms --
|
-- Local Subprograms --
|
||||||
|
@ -338,16 +336,17 @@ package body Alfa is
|
||||||
|
|
||||||
package Sorting is new GNAT.Heap_Sort_G (Move, Lt);
|
package Sorting is new GNAT.Heap_Sort_G (Move, Lt);
|
||||||
|
|
||||||
-- Comment required for this package ???
|
-- Internal package to build a correspondance between entities and scope
|
||||||
-- Why is an internal package used here at all ???
|
-- numbers used in Alfa cross references.
|
||||||
|
|
||||||
package Scopes is
|
package Scopes is
|
||||||
No_Scope : constant Nat := 0;
|
No_Scope : constant Nat := 0;
|
||||||
|
|
||||||
function Get_Scope_Num (N : Entity_Id) return Nat;
|
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);
|
procedure Set_Scope_Num (N : Entity_Id; Num : Nat);
|
||||||
-- Comment required ???
|
-- Associate entity N to scope number Num
|
||||||
end Scopes;
|
end Scopes;
|
||||||
|
|
||||||
------------
|
------------
|
||||||
|
@ -395,7 +394,8 @@ package body Alfa is
|
||||||
-- not suitable for local cross-references.
|
-- not suitable for local cross-references.
|
||||||
|
|
||||||
Nrefs_Add : constant Nat := Drefs.Last;
|
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;
|
Rnums : array (0 .. Nrefs + Nrefs_Add) of Nat;
|
||||||
-- This array contains numbers of references in the Xrefs table. This
|
-- 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
|
elsif Nkind (Lu) = N_Package_Body then
|
||||||
Traverse_Package_Body (Lu, Process, Inside_Stubs);
|
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
|
-- All other cases of compilation units (e.g. renamings), are not
|
||||||
-- declarations.
|
-- declarations, or else generic declarations which are ignored.
|
||||||
|
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
@ -1200,11 +1190,6 @@ package body Alfa is
|
||||||
when N_Package_Declaration =>
|
when N_Package_Declaration =>
|
||||||
Traverse_Package_Declaration (N, Process, Inside_Stubs);
|
Traverse_Package_Declaration (N, Process, Inside_Stubs);
|
||||||
|
|
||||||
-- Generic package declaration ??? TBD
|
|
||||||
|
|
||||||
when N_Generic_Package_Declaration =>
|
|
||||||
null;
|
|
||||||
|
|
||||||
-- Package body
|
-- Package body
|
||||||
|
|
||||||
when N_Package_Body =>
|
when N_Package_Body =>
|
||||||
|
@ -1231,11 +1216,6 @@ package body Alfa is
|
||||||
when N_Subprogram_Declaration =>
|
when N_Subprogram_Declaration =>
|
||||||
null;
|
null;
|
||||||
|
|
||||||
-- Generic subprogram declaration ??? TBD
|
|
||||||
|
|
||||||
when N_Generic_Subprogram_Declaration =>
|
|
||||||
null;
|
|
||||||
|
|
||||||
-- Subprogram body
|
-- Subprogram body
|
||||||
|
|
||||||
when N_Subprogram_Body =>
|
when N_Subprogram_Body =>
|
||||||
|
@ -1322,6 +1302,8 @@ package body Alfa is
|
||||||
Traverse_Declarations_Or_Statements
|
Traverse_Declarations_Or_Statements
|
||||||
(Statements (N), Process, Inside_Stubs);
|
(Statements (N), Process, Inside_Stubs);
|
||||||
|
|
||||||
|
-- Generic declarations are ignored
|
||||||
|
|
||||||
when others =>
|
when others =>
|
||||||
null;
|
null;
|
||||||
end case;
|
end case;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
-- --
|
-- --
|
||||||
-- S p e c --
|
-- 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 --
|
-- 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- --
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||||
|
@ -605,10 +605,13 @@ package Lib.Xref is
|
||||||
(CU : Node_Id;
|
(CU : Node_Id;
|
||||||
Process : Node_Processing;
|
Process : Node_Processing;
|
||||||
Inside_Stubs : Boolean);
|
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);
|
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);
|
procedure Collect_Alfa (Sdep_Table : Unit_Ref_Table; Num_Sdep : Nat);
|
||||||
-- Collect Alfa information from library units (for files and scopes)
|
-- Collect Alfa information from library units (for files and scopes)
|
||||||
|
|
Loading…
Reference in New Issue