aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref-alfa.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-03 11:56:17 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-03 11:56:17 +0200
commitb5ea9143e7536eb2e599ee581b06c5f21129b86b (patch)
treee29cb543e455987bc4968bd9f8bc0c196a53d0f2 /gcc/ada/lib-xref-alfa.adb
parent668a19bcfe171969271ab6a2702d42b83ca32f5b (diff)
downloadgcc-b5ea9143e7536eb2e599ee581b06c5f21129b86b.zip
gcc-b5ea9143e7536eb2e599ee581b06c5f21129b86b.tar.gz
gcc-b5ea9143e7536eb2e599ee581b06c5f21129b86b.tar.bz2
[multiple changes]
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) From-SVN: r177255
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 94d2725..5e0edbc 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