diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2023-04-03 16:54:39 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-29 10:23:19 +0200 |
commit | 5f691c62b5fee61f72352dac324c3fef57cc8511 (patch) | |
tree | 7ca8d8095c6d6a621bfbe4603f2868e2c951bfc6 /gcc/ada/contracts.adb | |
parent | 41448347f4464bceed9c09d9f1401c40118b8797 (diff) | |
download | gcc-5f691c62b5fee61f72352dac324c3fef57cc8511.zip gcc-5f691c62b5fee61f72352dac324c3fef57cc8511.tar.gz gcc-5f691c62b5fee61f72352dac324c3fef57cc8511.tar.bz2 |
ada: Restore parent link for both lists and nodes in class-wide condition
When preanalysing class-wide conditions, we restore "Function (Object)"
to its original "Object.Function" notation. This requires the Parent
links to be fixed. We did it for nodes; now we do it for lists as well.
This patch is enough to fix assertion failure in CCG and to make the
tree well-connected. Perhaps there is a more elegant solution, but that
remains to be investigated.
gcc/ada/
* contracts.adb (Fix_Parent): Fir part both for lists and nodes.
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r-- | gcc/ada/contracts.adb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 65f341a..15b65ee 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -4936,9 +4936,11 @@ package body Contracts is begin if Par /= Parent_Node then - pragma Assert (not Is_List_Member (Node) - or else Nkind (Par) = N_Function_Call); - Set_Parent (Node, Parent_Node); + if Is_List_Member (Node) then + Set_List_Parent (List_Containing (Node), Parent_Node); + else + Set_Parent (Node, Parent_Node); + end if; end if; return OK; |