[Ada] Simplify building of entity occurrences

Message ID 20211109094600.GA830343@adacore.com
State Committed
Commit e93e554454d855231f257b3b95f4105b4da60cc0
Headers
Series [Ada] Simplify building of entity occurrences |

Commit Message

Pierre-Marie de Rodat Nov. 9, 2021, 9:46 a.m. UTC
  Code cleanup related to expansion of predefined equality for GNATprove;
semantics is unaffected.

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

gcc/ada/

	* tbuild.adb (New_Occurrence_Of): Simplify by reusing
	Make_Identifier.
  

Patch

diff --git a/gcc/ada/tbuild.adb b/gcc/ada/tbuild.adb
--- a/gcc/ada/tbuild.adb
+++ b/gcc/ada/tbuild.adb
@@ -699,11 +699,10 @@  package body Tbuild is
       Loc    : Source_Ptr) return Node_Id
    is
       pragma Assert (Present (Def_Id) and then Nkind (Def_Id) in N_Entity);
-      Occurrence : Node_Id;
+      Occurrence : constant Node_Id :=
+        Make_Identifier (Loc, Chars (Def_Id));
 
    begin
-      Occurrence := New_Node (N_Identifier, Loc);
-      Set_Chars (Occurrence, Chars (Def_Id));
       Set_Entity (Occurrence, Def_Id);
 
       if Is_Type (Def_Id) then