This makes sure that a Sloc is put on the dereferences inserted by the
new procedure Copy_And_Maybe_Dereference.

No functional changes.

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

2020-06-10  Eric Botcazou  <ebotca...@adacore.com>

gcc/ada/

        * sem_util.adb (Copy_And_Maybe_Dereference): Temporarily copy
        the parent node of the original tree when dereferencing.
--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -1355,6 +1355,9 @@ package body Sem_Util is
 
       begin
          if Is_Access_Type (Etype (New_N)) then
+            --  Copy the parent to have a proper Sloc on the dereference
+
+            Set_Parent (New_N, Parent (N));
             Insert_Explicit_Dereference (New_N);
          end if;
 

Reply via email to