Commit 4cac730c by Javier Miranda Committed by Pierre-Marie de Rodat

[Ada] Sem_Util: fix a bug in New_Copy_Tree

No impact on GCC-based compilation.

2019-08-14  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* sem_util.adb (New_Copy_Tree.Copy_Node_With_Replacement):
	Update the Chars attribute of identifiers.

From-SVN: r274455
parent 1384d88f
2019-08-14 Javier Miranda <miranda@adacore.com>
* sem_util.adb (New_Copy_Tree.Copy_Node_With_Replacement):
Update the Chars attribute of identifiers.
2019-08-14 Yannick Moy <moy@adacore.com> 2019-08-14 Yannick Moy <moy@adacore.com>
* sem_spark.adb, sem_spark.ads (Is_Legal): New function exposed * sem_spark.adb, sem_spark.ads (Is_Legal): New function exposed
......
...@@ -20427,6 +20427,21 @@ package body Sem_Util is ...@@ -20427,6 +20427,21 @@ package body Sem_Util is
Update_First_Real_Statement Update_First_Real_Statement
(Old_HSS => N, (Old_HSS => N,
New_HSS => Result); New_HSS => Result);
-- Update the Chars attribute of identifiers
elsif Nkind (N) = N_Identifier then
-- The Entity field of identifiers that denote aspects is used
-- to store arbitrary expressions (and hence we must check that
-- they reference an actual entity before copying their Chars
-- value).
if Present (Entity (Result))
and then Nkind (Entity (Result)) in N_Entity
then
Set_Chars (Result, Chars (Entity (Result)));
end if;
end if; end if;
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment