aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-04-11 12:38:06 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-17 04:14:08 -0400
commit73642e6899a36de223ea07292e8e7236fb22aee7 (patch)
tree1b58f1ccfb6f7e2287fcb44b38b2ab583742176d
parent2ead6a05ac937063483ab73a5b63c98bcd5e3f98 (diff)
downloadgcc-73642e6899a36de223ea07292e8e7236fb22aee7.zip
gcc-73642e6899a36de223ea07292e8e7236fb22aee7.tar.gz
gcc-73642e6899a36de223ea07292e8e7236fb22aee7.tar.bz2
[Ada] Add assertions to Preserve_Comes_From_Source and reuse it
2020-06-17 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * atree.adb (Preserve_Comes_From_Source): Rewrite using Set_Comes_From_Source and Comes_From_Source, which enforce that the parameters are valid. * exp_ch4.adb, exp_ch5.adb, sem_ch12.adb, sem_ch6.adb, sem_res.adb: Rewrite using Preserve_Comes_From_Source.
-rw-r--r--gcc/ada/atree.adb3
-rw-r--r--gcc/ada/exp_ch4.adb4
-rw-r--r--gcc/ada/exp_ch5.adb2
-rw-r--r--gcc/ada/sem_ch12.adb6
-rw-r--r--gcc/ada/sem_ch6.adb2
-rw-r--r--gcc/ada/sem_res.adb2
6 files changed, 9 insertions, 10 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index b342add..1a00f59 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -2071,8 +2071,7 @@ package body Atree is
procedure Preserve_Comes_From_Source (NewN, OldN : Node_Id) is
begin
- Nodes.Table (NewN).Comes_From_Source :=
- Nodes.Table (OldN).Comes_From_Source;
+ Set_Comes_From_Source (NewN, Comes_From_Source (OldN));
end Preserve_Comes_From_Source;
----------------------
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 8d427fe..752a15f 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -937,8 +937,8 @@ package body Exp_Ch4 is
-- the original allocator node. This is for proper handling of
-- restriction No_Implicit_Heap_Allocations.
- Set_Comes_From_Source
- (Expression (Temp_Decl), Comes_From_Source (N));
+ Preserve_Comes_From_Source
+ (Expression (Temp_Decl), N);
Set_No_Initialization (Expression (Temp_Decl));
Insert_Action (N, Temp_Decl);
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 458b545..0634ffc 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -3741,7 +3741,7 @@ package body Exp_Ch5 is
-- specific to pure if statements, however (see
-- Sem_Ch5.Analyze_If_Statement).
- Set_Comes_From_Source (New_If, Comes_From_Source (N));
+ Preserve_Comes_From_Source (New_If, N);
return;
-- No special processing for that elsif part, move to next
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index a0b529d..ff8a15a 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -5456,7 +5456,7 @@ package body Sem_Ch12 is
-- Subprogram instance comes from source only if generic does
- Set_Comes_From_Source (Act_Decl_Id, Comes_From_Source (Gen_Unit));
+ Preserve_Comes_From_Source (Act_Decl_Id, Gen_Unit);
-- If the instance is a child unit, mark the Id accordingly. Mark
-- the anonymous entity as well, which is the real subprogram and
@@ -11898,7 +11898,7 @@ package body Sem_Ch12 is
Act_Body_Id :=
Make_Defining_Identifier (Sloc (Act_Decl_Id), Chars (Act_Decl_Id));
- Set_Comes_From_Source (Act_Body_Id, Comes_From_Source (Act_Decl_Id));
+ Preserve_Comes_From_Source (Act_Body_Id, Act_Decl_Id);
-- Some attributes of spec entity are not inherited by body entity
@@ -12265,7 +12265,7 @@ package body Sem_Ch12 is
Act_Body_Id :=
Make_Defining_Identifier (Sloc (Act_Decl_Id), Chars (Act_Decl_Id));
- Set_Comes_From_Source (Act_Body_Id, Comes_From_Source (Act_Decl_Id));
+ Preserve_Comes_From_Source (Act_Body_Id, Act_Decl_Id);
Set_Defining_Unit_Name (Specification (Act_Body), Act_Body_Id);
Set_Corresponding_Spec (Act_Body, Act_Decl_Id);
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index d0d13dd..fa9bb5d 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -3101,7 +3101,7 @@ package body Sem_Ch6 is
-- To ensure proper coverage when body is inlined, indicate
-- whether the subprogram comes from source.
- Set_Comes_From_Source (Subp, Comes_From_Source (N));
+ Preserve_Comes_From_Source (Subp, N);
if Present (First_Formal (Body_Id)) then
Plist := Copy_Parameter_List (Body_Id);
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index ee3a9ac..4267626 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -10744,7 +10744,7 @@ package body Sem_Res is
-- Set Comes_From_Source on L to preserve warnings for unset
-- reference.
- Set_Comes_From_Source (L, Comes_From_Source (Reloc_L));
+ Preserve_Comes_From_Source (L, Reloc_L);
end;
end if;