begin
if Constant_Present (N) then
Mutate_Ekind (Id, E_Constant);
+ Set_Is_True_Constant (Id);
else
Mutate_Ekind (Id, E_Variable);
end if;
+ -- Indicate this is not set in source. Certainly true for constants, and
+ -- true for variables so far (will be reset for a variable if and when
+ -- we encounter a modification in the source).
+
+ Set_Never_Set_In_Source (Id);
+
-- There are three kinds of implicit types generated by an
-- object declaration:
Set_Etype (E, T);
end if;
- -- If an initialization expression is present, then we set the
- -- Is_True_Constant flag. It will be reset if this is a variable
- -- and it is indeed modified.
-
- Set_Is_True_Constant (Id, True);
-
-- If we are analyzing a constant declaration, set its completion
-- flag after analyzing and resolving the expression.
if Constant_Present (N) then
Set_Has_Completion (Id);
+
+ -- Set Has_Initial_Value if initialization expression present. Note
+ -- that if there is no initializing expression, we leave the state
+ -- of this flag unchanged (usually it will be False, but notably in
+ -- the case of exception choice variables, it will already be true).
+
+ -- Set Is_True_Constant if initialization expression is present. It
+ -- will be reset if the variable is indeed modified.
+
+ else
+ Set_Has_Initial_Value (Id);
+ Set_Is_True_Constant (Id);
end if;
-- Set type and resolve (type may be overridden later on)
-- that subsequent uses of this entity are not rejected
-- via the same mechanism that (correctly) rejects
-- "X : Integer := X;".
-
- if Constant_Present (N) then
- Set_Is_True_Constant (Id);
- else
- if Present (E) then
- Set_Has_Initial_Value (Id);
- end if;
- end if;
-
goto Leave;
end if;
Check_Wide_Character_Restriction (T, Object_Definition (N));
- -- Indicate this is not set in source. Certainly true for constants, and
- -- true for variables so far (will be reset for a variable if and when
- -- we encounter a modification in the source).
-
- Set_Never_Set_In_Source (Id);
-
-- Now establish the proper kind and type of the object
if Ekind (Id) = E_Void then
Reinit_Field_To_Zero (Id, F_Next_Inlined_Subprogram);
end if;
- if Constant_Present (N) then
- Set_Is_True_Constant (Id);
+ -- A variable is set as shared passive if it appears in a shared
+ -- passive package, and is at the outer level. This is not done for
+ -- entities generated during expansion, because those are always
+ -- manipulated locally.
- else
- -- A variable is set as shared passive if it appears in a shared
- -- passive package, and is at the outer level. This is not done for
- -- entities generated during expansion, because those are always
- -- manipulated locally.
-
- if Is_Shared_Passive (Current_Scope)
- and then Is_Library_Level_Entity (Id)
- and then Comes_From_Source (Id)
- then
- Set_Is_Shared_Passive (Id);
- Check_Shared_Var (Id, T, N);
- end if;
-
- -- Set Has_Initial_Value if initializing expression present. Note
- -- that if there is no initializing expression, we leave the state
- -- of this flag unchanged (usually it will be False, but notably in
- -- the case of exception choice variables, it will already be true).
-
- if Present (E) then
- Set_Has_Initial_Value (Id);
- end if;
+ if not Constant_Present (N)
+ and then Is_Shared_Passive (Current_Scope)
+ and then Is_Library_Level_Entity (Id)
+ and then Comes_From_Source (Id)
+ then
+ Set_Is_Shared_Passive (Id);
+ Check_Shared_Var (Id, T, N);
end if;
-- Set the SPARK mode from the current context (may be overwritten later