summaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref-alfa.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-03 09:56:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-03 09:56:17 +0000
commitea301f8de60fc76d77f3a8808f4a461cd2854af2 (patch)
treee29cb543e455987bc4968bd9f8bc0c196a53d0f2 /gcc/ada/lib-xref-alfa.adb
parent4278abe43558660ecf4a08ac194843f1dfc348df (diff)
downloadgcc-ea301f8de60fc76d77f3a8808f4a461cd2854af2.tar.gz
2011-08-03 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb: Revert previous change. 2011-08-03 Thomas Quinot <quinot@adacore.com> * sem_cat.adb (Validate_RCI_Subprogram_Declaration): Reject a remote subprogram with a limited formal that does not support external streaming. 2011-08-03 Yannick Moy <moy@adacore.com> * get_alfa.adb (Get_ALFA): add missing Skip_Spaces at start of continuation line * lib-xref-alfa.adb (Add_ALFA_File): split removal of scopes that are not from current unit in two phases, because it is not possible to change the table while iterating over its content. * put_alfa.adb (Put_ALFA): reset current file/scope at each new entity 2011-08-03 Sergey Rybin <rybin@adacore.com> * vms_data.ads: Add qualifier for gnatmetric --no-static-loop option * gnat_ugn.texi: Update description of complexity metrics (gnatmetric) git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177255 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/lib-xref-alfa.adb')
-rw-r--r--gcc/ada/lib-xref-alfa.adb54
1 files changed, 38 insertions, 16 deletions
diff --git a/gcc/ada/lib-xref-alfa.adb b/gcc/ada/lib-xref-alfa.adb
index 94d2725b7d5..5e0edbc3e48 100644
--- a/gcc/ada/lib-xref-alfa.adb
+++ b/gcc/ada/lib-xref-alfa.adb
@@ -224,25 +224,47 @@ package body ALFA is
-- Update scope numbers
- for S in From .. ALFA_Scope_Table.Last loop
- declare
- E : Entity_Id renames ALFA_Scope_Table.Table (S).Scope_Entity;
- begin
- if Lib.Get_Source_Unit (E) = U then
- ALFA_Scope_Table.Table (S).Scope_Num := Int (S - From) + 1;
- ALFA_Scope_Table.Table (S).File_Num := D;
+ declare
+ Count : Nat;
- else
- -- Remove scope S which is not located in unit U, for example
- -- for scope inside generics that get instantiated.
+ begin
+ Count := 1;
+ for S in From .. ALFA_Scope_Table.Last loop
+ declare
+ E : Entity_Id renames ALFA_Scope_Table.Table (S).Scope_Entity;
+ begin
+ if Lib.Get_Source_Unit (E) = U then
+ ALFA_Scope_Table.Table (S).Scope_Num := Count;
+ ALFA_Scope_Table.Table (S).File_Num := D;
+ Count := Count + 1;
- for J in S .. ALFA_Scope_Table.Last - 1 loop
- ALFA_Scope_Table.Table (J) := ALFA_Scope_Table.Table (J + 1);
- end loop;
- ALFA_Scope_Table.Set_Last (ALFA_Scope_Table.Last - 1);
+ else
+ -- Mark for removal a scope S which is not located in unit
+ -- U, for example for scope inside generics that get
+ -- instantiated.
+
+ ALFA_Scope_Table.Table (S).Scope_Num := 0;
+ end if;
+ end;
+ end loop;
+ end;
+
+ declare
+ Snew : Scope_Index;
+
+ begin
+ Snew := From;
+ for S in From .. ALFA_Scope_Table.Last loop
+ -- Remove those scopes previously marked for removal
+
+ if ALFA_Scope_Table.Table (S).Scope_Num /= 0 then
+ ALFA_Scope_Table.Table (Snew) := ALFA_Scope_Table.Table (S);
+ Snew := Snew + 1;
end if;
- end;
- end loop;
+ end loop;
+
+ ALFA_Scope_Table.Set_Last (Snew - 1);
+ end;
-- Make entry for new file in file table