aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-02-17 18:00:41 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-08 03:51:12 -0400
commit5351d617ec82bc2795a514e9de815484fb8cd0fc (patch)
tree83d573643cf7bd7bdf6a3d4e4e57e049027ad92f /gcc
parente344ec2553320fa95414e39001435076f277e335 (diff)
downloadgcc-5351d617ec82bc2795a514e9de815484fb8cd0fc.zip
gcc-5351d617ec82bc2795a514e9de815484fb8cd0fc.tar.gz
gcc-5351d617ec82bc2795a514e9de815484fb8cd0fc.tar.bz2
[Ada] Port a modified expansion of Enum_Rep from GNAT to GNATprove
2020-06-08 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Port changes in frontend expander.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_spark.adb13
1 files changed, 3 insertions, 10 deletions
diff --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb
index a54a162..c115a45 100644
--- a/gcc/ada/exp_spark.adb
+++ b/gcc/ada/exp_spark.adb
@@ -200,7 +200,8 @@ package body Exp_SPARK is
Analyze_And_Resolve (N, Typ);
-- Whenever possible, replace a prefix which is an enumeration literal
- -- by the corresponding literal value.
+ -- by the corresponding literal value, just like it happens in the GNAT
+ -- expander.
elsif Attr_Id = Attribute_Enum_Rep then
declare
@@ -215,15 +216,7 @@ package body Exp_SPARK is
-- If the argument is a literal, expand it
if Nkind (Expr) in N_Has_Entity
- and then
- (Ekind (Entity (Expr)) = E_Enumeration_Literal
- or else
- (Nkind (Expr) in N_Has_Entity
- and then Ekind (Entity (Expr)) = E_Constant
- and then Present (Renamed_Object (Entity (Expr)))
- and then Is_Entity_Name (Renamed_Object (Entity (Expr)))
- and then Ekind (Entity (Renamed_Object (Entity (Expr)))) =
- E_Enumeration_Literal))
+ and then Ekind (Entity (Expr)) = E_Enumeration_Literal
then
Exp_Attr.Expand_N_Attribute_Reference (N);
end if;