Skip to content

Commit bb7f3ad

Browse files
committed
Implement handling the address attribute
by returning address-of expression.
1 parent 43c5e3f commit bb7f3ad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

gnat2goto/driver/tree_walk.adb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ package body Tree_Walk is
385385
and then List_Length (Expressions (N)) = 1),
386386
Post => Kind (Do_Attribute_Succ_Discrete'Result) in Class_Expr;
387387

388+
function Do_Attribute_Address (N : Node_Id) return Irep
389+
with Pre => (Nkind (N) = N_Attribute_Reference
390+
and then Get_Attribute_Id (Attribute_Name (N)) =
391+
Attribute_Address),
392+
Post => Kind (Do_Attribute_Address'Result) in Class_Expr;
393+
388394
function Make_Malloc_Function_Call_Expr (Num_Elem : Irep;
389395
Element_Type_Size : Uint;
390396
Source_Loc : Source_Ptr)
@@ -1356,6 +1362,12 @@ package body Tree_Walk is
13561362
I_Type => Result_Type);
13571363
end Do_Attribute_Succ_Discrete;
13581364

1365+
function Do_Attribute_Address (N : Node_Id) return Irep is
1366+
Arg_Expr : constant Irep := Do_Expression (Prefix (N));
1367+
begin
1368+
return Make_Address_Of (Arg_Expr);
1369+
end Do_Attribute_Address;
1370+
13591371
-------------------
13601372
-- Do_Expression --
13611373
-------------------
@@ -1397,6 +1409,8 @@ package body Tree_Walk is
13971409
return Do_Attribute_Pred_Discrete (N);
13981410
when Attribute_Succ =>
13991411
return Do_Attribute_Succ_Discrete (N);
1412+
when Attribute_Address =>
1413+
return Do_Attribute_Address (N);
14001414
when others =>
14011415
return Report_Unhandled_Node_Irep (N, "Do_Expression",
14021416
"Unknown attribute");

0 commit comments

Comments
 (0)