Commit 63254915 by Arnaud Charlet Committed by Pierre-Marie de Rodat

[Ada] Simplify expansion of "and then" in CodePeer mode

2018-06-11  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* exp_ch4.adb (Expand_Record_Equality): Remove extraneous "True and
	then" and general logical "ada" in codepeer mode.

From-SVN: r261418
parent 09adaa8d
2018-06-11 Arnaud Charlet <charlet@adacore.com>
* exp_ch4.adb (Expand_Record_Equality): Remove extraneous "True and
then" and general logical "ada" in codepeer mode.
2018-06-11 Javier Miranda <miranda@adacore.com>
* exp_ch9.adb (Expand_N_Protected_Body): Add missing handling of
......
......@@ -12154,12 +12154,11 @@ package body Exp_Ch4 is
-- Generates the following code: (assuming that Typ has one Discr and
-- component C2 is also a record)
-- True
-- and then Lhs.Discr1 = Rhs.Discr1
-- and then Lhs.C1 = Rhs.C1
-- and then Lhs.C2.C1=Rhs.C2.C1 and then ... Lhs.C2.Cn=Rhs.C2.Cn
-- and then ...
-- and then Lhs.Cmpn = Rhs.Cmpn
-- Lhs.Discr1 = Rhs.Discr1
-- and then Lhs.C1 = Rhs.C1
-- and then Lhs.C2.C1=Rhs.C2.C1 and then ... Lhs.C2.Cn=Rhs.C2.Cn
-- and then ...
-- and then Lhs.Cmpn = Rhs.Cmpn
Result := New_Occurrence_Of (Standard_True, Loc);
C := Element_To_Compare (First_Entity (Typ));
......@@ -12171,7 +12170,6 @@ package body Exp_Ch4 is
begin
if First_Time then
First_Time := False;
New_Lhs := Lhs;
New_Rhs := Rhs;
else
......@@ -12199,13 +12197,28 @@ package body Exp_Ch4 is
Set_Etype (Result, Standard_Boolean);
exit;
else
Result :=
Make_And_Then (Loc,
Left_Opnd => Result,
Right_Opnd => Check);
if First_Time then
Result := Check;
-- Generate logical "and" for CodePeer to simplify the
-- generated code and analysis.
elsif CodePeer_Mode then
Result :=
Make_Op_And (Loc,
Left_Opnd => Result,
Right_Opnd => Check);
else
Result :=
Make_And_Then (Loc,
Left_Opnd => Result,
Right_Opnd => Check);
end if;
end if;
end;
First_Time := False;
C := Element_To_Compare (Next_Entity (C));
end loop;
......
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