summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-30 09:26:59 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-30 09:26:59 +0000
commit8b22ebf65b67cecaf1281629409e895fa23e6b92 (patch)
tree08b03c8da7ffae834919fb93cf630e4f4d626687 /gcc
parent6ab9aa289d88d8052c8364ed4251a0054f8b2148 (diff)
downloadgcc-8b22ebf65b67cecaf1281629409e895fa23e6b92.tar.gz
2012-03-30 Yannick Moy <moy@adacore.com>
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/alloc.ads5
-rw-r--r--gcc/ada/lib-xref-alfa.adb42
-rw-r--r--gcc/ada/lib-xref.ads9
4 files changed, 27 insertions, 34 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index f342fa8dc37..9c0d4791c39 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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>
* lib-xref.adb, lib-xref-alfa.adb: Minor reformatting & code
diff --git a/gcc/ada/alloc.ads b/gcc/ada/alloc.ads
index c5cad729652..18a2be62157 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 5081dfd716a..e3ef7b005b9 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 ecac26fabb3..7bdc1582b5e 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)