diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-20 12:55:04 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-20 12:55:04 +0100 |
commit | 6e9e35e127fe5d487d5be35dd740da9ec79595ff (patch) | |
tree | da102fe9f9156f672b115c146a4812824f6a4ba3 /gcc/ada/ghost.adb | |
parent | 7124d1a50ed62e7ef6703d01d8fd122a50e27ccc (diff) | |
download | gcc-6e9e35e127fe5d487d5be35dd740da9ec79595ff.zip gcc-6e9e35e127fe5d487d5be35dd740da9ec79595ff.tar.gz gcc-6e9e35e127fe5d487d5be35dd740da9ec79595ff.tar.bz2 |
[multiple changes]
2017-01-20 Hristian Kirtchev <kirtchev@adacore.com>
* ghost.adb (Mark_Ghost_Clause): New routine.
(Prune_Node): Do not prune compilation unit nodes.
(Remove_Ignored_Ghost_Code): Prune the compilation unit node directly.
This does not touch the node itself, but does prune all its fields.
* ghost.ads (Mark_Ghost_Clause): New routine.
* sem_ch8.adb (Analyze_Use_Package): Emit an error when a use
package clause mentions Ghost and non-Ghost packages. Mark a
use package clause as Ghost when it mentions a Ghost package.
(Analyze_Use_Type): Emit an error when a use type clause mentions
Ghost and non-Ghost types. Mark a use type clause as Ghost when
it mentions a Ghost type.
* sem_ch10.adb (Analyze_With_Clause): Mark a with clause as
Ghost when it withs a Ghost unit.
2017-01-20 Javier Miranda <miranda@adacore.com>
* sem_res.adb (Resolve_Call): If a function call
returns a limited view of a type and at the point of the call the
function is not declared in the extended main unit then replace
it with the non-limited view, which must be available. If the
called function is in the extended main unit then no action is
needed since the back-end handles this case.
2017-01-20 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch7.adb (Contains_Subp_Or_Const_Refs): Rename into...
(Contains_Subprograms_Refs): ...this. Adjust comment
for constants. (Is_Subp_Or_Const_Ref): Rename into...
(Is_Subprogram_Ref): ...this.
(Has_Referencer): Rename Has_Non_Subp_Const_Referencer variable into
Has_Non_Subprograms_Referencer and adjust comment. Remove
incorrect shortcut for package declarations and bodies.
2017-01-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Complete_Private_Subtype): If the scope of the
base type differs from that of the completion and the private
subtype is an itype (created for a constraint on an access
type e.g.), set Delayed_Freeze on both to prevent out-of-scope
anomalies in gigi.
2017-01-20 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper):
When inheriting the SPARK_Mode of a prior expression function,
look at the properly resolved entity rather than the initial
candidate which may denote a homonym.
2017-01-20 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Rewrite_Assertion_Kind): If the name is
Precondition or Postcondition, and the context is pragma
Check_Policy, indicate that this Pre-Ada2012 usage is deprecated
and suggest the standard names Assertion_Policy /Pre /Post
instead.
From-SVN: r244704
Diffstat (limited to 'gcc/ada/ghost.adb')
-rw-r--r-- | gcc/ada/ghost.adb | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index fadb891..f40e8ea 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -1430,6 +1430,34 @@ package body Ghost is end Mark_Ghost_Declaration_Or_Body; ----------------------- + -- Mark_Ghost_Clause -- + ----------------------- + + procedure Mark_Ghost_Clause (N : Node_Id) is + Nam : Node_Id := Empty; + + begin + if Nkind (N) = N_Use_Package_Clause then + Nam := First (Names (N)); + + elsif Nkind (N) = N_Use_Type_Clause then + Nam := First (Subtype_Marks (N)); + + elsif Nkind (N) = N_With_Clause then + Nam := Name (N); + end if; + + if Present (Nam) + and then Is_Entity_Name (Nam) + and then Present (Entity (Nam)) + and then Is_Ignored_Ghost_Entity (Entity (Nam)) + then + Set_Is_Ignored_Ghost_Node (N); + Propagate_Ignored_Ghost_Code (N); + end if; + end Mark_Ghost_Clause; + + ----------------------- -- Mark_Ghost_Pragma -- ----------------------- @@ -1574,10 +1602,17 @@ package body Ghost is Id : Entity_Id; begin + -- Do not prune compilation unit nodes because many mechanisms + -- depend on their presence. Note that context items must still + -- be processed. + + if Nkind (N) = N_Compilation_Unit then + return OK; + -- The node is either declared as ignored Ghost or is a byproduct -- of expansion. Destroy it and stop the traversal on this branch. - if Is_Ignored_Ghost_Node (N) then + elsif Is_Ignored_Ghost_Node (N) then Prune (N); return Skip; @@ -1628,7 +1663,7 @@ package body Ghost is begin for Index in Ignored_Ghost_Units.First .. Ignored_Ghost_Units.Last loop - Prune_Tree (Unit (Ignored_Ghost_Units.Table (Index))); + Prune_Tree (Ignored_Ghost_Units.Table (Index)); end loop; end Remove_Ignored_Ghost_Code; |