aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-xref.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2020-07-07 17:29:44 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-19 05:53:39 -0400
commit2bb7741fbeee2f4fd472cd7e9791ae0b54e7a2b4 (patch)
treee44af8ff8c94c46657a321a5050f7c367f367855 /gcc/ada/lib-xref.adb
parent08b0a5e2002f7f43d7f5aa3b55e7c6c22ec3926d (diff)
downloadgcc-2bb7741fbeee2f4fd472cd7e9791ae0b54e7a2b4.zip
gcc-2bb7741fbeee2f4fd472cd7e9791ae0b54e7a2b4.tar.gz
gcc-2bb7741fbeee2f4fd472cd7e9791ae0b54e7a2b4.tar.bz2
[Ada] Expanded names in ghost assignments
gcc/ada/ * ghost.adb (Whole_Object_Ref): New function to compute the name of the whole object. (Mark_And_Set_Ghost_Assignment): Rewrite to use Whole_Object_Ref. We need to partly analyze the left-hand side in order to distinguish expanded names and record components. * lib-xref.ads, lib-xref.adb (Deferred_References): Move table to body, and add Defer_Reference to update the table, avoiding duplicates. (Generate_Reference): Avoid duplicates. * sem_ch8.ads, sem_ch8.adb (Find_Direct_Name): Remove _OK parameters, which are no longer needed. Ignore errors in Ignore_Errors mode. * sem_util.ads, sem_util.adb (Preanalyze_Without_Errors): Make this public, so we can call it from Ghost. * errout.ads, scng.adb, sem_prag.adb: Minor.
Diffstat (limited to 'gcc/ada/lib-xref.adb')
-rw-r--r--gcc/ada/lib-xref.adb31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index ae4b4c7..64b9683 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -53,6 +53,14 @@ package body Lib.Xref is
-- Declarations --
------------------
+ package Deferred_References is new Table.Table (
+ Table_Component_Type => Deferred_Reference_Entry,
+ Table_Index_Type => Int,
+ Table_Low_Bound => 0,
+ Table_Initial => 512,
+ Table_Increment => 200,
+ Table_Name => "Name_Deferred_References");
+
-- The Xref table is used to record references. The Loc field is set
-- to No_Location for a definition entry.
@@ -199,6 +207,21 @@ package body Lib.Xref is
end if;
end Add_Entry;
+ ---------------------
+ -- Defer_Reference --
+ ---------------------
+
+ procedure Defer_Reference (Deferred_Reference : Deferred_Reference_Entry) is
+ begin
+ -- If Get_Ignore_Errors, then we are in Preanalyze_Without_Errors, and
+ -- we should not record cross references, because that will cause
+ -- duplicates when we call Analyze.
+
+ if not Get_Ignore_Errors then
+ Deferred_References.Append (Deferred_Reference);
+ end if;
+ end Defer_Reference;
+
-----------
-- Equal --
-----------
@@ -595,6 +618,14 @@ package body Lib.Xref is
-- Start of processing for Generate_Reference
begin
+ -- If Get_Ignore_Errors, then we are in Preanalyze_Without_Errors, and
+ -- we should not record cross references, because that will cause
+ -- duplicates when we call Analyze.
+
+ if Get_Ignore_Errors then
+ return;
+ end if;
+
-- May happen in case of severe errors
if Nkind (E) not in N_Entity then