aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-12-12 23:59:34 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-04-29 04:00:45 -0400
commit8bba393a0ac1fca0beceadce0c464502d88e2e57 (patch)
tree764c071588e7126e5b6602ef6dc0965ca296efd4 /gcc
parent4002ae566b093586cde4da6790e7c7ed357f2493 (diff)
downloadgcc-8bba393a0ac1fca0beceadce0c464502d88e2e57.zip
gcc-8bba393a0ac1fca0beceadce0c464502d88e2e57.tar.gz
gcc-8bba393a0ac1fca0beceadce0c464502d88e2e57.tar.bz2
[Ada] Extend Find_Related_Context to deal with child instances
gcc/ada/ * sem_elab.adb (Process_SPARK_Instantiation): Fix typo in comment. * sem_prag.adb (Find_Related_Context): Add missing reference to No_Caching in the comment; handle pragmas on compilation units.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_elab.adb2
-rw-r--r--gcc/ada/sem_prag.adb11
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 89b6e13..5bc116a 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -15121,7 +15121,7 @@ package body Sem_Elab is
Inst_Rep : Scenario_Rep_Id;
In_State : Processing_In_State);
pragma Inline (Process_SPARK_Instantiation);
- -- Verify that instanciation Inst does not precede the generic body it
+ -- Verify that instantiation Inst does not precede the generic body it
-- instantiates (SPARK RM 7.7(6)). Inst_Rep is the representation of the
-- instantiation. In_State is the current state of the Processing phase.
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 1b1e01b..a1d645e 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -243,6 +243,7 @@ package body Sem_Prag is
-- Constant_After_Elaboration
-- Effective_Reads
-- Effective_Writers
+ -- No_Caching
-- Part_Of
-- Find the first source declaration or statement found while traversing
-- the previous node chain starting from pragma Prag. If flag Do_Checks is
@@ -30474,6 +30475,16 @@ package body Sem_Prag is
Stmt : Node_Id;
begin
+ -- If the pragma comes from an aspect on a compilation unit that is a
+ -- package instance, then return the original package instantiation
+ -- node.
+
+ if Nkind (Parent (Prag)) = N_Compilation_Unit_Aux then
+ return
+ Get_Unit_Instantiation_Node
+ (Defining_Entity (Unit (Enclosing_Comp_Unit_Node (Prag))));
+ end if;
+
Stmt := Prev (Prag);
while Present (Stmt) loop