]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Simplify building of entity occurrences
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 27 Oct 2021 14:34:20 +0000 (16:34 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 9 Nov 2021 09:44:48 +0000 (09:44 +0000)
gcc/ada/

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

gcc/ada/tbuild.adb

index 4d9c1c410fd64f3bcc72c334077a1890d5854a71..bcd77c7fd0f3077a0964597b6c8c823ceefcc877 100644 (file)
@@ -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