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-4172] [Ada] Mark private component renaming as coming from source Date: Tue, 5 Oct 2021 08:24:27 +0000 (GMT) [thread overview] Message-ID: <20211005082427.56248385841A@sourceware.org> (raw) https://gcc.gnu.org/g:b1657ff3a089785542938216e011f454be03ed89 commit r12-4172-gb1657ff3a089785542938216e011f454be03ed89 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Thu Sep 23 12:06:42 2021 +0200 [Ada] Mark private component renaming as coming from source gcc/ada/ * exp_ch9.adb (Install_Private_Data_Declarations): Copy the Sloc of components for the local renamings as well as the Comes_From_Source flag, and also set Warnings_Off on them. Use Nam local variable. Diff: --- gcc/ada/exp_ch9.adb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index dec41eed2f8..694cf9047ad 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -13796,14 +13796,15 @@ package body Exp_Ch9 is Comp : Node_Id; Comp_Id : Entity_Id; Decl_Id : Entity_Id; + Nam : Name_Id; begin Comp := First (Private_Declarations (Def)); while Present (Comp) loop if Nkind (Comp) = N_Component_Declaration then Comp_Id := Defining_Identifier (Comp); - Decl_Id := - Make_Defining_Identifier (Loc, Chars (Comp_Id)); + Nam := Chars (Comp_Id); + Decl_Id := Make_Defining_Identifier (Sloc (Comp_Id), Nam); -- Minimal decoration @@ -13818,6 +13819,14 @@ package body Exp_Ch9 is Set_Is_Aliased (Decl_Id, Is_Aliased (Comp_Id)); Set_Is_Independent (Decl_Id, Is_Independent (Comp_Id)); + -- Copy the Comes_From_Source flag of the component, as + -- the renaming may be the only entity directly seen by + -- the user in the context, but do not warn for it. + + Set_Comes_From_Source + (Decl_Id, Comes_From_Source (Comp_Id)); + Set_Warnings_Off (Decl_Id); + -- Generate: -- comp_name : comp_typ renames _object.comp_name; @@ -13828,10 +13837,8 @@ package body Exp_Ch9 is New_Occurrence_Of (Etype (Comp_Id), Loc), Name => Make_Selected_Component (Loc, - Prefix => - New_Occurrence_Of (Obj_Ent, Loc), - Selector_Name => - Make_Identifier (Loc, Chars (Comp_Id)))); + Prefix => New_Occurrence_Of (Obj_Ent, Loc), + Selector_Name => Make_Identifier (Loc, Nam))); Add (Decl); end if;
reply other threads:[~2021-10-05 8:24 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=20211005082427.56248385841A@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).