aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-10-06 11:58:45 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-24 05:16:04 -0500
commit3a6fa9a81bdbd5491204e68b2ad5a5d8516d56a1 (patch)
treefc14b46b614d49474e91dba2bc944564165e15ee
parent1b55b8d70f431e29131cc7ca5790490d95625bd0 (diff)
downloadgcc-3a6fa9a81bdbd5491204e68b2ad5a5d8516d56a1.zip
gcc-3a6fa9a81bdbd5491204e68b2ad5a5d8516d56a1.tar.gz
gcc-3a6fa9a81bdbd5491204e68b2ad5a5d8516d56a1.tar.bz2
[Ada] Cleanup expansion of attribute Constrained
gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): Replace calls to Sloc with a local constant Loc; remove call to Analyze_And_Resolve and return, which is exactly what happens anyway (and other branches in the Constrained declare block appear to rely on analysis, resolution and returning happening in all cases). * sem_util.adb: Remove useless parens.
-rw-r--r--gcc/ada/exp_attr.adb11
-rw-r--r--gcc/ada/sem_util.adb2
2 files changed, 4 insertions, 9 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index f95c682..40de27b 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -2923,8 +2923,6 @@ package body Exp_Attr is
when Attribute_Constrained => Constrained : declare
Formal_Ent : constant Entity_Id := Param_Entity (Pref);
- -- Start of processing for Constrained
-
begin
-- Reference to a parameter where the value is passed as an extra
-- actual, corresponding to the extra formal referenced by the
@@ -2938,7 +2936,7 @@ package body Exp_Attr is
then
Rewrite (N,
New_Occurrence_Of
- (Extra_Constrained (Formal_Ent), Sloc (N)));
+ (Extra_Constrained (Formal_Ent), Loc));
-- If the prefix is an access to object, the attribute applies to
-- the designated object, so rewrite with an explicit dereference.
@@ -2949,8 +2947,6 @@ package body Exp_Attr is
then
Rewrite (Pref,
Make_Explicit_Dereference (Loc, Relocate_Node (Pref)));
- Analyze_And_Resolve (N, Standard_Boolean);
- return;
-- For variables with a Extra_Constrained field, we use the
-- corresponding entity.
@@ -2961,7 +2957,7 @@ package body Exp_Attr is
then
Rewrite (N,
New_Occurrence_Of
- (Extra_Constrained (Entity (Pref)), Sloc (N)));
+ (Extra_Constrained (Entity (Pref)), Loc));
-- For all other cases, we can tell at compile time
@@ -2978,8 +2974,7 @@ package body Exp_Attr is
Rewrite (N,
New_Occurrence_Of
(Boolean_Literals
- (Exp_Util.Attribute_Constrained_Static_Value
- (Pref)), Sloc (N)));
+ (Exp_Util.Attribute_Constrained_Static_Value (Pref)), Loc));
end if;
Analyze_And_Resolve (N, Standard_Boolean);
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 1190cfe..3af4f3a 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25694,7 +25694,7 @@ package body Sem_Util is
end if;
end if;
- return (Empty);
+ return Empty;
end Param_Entity;
----------------------