aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2017-01-19 13:10:58 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2017-01-19 14:10:58 +0100
commit58d27da9306d829548d5343d70b3562d95186a55 (patch)
tree79f19be3420b68e5b5db1bf2f0a2e435d746a09e /gcc
parent6b1d24137789242dd580e98830689a28fc289e8a (diff)
downloadgcc-58d27da9306d829548d5343d70b3562d95186a55.zip
gcc-58d27da9306d829548d5343d70b3562d95186a55.tar.gz
gcc-58d27da9306d829548d5343d70b3562d95186a55.tar.bz2
exp_ch9.adb (Is_Pure_Barrier): Create function Is_Count_Attribute to identify an expansion of the 'Count attribute.
2017-01-19 Justin Squirek <squirek@adacore.com> * exp_ch9.adb (Is_Pure_Barrier): Create function Is_Count_Attribute to identify an expansion of the 'Count attribute. From-SVN: r244631
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/exp_ch9.adb30
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8287640..0b0888a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2017-01-19 Justin Squirek <squirek@adacore.com>
+
+ * exp_ch9.adb (Is_Pure_Barrier): Create function
+ Is_Count_Attribute to identify an expansion of the 'Count
+ attribute.
+
2017-01-19 Pierre-Marie de Rodat <derodat@adacore.com>
* exp_dbug.adb (Debug_Renaming_Declaration): Process underlying types.
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 4a98f19..9ea30ee 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -6025,6 +6025,25 @@ package body Exp_Ch9 is
---------------------
function Is_Pure_Barrier (N : Node_Id) return Traverse_Result is
+ function Is_Count_Attribute (N : Node_Id) return Boolean;
+ -- Check whether N is part of an expansion of the Count attribute.
+ -- Return True if N represents the expanded function call.
+
+ ------------------------
+ -- Is_Count_Attribute --
+ ------------------------
+
+ function Is_Count_Attribute (N : Node_Id) return Boolean is
+ begin
+ return
+ Nkind (N) = N_Function_Call
+ and then Present (Original_Node (N))
+ and then Nkind (Original_Node (N)) = N_Attribute_Reference
+ and then Attribute_Name (Original_Node (N)) = Name_Count;
+ end Is_Count_Attribute;
+
+ -- Start of processing for Is_Pure_Barrier
+
begin
case Nkind (N) is
when N_Expanded_Name
@@ -6034,6 +6053,12 @@ package body Exp_Ch9 is
return Abandon;
end if;
+ if Present (Parent (N))
+ and then Is_Count_Attribute (Parent (N))
+ then
+ return OK;
+ end if;
+
case Ekind (Entity (N)) is
when E_Constant
| E_Discriminant
@@ -6057,6 +6082,11 @@ package body Exp_Ch9 is
null;
end case;
+ when N_Function_Call =>
+ if Is_Count_Attribute (N) then
+ return OK;
+ end if;
+
when N_Character_Literal
| N_Integer_Literal
| N_Real_Literal