public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1504] [Ada] Do not perform useless work in Check_No_Parts_Violations
Date: Wed, 16 Jun 2021 08:44:42 +0000 (GMT)	[thread overview]
Message-ID: <20210616084442.B1B7F398A877@sourceware.org> (raw)

https://gcc.gnu.org/g:5c44cc1c7363ed3e5ea506bb8c3479b5d2d67342

commit r12-1504-g5c44cc1c7363ed3e5ea506bb8c3479b5d2d67342
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Feb 23 12:50:25 2021 +0100

    [Ada] Do not perform useless work in Check_No_Parts_Violations
    
    gcc/ada/
    
            * freeze.adb (Check_No_Parts_Violations): Return earlier if the
            type is elementary or does not come from source.

Diff:
---
 gcc/ada/freeze.adb | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 91f17244dae..fd8216969a7 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -2584,27 +2584,30 @@ package body Freeze is
 
          --  Local declarations
 
-         Types_With_Aspect : Elist_Id :=
-           Get_Types_With_Aspect_In_Hierarchy (Typ);
-
-         Aspect_Value     : Entity_Id;
-         Curr_Value       : Entity_Id;
-         Curr_Typ_Elmt    : Elmt_Id;
-         Curr_Body_Elmt   : Elmt_Id;
-         Curr_Formal_Elmt : Elmt_Id;
-         Gen_Bodies       : Elist_Id;
-         Gen_Formals      : Elist_Id;
-         Scop             : Entity_Id;
+         Aspect_Value      : Entity_Id;
+         Curr_Value        : Entity_Id;
+         Curr_Typ_Elmt     : Elmt_Id;
+         Curr_Body_Elmt    : Elmt_Id;
+         Curr_Formal_Elmt  : Elmt_Id;
+         Gen_Bodies        : Elist_Id;
+         Gen_Formals       : Elist_Id;
+         Scop              : Entity_Id;
+         Types_With_Aspect : Elist_Id;
 
       --  Start of processing for Check_No_Parts_Violations
 
       begin
-         --  There are no types with No_Parts specified, so there
-         --  is nothing to check.
+         --  Nothing to check if the type is elementary or artificial
 
-         if Is_Empty_Elmt_List (Types_With_Aspect)
-           or else not Comes_From_Source (Typ)
-         then
+         if Is_Elementary_Type (Typ) or else not Comes_From_Source (Typ) then
+            return;
+         end if;
+
+         Types_With_Aspect := Get_Types_With_Aspect_In_Hierarchy (Typ);
+
+         --  Nothing to check if there are no types with No_Parts specified
+
+         if Is_Empty_Elmt_List (Types_With_Aspect) then
             return;
          end if;


                 reply	other threads:[~2021-06-16  8:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210616084442.B1B7F398A877@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).