[Ada] Cleanup related to volatile objects in restricted contexts

gcc/ada/

	* sem_res.adb (Is_Assignment_Or_Object_Expression): Whitespace
	cleanup.
	(Is_Attribute_Expression): Prevent AST climbing from going to
	the root of the compilation unit.
This commit is contained in:
Piotr Trojanek
2021-03-01 16:36:08 +01:00
committed by Pierre-Marie de Rodat
parent 788fed4b39
commit f7f37ed649

View File

@@ -7701,8 +7701,7 @@ package body Sem_Res is
Expr : Node_Id) return Boolean
is
begin
if Nkind (Context) in
N_Assignment_Statement | N_Object_Declaration
if Nkind (Context) in N_Assignment_Statement | N_Object_Declaration
and then Expression (Context) = Expr
then
return True;
@@ -7744,6 +7743,11 @@ package body Sem_Res is
while Present (N) loop
if Nkind (N) = N_Attribute_Reference then
return True;
-- Prevent the search from going too far
elsif Is_Body_Or_Package_Declaration (N) then
return False;
end if;
N := Parent (N);