+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.
---------------------
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
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
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