Commit 97710dc7 by Javier Miranda Committed by Pierre-Marie de Rodat

[Ada] Fix expansion of 'Count in protected types

2018-07-16  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference ['Count]): Do not
	transform 'Count into a function call if the current scope has been
	eliminated.

From-SVN: r262703
parent 4bde5d8c
2018-07-16 Javier Miranda <miranda@adacore.com>
* exp_attr.adb (Expand_N_Attribute_Reference ['Count]): Do not
transform 'Count into a function call if the current scope has been
eliminated.
2018-07-16 Javier Miranda <miranda@adacore.com>
* sem_util.ads, sem_util.adb (Has_Prefix): Move this function to the
public part of this package.
......
......@@ -3049,6 +3049,16 @@ package body Exp_Attr is
-- Protected case
if Is_Protected_Type (Conctyp) then
-- No need to transform 'Count into a function call if the current
-- scope has been eliminated. In this case such transformation is
-- also not viable because the enclosing protected object is not
-- available.
if Is_Eliminated (Current_Scope) then
return;
end if;
case Corresponding_Runtime_Package (Conctyp) is
when System_Tasking_Protected_Objects_Entries =>
Name := New_Occurrence_Of (RTE (RE_Protected_Count), Loc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment