From patchwork Tue Jan 11 13:32:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 49854 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5448C38A9406 for ; Tue, 11 Jan 2022 13:55:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5448C38A9406 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641909308; bh=eN6HZmXJou4m5Gc5ld3qig+bgemTiARH49qucuFvv0I=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=lEOD7c0HuuLhGjOerWT50qe0fZzwueBzkU4aquHuOzbQzviO+dJ71pLzy22i3yEqy FT6wXKqBHzLXxM89erllsh2KO1EPp8ysC3k8j0Ge/swy1NmaaDVGHxMxp68kmH08j4 kF6hENOkCRwD1cZCgeBnpF+H30DUBEejJzBNWWYs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 1B7EE385AC32 for ; Tue, 11 Jan 2022 13:32:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1B7EE385AC32 Received: by mail-wr1-x42e.google.com with SMTP id t28so26237552wrb.4 for ; Tue, 11 Jan 2022 05:32:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=eN6HZmXJou4m5Gc5ld3qig+bgemTiARH49qucuFvv0I=; b=19l539g30lD7M3m7FPk74LfV26YRIl6+JuWcPXxIGo5/c+CCtilJRgYfRPutwpPe9z eyI1Md76eOxPK6A34xhnbvehei7qMZmZxGj6/orPXNOgh76wb5A8saOZxjpkffSnBm/W p9ydMSCChpUPqTER+E9qeBMODD0QjcoxIhiOPwHmtvGUEE3kEmfUfMFtyL/EZjgGYvzX RdhtZwbIlZim2VOqxmCxKBvoJt6xjnZMPqA9Ops+a7ELmaZ/VSjVES4xMqpJjAqBYy7+ 8J2sVesDM2Cz+MUUrLiiqO34tg36CJxIYVtDmP5D5/YCpetQBhP8VlJThoY0oQzegVBB dJUg== X-Gm-Message-State: AOAM530KsEoiyXZAoHZpu12Bcms6Fb3rM0ejn2JIYV+KKyF8OgxdnQXs J8tzYWK4J7/beKVV0DS2zxpcNLu7IaOOng== X-Google-Smtp-Source: ABdhPJzBM5m/NgxGyI/AB9Q9loMXQg7e9+K66s6t9qMaarj6C6CFdeAYFJWnDh1Wf4UxcdeEomPJHA== X-Received: by 2002:a5d:4bc5:: with SMTP id l5mr3783278wrt.475.1641907939223; Tue, 11 Jan 2022 05:32:19 -0800 (PST) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id l25sm1702568wmh.18.2022.01.11.05.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 05:32:18 -0800 (PST) Date: Tue, 11 Jan 2022 13:32:17 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Reuse Make_Temporary where possible Message-ID: <20220111133217.GA748741@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Simplify: Make_Defining_Identifier (Loc, Chars => New_Internal_Name (C)); into: Make_Temporary (Loc, C); Code cleanup related to creation of itypes for allocators in GNATprove mode; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch7.adb (Set_Block_Elab_Proc, Unnest_Block, Unnest_Loop, Unnest_Statement_List): Simplify with Make_Temporary. * exp_put_image.adb (Build_Image_Call): Likewise. * inline.adb (Generate_Subprogram_Body): Likewise. * sem_ch13.adb (Build_Predicate_Functions): Likewise. * sem_util.adb (New_Copy_Separate_List): Likewise. diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -4737,8 +4737,7 @@ package body Exp_Ch7 is procedure Set_Block_Elab_Proc is begin if No (Block_Elab_Proc) then - Block_Elab_Proc := - Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('I')); + Block_Elab_Proc := Make_Temporary (Loc, 'I'); end if; end Set_Block_Elab_Proc; @@ -9964,9 +9963,7 @@ package body Exp_Ch7 is Local_Scop := Entity (Identifier (Decl)); Ent := First_Entity (Local_Scop); - Local_Proc := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('P')); + Local_Proc := Make_Temporary (Loc, 'P'); Local_Body := Make_Subprogram_Body (Loc, @@ -10114,9 +10111,7 @@ package body Exp_Ch7 is Local_Scop := Entity (Identifier (Loop_Stmt)); Ent := First_Entity (Local_Scop); - Local_Proc := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('P')); + Local_Proc := Make_Temporary (Loc, 'P'); Local_Body := Make_Subprogram_Body (Loc, @@ -10170,9 +10165,7 @@ package body Exp_Ch7 is New_Stmts : constant List_Id := Empty_List; begin - Local_Proc := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('P')); + Local_Proc := Make_Temporary (Loc, 'P'); Local_Body := Make_Subprogram_Body (Loc, diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb --- a/gcc/ada/exp_put_image.adb +++ b/gcc/ada/exp_put_image.adb @@ -1072,7 +1072,7 @@ package body Exp_Put_Image is Loc : constant Source_Ptr := Sloc (N); U_Type : constant Entity_Id := Underlying_Type (Entity (Prefix (N))); Sink_Entity : constant Entity_Id := - Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('S')); + Make_Temporary (Loc, 'S'); Sink_Decl : constant Node_Id := Make_Object_Declaration (Loc, Defining_Identifier => Sink_Entity, @@ -1090,7 +1090,7 @@ package body Exp_Put_Image is New_Occurrence_Of (Sink_Entity, Loc), Image_Prefix)); Result_Entity : constant Entity_Id := - Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('R')); + Make_Temporary (Loc, 'R'); Result_Decl : constant Node_Id := Make_Object_Declaration (Loc, Defining_Identifier => Result_Entity, diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -2189,7 +2189,7 @@ package body Inline is -- conflicts when the non-inlined body N is analyzed. Set_Defining_Unit_Name (Specification (Body_To_Inline), - Make_Defining_Identifier (Sloc (N), New_Internal_Name ('P'))); + Make_Temporary (Sloc (N), 'P')); Set_Corresponding_Spec (Body_To_Inline, Empty); end Generate_Subprogram_Body; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10666,8 +10666,7 @@ package body Sem_Ch13 is -- what happens if a return appears within a return. BTemp := - Make_Defining_Identifier (Loc, - Chars => New_Internal_Name ('B')); + Make_Temporary (Loc, 'B'); FBody := Make_Subprogram_Body (Loc, diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -23435,8 +23435,7 @@ package body Sem_Util is Elmt := First_Elmt (Decls); while Present (Elmt) loop Decl := Node (Elmt); - New_E := Make_Defining_Identifier (Sloc (Decl), - New_Internal_Name ('P')); + New_E := Make_Temporary (Sloc (Decl), 'P'); if Nkind (Decl) = N_Expression_Function then Decl := Specification (Decl);