From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id BC9093858036; Tue, 21 Sep 2021 15:27:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC9093858036 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3748] [Ada] Set related expression for external DISCR symbols in Build_Temporary X-Act-Checkin: gcc X-Git-Author: Daniel Mercier X-Git-Refname: refs/heads/master X-Git-Oldrev: 13b594411d2a339e91345c0c5672d49a287dd035 X-Git-Newrev: 900f9d999cc4870cc3cb70224e9694212385a4d3 Message-Id: <20210921152735.BC9093858036@sourceware.org> Date: Tue, 21 Sep 2021 15:27:35 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 15:27:35 -0000 https://gcc.gnu.org/g:900f9d999cc4870cc3cb70224e9694212385a4d3 commit r12-3748-g900f9d999cc4870cc3cb70224e9694212385a4d3 Author: Daniel Mercier Date: Fri Jul 2 12:57:53 2021 +0200 [Ada] Set related expression for external DISCR symbols in Build_Temporary gcc/ada/ * exp_util.adb (Build_Temporary): In case of an external DISCR symbol, set the related expression for CodePeer so that a more comprehensible message can be emitted to the user. Diff: --- gcc/ada/exp_util.adb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 96654815119..ad5a6fab2e9 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -11656,6 +11656,7 @@ package body Exp_Util is is Temp_Id : Entity_Id; Temp_Nam : Name_Id; + Should_Set_Related_Expression : Boolean := False; begin -- The context requires an external symbol : expression is @@ -11675,6 +11676,12 @@ package body Exp_Util is else pragma Assert (Discr_Number > 0); + + -- We don't have any intelligible way of printing T_DISCR in + -- CodePeer. Thus, set a related expression in this case. + + Should_Set_Related_Expression := True; + -- Use fully qualified name to avoid ambiguities. Temp_Nam := @@ -11684,6 +11691,10 @@ package body Exp_Util is Temp_Id := Make_Defining_Identifier (Loc, Temp_Nam); + if Should_Set_Related_Expression then + Set_Related_Expression (Temp_Id, Related_Nod); + end if; + -- Otherwise generate an internal temporary else