aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mercier <mercier@adacore.com>2021-07-02 12:57:53 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-21 15:25:01 +0000
commit900f9d999cc4870cc3cb70224e9694212385a4d3 (patch)
treec233b67fc778be9f648d6e3a434d153d22283777
parent13b594411d2a339e91345c0c5672d49a287dd035 (diff)
downloadgcc-900f9d999cc4870cc3cb70224e9694212385a4d3.zip
gcc-900f9d999cc4870cc3cb70224e9694212385a4d3.tar.gz
gcc-900f9d999cc4870cc3cb70224e9694212385a4d3.tar.bz2
[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.
-rw-r--r--gcc/ada/exp_util.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 9665481..ad5a6fa 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