end if;
Set_Etype (Defining_Identifier (Discr), Discr_Type);
+ Set_Ekind (Defining_Identifier (Discr), E_Discriminant);
-- If a discriminant specification includes the assignment compound
-- delimiter followed by an expression, the expression is the default
(Defining_Identifier (Discr), Expression (Discr));
end if;
- -- In gnatc or gnatprove mode, make sure set Do_Range_Check flag
+ -- In gnatc or GNATprove mode, make sure set Do_Range_Check flag
-- gets set unless we can be sure that no range check is required.
if not Expander_Active
Discr_Number := Uint_1;
while Present (Discr) loop
Id := Defining_Identifier (Discr);
- Set_Ekind (Id, E_Discriminant);
Init_Component_Location (Id);
Init_Esize (Id);
Set_Discriminant_Number (Id, Discr_Number);
if Prag_Id /= Pragma_No_Caching
and then not Is_Effectively_Volatile (Obj_Id)
then
- if No_Caching_Enabled (Obj_Id) then
+ if Ekind (Obj_Id) = E_Variable
+ and then No_Caching_Enabled (Obj_Id)
+ then
SPARK_Msg_N
("illegal combination of external property % and property "
& """No_Caching"" (SPARK RM 7.1.2(6))", N);
-- respective root types.
if Nkind (Obj_Or_Type_Decl) /= N_Object_Declaration then
- if (Prag_Id = Pragma_No_Caching)
+ if Prag_Id = Pragma_No_Caching
or not Nkind_In (Original_Node (Obj_Or_Type_Decl),
N_Full_Type_Declaration,
N_Private_Type_Declaration,
-- will be done at the end of the declarative region that
-- contains the pragma.
- if Ekind (Obj_Or_Type_Id) = E_Variable or Is_Type (Obj_Or_Type_Id)
+ if Ekind (Obj_Or_Type_Id) = E_Variable
+ or else Is_Type (Obj_Or_Type_Id)
then
-- In the case of a type, pragma is a type-related
-- Otherwise Id denotes an object
- else
+ else pragma Assert (Is_Object (Id));
-- A volatile object for which No_Caching is enabled is not
-- effectively volatile.
return
- (Is_Volatile (Id) and then not No_Caching_Enabled (Id))
+ (Is_Volatile (Id)
+ and then not
+ (Ekind (Id) = E_Variable and then No_Caching_Enabled (Id)))
or else Has_Volatile_Components (Id)
or else Is_Effectively_Volatile (Etype (Id));
end if;
function Is_Effectively_Volatile_Object (N : Node_Id) return Boolean is
begin
if Is_Entity_Name (N) then
- return Is_Effectively_Volatile (Entity (N));
+ return Is_Object (Entity (N))
+ and then Is_Effectively_Volatile (Entity (N));
elsif Nkind (N) = N_Indexed_Component then
return Is_Effectively_Volatile_Object (Prefix (N));
------------------------
function No_Caching_Enabled (Id : Entity_Id) return Boolean is
+ pragma Assert (Ekind (Id) = E_Variable);
Prag : constant Node_Id := Get_Pragma (Id, Pragma_No_Caching);
Arg1 : Node_Id;