[Ada] Add missing Sloc on new explicit dereferences
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 10 Mar 2020 11:14:49 +0000 (12:14 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 10 Jun 2020 13:35:01 +0000 (09:35 -0400)
2020-06-10  Eric Botcazou  <ebotcazou@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

index fe6e8c9..2b5c211 100644 (file)
@@ -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;