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/nlists.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/nlists.adb')
-rw-r--r-- | gcc/ada/nlists.adb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb index 821c0ab..7339c17 100644 --- a/gcc/ada/nlists.adb +++ b/gcc/ada/nlists.adb @@ -27,11 +27,11 @@ -- file must be properly reflected in the corresponding C header a-nlists.h with Alloc; -with Atree; use Atree; -with Debug; use Debug; -with Output; use Output; -with Sinfo; use Sinfo; -with Sinfo.Nodes; use Sinfo.Nodes; +with Atree; use Atree; +with Debug; use Debug; +with Output; use Output; +with Sinfo; use Sinfo; +with Sinfo.Nodes; use Sinfo.Nodes; with Table; package body Nlists is @@ -1015,6 +1015,7 @@ package body Nlists is function Parent (List : List_Id) return Node_Or_Entity_Id is begin + pragma Assert (Present (List)); pragma Assert (List <= Lists.Last); return Lists.Table (List).Parent; end Parent; |