[Ada] tech debt: Parent (Empty) is not allowed

Pierre-Marie de Rodat derodat@adacore.com
Wed Jun 30 09:30:45 GMT 2021

The documentation says that the Parent field is not defined for the
Empty node, but many places were setting and getting the field. This
patch changes the code to obey the documentation.

Tested on x86_64-pc-linux-gnu, committed on trunk


	* atree.adb, atree.ads (Parent, Set_Parent): Assert node is
	(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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 24016 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210630/40e34ea0/attachment-0001.bin>

More information about the Gcc-patches mailing list