diff options
author | Bob Duff <duff@adacore.com> | 2021-04-09 14:53:56 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-29 14:23:47 +0000 |
commit | 898edf758e03a6cc31219405a667c75b67a726ca (patch) | |
tree | 69749a9c1b8385174595567094c2dc2853a9731a /gcc/ada/lib-xref-spark_specific.adb | |
parent | 568d3d4656c347012eb7dd2f008845505eab3ca8 (diff) | |
download | gcc-898edf758e03a6cc31219405a667c75b67a726ca.zip gcc-898edf758e03a6cc31219405a667c75b67a726ca.tar.gz gcc-898edf758e03a6cc31219405a667c75b67a726ca.tar.bz2 |
[Ada] tech debt: Parent (Empty) is not allowed
gcc/ada/
* atree.adb, atree.ads (Parent, Set_Parent): Assert node is
Present.
(Copy_Parent, Parent_Kind): New helper routines.
* gen_il-gen.adb: Add with clause.
* nlists.adb (Parent): Assert Parent of list is Present.
* aspects.adb, checks.adb, exp_aggr.adb, exp_ch6.adb,
exp_util.adb, lib-xref-spark_specific.adb, osint.ads,
sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch6.adb,
sem_dim.adb, sem_prag.adb, sem_res.adb, sem_util.adb,
treepr.adb: Do not call Parent and Set_Parent on the Empty node.
* libgnat/a-stwiun__shared.adb, libgnat/a-stzunb__shared.adb:
Minor: Fix typos in comments.
* einfo.ads: Minor comment update.
* sinfo-utils.ads, sinfo-utils.adb (Parent_Kind, Copy_Parent):
New functions.
Diffstat (limited to 'gcc/ada/lib-xref-spark_specific.adb')
-rw-r--r-- | gcc/ada/lib-xref-spark_specific.adb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/ada/lib-xref-spark_specific.adb b/gcc/ada/lib-xref-spark_specific.adb index 723b7a8..1905f23 100644 --- a/gcc/ada/lib-xref-spark_specific.adb +++ b/gcc/ada/lib-xref-spark_specific.adb @@ -187,6 +187,10 @@ package body SPARK_Specific is | Generic_Subprogram_Kind | Subprogram_Kind then + if No (Unit_Declaration_Node (N)) then + return Empty; + end if; + Context := Parent (Unit_Declaration_Node (N)); -- If this was a library-level subprogram then replace Context with |