[multiple changes]

2014-11-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb (Make_Call_Into_Operator): In ASIS mode, propagate
	back the resolved operands to the original call node, taking
	into account that the original call may have named associations.

2014-11-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* inline.adb (Has_Some_Contract): Change the
	guard to test the Ekind of the entity rather than the Analyzed
	flag. This handles partially analyzed contexts.

2014-11-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Analyze_Object_Renaming): In Ada 83 mode, do
	not reject the renaming of a function result if the renaming
	does not come for source.

2014-11-20  Robert Dewar  <dewar@adacore.com>

	* exp_util.ads: Minor addition of ??? clause.

2014-11-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (Is_Variable): For an Ada 2012 implicit
	dereference introduced for an indexing opertion, check that the
	type of the corresponding access discriminant is not an access
	to constant.

2014-11-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch6.adb (Find_Corresponding_Spec): Inherit
	the ghostness of the matching spec, the same way convention
	is inherited.

From-SVN: r217835
This commit is contained in:
Arnaud Charlet 2014-11-20 12:00:44 +01:00
parent 4a0a5d5fc1
commit c05ba1f179
7 changed files with 109 additions and 14 deletions

View File

@ -1,3 +1,38 @@
2014-11-20 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb (Make_Call_Into_Operator): In ASIS mode, propagate
back the resolved operands to the original call node, taking
into account that the original call may have named associations.
2014-11-20 Hristian Kirtchev <kirtchev@adacore.com>
* inline.adb (Has_Some_Contract): Change the
guard to test the Ekind of the entity rather than the Analyzed
flag. This handles partially analyzed contexts.
2014-11-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Object_Renaming): In Ada 83 mode, do
not reject the renaming of a function result if the renaming
does not come for source.
2014-11-20 Robert Dewar <dewar@adacore.com>
* exp_util.ads: Minor addition of ??? clause.
2014-11-20 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (Is_Variable): For an Ada 2012 implicit
dereference introduced for an indexing opertion, check that the
type of the corresponding access discriminant is not an access
to constant.
2014-11-20 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch6.adb (Find_Corresponding_Spec): Inherit
the ghostness of the matching spec, the same way convention
is inherited.
2014-11-20 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch3.adb (Analyze_Object_Declaration): Swap a couple of

View File

@ -511,6 +511,9 @@ package Exp_Util is
-- Note: this function can be costly and must be invoked with special care.
-- Possibly we could introduce a flag at parse time indicating the presence
-- of an address clause to speed this up???
--
-- Note: currently this function does not scan the private part, that seems
-- like a potential bug ???
procedure Force_Evaluation
(Exp : Node_Id;

View File

@ -1327,9 +1327,9 @@ package body Inline is
begin
-- A call to an expression function may precede the actual body which
-- is inserted at the end of the enclosing declarations. Ensure that
-- the related entity is analyzed before inspecting the contract.
-- the related entity is decorated before inspecting the contract.
if Analyzed (Id) then
if Is_Subprogram_Or_Generic_Subprogram (Id) then
Items := Contract (Id);
return Present (Items)

View File

@ -7415,8 +7415,16 @@ package body Sem_Ch6 is
-- spec to match a body, full conformance is expected.
if In_Instance then
-- Inherit the convention and "ghostness" of the matching
-- spec to ensure proper full and subtype conformance.
Set_Convention (Designator, Convention (E));
if Is_Ghost_Entity (E) then
Set_Is_Ghost_Entity (Designator);
end if;
-- Skip past subprogram bodies and subprogram renamings that
-- may appear to have a matching spec, but that aren't fully
-- conformant with it. That can occur in cases where an

View File

@ -1058,10 +1058,11 @@ package body Sem_Ch8 is
if Nkind (Nam) = N_Function_Call then
case Ada_Version is
-- Usage is illegal in Ada 83
-- Usage is illegal in Ada 83, but renamings are also introduced
-- during expansion, and error does not apply to those.
when Ada_83 =>
if Comes_From_Source (Nam) then
if Comes_From_Source (N) then
Error_Msg_N
("(Ada 83) cannot rename function return object", Nam);
end if;

View File

@ -1793,15 +1793,61 @@ package body Sem_Res is
and then Nkind (N) in N_Op
and then Nkind (Original_Node (N)) = N_Function_Call
then
if Is_Binary then
Rewrite (First (Parameter_Associations (Original_Node (N))),
Relocate_Node (Left_Opnd (N)));
Rewrite (Next (First (Parameter_Associations (Original_Node (N)))),
Relocate_Node (Right_Opnd (N)));
else
Rewrite (First (Parameter_Associations (Original_Node (N))),
Relocate_Node (Right_Opnd (N)));
end if;
declare
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
Old_First : constant Node_Id :=
First (Parameter_Associations (Original_Node (N)));
Old_Sec : Node_Id;
begin
if Is_Binary then
Old_Sec := Next (Old_First);
-- If the original call has named associations, replace the
-- explicit actual parameter in the association with the proper
-- resolved operand.
if Nkind (Old_First) = N_Parameter_Association then
if Chars (Selector_Name (Old_First)) =
Chars (First_Entity (Op_Id))
then
Rewrite (Explicit_Actual_Parameter (Old_First),
Relocate_Node (L));
else
Rewrite (Explicit_Actual_Parameter (Old_First),
Relocate_Node (R));
end if;
else
Rewrite (Old_First, Relocate_Node (L));
end if;
if Nkind (Old_Sec) = N_Parameter_Association then
if Chars (Selector_Name (Old_Sec)) =
Chars (First_Entity (Op_Id))
then
Rewrite (Explicit_Actual_Parameter (Old_Sec),
Relocate_Node (L));
else
Rewrite (Explicit_Actual_Parameter (Old_Sec),
Relocate_Node (R));
end if;
else
Rewrite (Old_Sec, Relocate_Node (R));
end if;
else
if Nkind (Old_First) = N_Parameter_Association then
Rewrite (Explicit_Actual_Parameter (Old_First),
Relocate_Node (R));
else
Rewrite (Old_First, Relocate_Node (R));
end if;
end if;
end;
Set_Parent (Original_Node (N), Parent (N));
end if;

View File

@ -12806,12 +12806,14 @@ package body Sem_Util is
Is_Variable_Prefix (Original_Node (Prefix (N)));
-- in Ada 2012, the dereference may have been added for a type with
-- a declared implicit dereference aspect.
-- a declared implicit dereference aspect. Check that it is not an
-- access to constant.
elsif Nkind (N) = N_Explicit_Dereference
and then Present (Etype (Orig_Node))
and then Ada_Version >= Ada_2012
and then Has_Implicit_Dereference (Etype (Orig_Node))
and then not Is_Access_Constant (Etype (Prefix (N)))
then
return True;