diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-11-23 14:38:45 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-12-14 10:51:55 -0500 |
commit | 7837a887d6672735d24737baf46ece96dc53a02d (patch) | |
tree | 6b75ec592c2d6625f08059e5b6d13afccad16cc4 | |
parent | 041f8c70ad0e9cf0b40a3e51c444349bf00d35a3 (diff) | |
download | gcc-7837a887d6672735d24737baf46ece96dc53a02d.zip gcc-7837a887d6672735d24737baf46ece96dc53a02d.tar.gz gcc-7837a887d6672735d24737baf46ece96dc53a02d.tar.bz2 |
[Ada] Refactor duplicated code for First and Last attributes
gcc/ada/
* sem_attr.adb (Analyze_Attribute): Merge identical code for
First/Last, First_Bit/Last_Bit and First_Valid/Last_Valid
attributes.
-rw-r--r-- | gcc/ada/sem_attr.adb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index b243af6..5262244 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -4066,7 +4066,9 @@ package body Sem_Attr is -- First -- ----------- - when Attribute_First => + when Attribute_First + | Attribute_Last + => Check_Array_Or_Scalar_Type; Bad_Attribute_For_Predicate; @@ -4074,7 +4076,9 @@ package body Sem_Attr is -- First_Bit -- --------------- - when Attribute_First_Bit => + when Attribute_First_Bit + | Attribute_Last_Bit + => Check_Component; Set_Etype (N, Universal_Integer); @@ -4082,7 +4086,9 @@ package body Sem_Attr is -- First_Valid -- ----------------- - when Attribute_First_Valid => + when Attribute_First_Valid + | Attribute_Last_Valid + => Check_First_Last_Valid; Set_Etype (N, P_Type); @@ -4295,25 +4301,19 @@ package body Sem_Attr is -- Last -- ---------- - when Attribute_Last => - Check_Array_Or_Scalar_Type; - Bad_Attribute_For_Predicate; + -- Shares processing with First attribute -------------- -- Last_Bit -- -------------- - when Attribute_Last_Bit => - Check_Component; - Set_Etype (N, Universal_Integer); + -- Shares processing with First_Bit attribute ---------------- -- Last_Valid -- ---------------- - when Attribute_Last_Valid => - Check_First_Last_Valid; - Set_Etype (N, P_Type); + -- Shares processing with First_Valid attribute ------------------ -- Leading_Part -- |