[Ada] Add missing Sloc on new explicit dereferences

Message ID 20200610133540.GA80769@adacore.com
State New
Headers show
Series
  • [Ada] Add missing Sloc on new explicit dereferences
Related show

Commit Message

Pierre-Marie de Rodat June 10, 2020, 1:35 p.m.
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  <ebotcazou@adacore.com>

gcc/ada/

	* sem_util.adb (Copy_And_Maybe_Dereference): Temporarily copy
	the parent node of the original tree when dereferencing.

Patch

--- 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;