Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
f29afe5f
Commit
f29afe5f
authored
Feb 06, 2014
by
Arnaud Charlet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code clean ups.
From-SVN: r207560
parent
aa9b151a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
13 deletions
+39
-13
gcc/ada/exp_aggr.adb
+39
-13
No files found.
gcc/ada/exp_aggr.adb
View file @
f29afe5f
...
...
@@ -3280,6 +3280,7 @@ package body Exp_Aggr is
T : Entity_Id;
Temp : Entity_Id;
Aggr_Code : List_Id;
Instr : Node_Id;
Target_Expr : Node_Id;
Parent_Kind : Node_Kind;
...
...
@@ -3361,9 +3362,7 @@ package body Exp_Aggr is
end if;
if Requires_Transient_Scope (Typ) then
Establish_Transient_Scope
(N, Sec_Stack =>
Is_Controlled (Typ) or else Has_Controlled_Component (Typ));
Establish_Transient_Scope (N, Sec_Stack => Needs_Finalization (Typ));
end if;
-- If the aggregate is non-limited, create a temporary. If it is limited
...
...
@@ -3401,8 +3400,20 @@ package body Exp_Aggr is
Set_No_Initialization (Instr);
Insert_Action (N, Instr);
Initialize_Discriminants (Instr, T);
Target_Expr := New_Occurrence_Of (Temp, Loc);
Insert_Actions (N, Build_Record_Aggr_Code (N, T, Target_Expr));
Aggr_Code := Build_Record_Aggr_Code (N, T, Target_Expr);
-- Save the last assignment statement associated with the aggregate
-- when building a controlled object. This reference is utilized by
-- the finalization machinery when marking an object as successfully
-- initialized.
if Needs_Finalization (T) then
Set_Last_Aggregate_Assignment (Temp, Last (Aggr_Code));
end if;
Insert_Actions (N, Aggr_Code);
Rewrite (N, New_Occurrence_Of (Temp, Loc));
Analyze_And_Resolve (N, T);
end if;
...
...
@@ -5702,17 +5713,15 @@ package body Exp_Aggr is
then
Convert_To_Assignments
(
N
,
Typ
);
--
Temporaries
for
controlled
aggregates
need
to
be
attached
to
a
final
--
chain
in
order
to
be
properly
finalized
,
so
it
has
to
be
created
in
--
the
front
-
end
--
An
aggregate
used
to
initialize
a
controlled
object
must
be
turned
--
into
component
assignments
as
the
components
themselves
may
require
--
finalization
actions
such
as
adjustment
.
elsif
Is_Controlled
(
Typ
)
or
else
Has_Controlled_Component
(
Base_Type
(
Typ
))
then
elsif
Needs_Finalization
(
Typ
)
then
Convert_To_Assignments
(
N
,
Typ
);
--
Ada
2005
(
AI
-
287
):
In
case
of
default
initialized
components
we
--
convert
the
aggregate
into
assignments
.
--
Ada
2005
(
AI
-
287
):
In
case
of
default
initialized
components
we
--
convert
the
aggregate
into
assignments
.
elsif
Has_Default_Init_Comps
(
N
)
then
Convert_To_Assignments
(
N
,
Typ
);
...
...
@@ -6188,9 +6197,26 @@ package body Exp_Aggr is
Typ
:
Entity_Id
;
Target
:
Node_Id
)
return
List_Id
is
Aggr_Code
:
List_Id
;
begin
if
Is_Record_Type
(
Etype
(
N
))
then
return
Build_Record_Aggr_Code
(
N
,
Typ
,
Target
);
Aggr_Code
:=
Build_Record_Aggr_Code
(
N
,
Typ
,
Target
);
--
Save
the
last
assignment
statement
associated
with
the
aggregate
--
when
building
a
controlled
object
.
This
reference
is
utilized
by
--
the
finalization
machinery
when
marking
an
object
as
successfully
--
initialized
.
if
Needs_Finalization
(
Typ
)
and
then
Is_Entity_Name
(
Target
)
and
then
Present
(
Entity
(
Target
))
and
then
Ekind
(
Entity
(
Target
))
=
E_Variable
then
Set_Last_Aggregate_Assignment
(
Entity
(
Target
),
Last
(
Aggr_Code
));
end
if
;
return
Aggr_Code
;
else
pragma
Assert
(
Is_Array_Type
(
Etype
(
N
)));
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment