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-1502] [Ada] Use more straightforward implementation for Current_Entity_In_Scope Date: Wed, 16 Jun 2021 08:44:32 +0000 (GMT) [thread overview] Message-ID: <20210616084432.78C74398A848@sourceware.org> (raw) https://gcc.gnu.org/g:663e6d7960199559ebd3107a28ea1cfda3e5be00 commit r12-1502-g663e6d7960199559ebd3107a28ea1cfda3e5be00 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Sun Feb 21 18:27:25 2021 +0100 [Ada] Use more straightforward implementation for Current_Entity_In_Scope gcc/ada/ * sem_util.adb (Current_Entity_In_Scope): Reimplement. Diff: --- gcc/ada/sem_util.adb | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index c9a2c9fb228..9b2bf86e94e 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -6955,19 +6955,30 @@ package body Sem_Util is ----------------------------- function Current_Entity_In_Scope (N : Name_Id) return Entity_Id is - E : Entity_Id; CS : constant Entity_Id := Current_Scope; - Transient_Case : constant Boolean := Scope_Is_Transient; + E : Entity_Id; begin E := Get_Name_Entity_Id (N); - while Present (E) - and then Scope (E) /= CS - and then (not Transient_Case or else Scope (E) /= Scope (CS)) - loop - E := Homonym (E); - end loop; + + if No (E) then + null; + + elsif Scope_Is_Transient then + while Present (E) loop + exit when Scope (E) = CS or else Scope (E) = Scope (CS); + + E := Homonym (E); + end loop; + + else + while Present (E) loop + exit when Scope (E) = CS; + + E := Homonym (E); + end loop; + end if; return E; end Current_Entity_In_Scope;
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=20210616084432.78C74398A848@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: linkBe 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).