Skip to content

Commit

Permalink
Add support for the Max_Alignment_For_Allocation attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
thvnx committed Aug 2, 2024
1 parent 17eb60a commit ba9d358
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ada/nodes.lkt
Original file line number Diff line number Diff line change
Expand Up @@ -12783,7 +12783,7 @@ class AttributeRef: Name {
# Attributes that simply return subprograms
elif rel_name in s"Succ" | s"Pred" | s"Min" | s"Max" | s"Ceiling" | s"Floor" | s"Rounding" | s"Unbiased_Rounding" | s"Leading_Part" | s"Truncation" | s"Exponent" | s"Fraction" | s"Copy_Sign" | s"Remainder" | s"Adjacent" | s"Machine" | s"Machine_Rounding" | s"Scaling" | s"Compose" | s"Mod" | s"Value" | s"Wide_Value" | s"Wide_Wide_Value" | s"Fixed_Value" | s"Integer_Value" | s"Pos" | s"Val" | s"Enum_Val" | s"Write" | s"Read" | s"Output" | s"Input" | s"Put_Image" | s"Asm_Input" | s"Asm_Output" | s"Model" | s"Round" then self.attribute_subprogram_equation()
elif rel_name in s"Size" | s"VADS_Size" then self.size_equation()
elif rel_name in s"Max_Size_In_Storage_Elements"
elif rel_name in s"Max_Size_In_Storage_Elements" | s"Max_Alignment_For_Allocation"
| s"Aft" | s"Object_Size" | s"Value_Size" | s"Storage_Size"
| s"Scale"
then self.subtype_attr_equation()
Expand Down
3 changes: 3 additions & 0 deletions testsuite/tests/name_resolution/size_attrs/test.adb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ begin
I := R'Max_Size_In_Storage_Elements;
pragma Test_Statement;

I := R'Max_Alignment_For_Allocation;
pragma Test_Statement;

I := R'VADS_Size;
pragma Test_Statement;

Expand Down
34 changes: 27 additions & 7 deletions testsuite/tests/name_resolution/size_attrs/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -101,42 +101,62 @@ Expr: <Id "Max_Size_In_Storage_Elements" test.adb:23:11-23:39>
type: None
expected type: None

Resolving xrefs for node <AssignStmt test.adb:26:4-26:21>
Resolving xrefs for node <AssignStmt test.adb:26:4-26:40>
*********************************************************

Expr: <Id "I" test.adb:26:4-26:5>
references: <DefiningName "I" test.adb:9:4-9:5>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
expected type: None
Expr: <AttributeRef test.adb:26:9-26:20>
Expr: <AttributeRef test.adb:26:9-26:39>
references: None
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "R" test.adb:26:9-26:10>
references: <DefiningName "R" test.adb:2:9-2:10>
type: None
expected type: None
Expr: <Id "VADS_Size" test.adb:26:11-26:20>
Expr: <Id "Max_Alignment_For_Allocation" test.adb:26:11-26:39>
references: None
type: None
expected type: None

Resolving xrefs for node <AssignStmt test.adb:29:4-29:31>
Resolving xrefs for node <AssignStmt test.adb:29:4-29:21>
*********************************************************

Expr: <Id "I" test.adb:29:4-29:5>
references: <DefiningName "I" test.adb:9:4-9:5>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
expected type: None
Expr: <AttributeRef test.adb:29:9-29:30>
Expr: <AttributeRef test.adb:29:9-29:20>
references: None
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "R_Access" test.adb:29:9-29:17>
Expr: <Id "R" test.adb:29:9-29:10>
references: <DefiningName "R" test.adb:2:9-2:10>
type: None
expected type: None
Expr: <Id "VADS_Size" test.adb:29:11-29:20>
references: None
type: None
expected type: None

Resolving xrefs for node <AssignStmt test.adb:32:4-32:31>
*********************************************************

Expr: <Id "I" test.adb:32:4-32:5>
references: <DefiningName "I" test.adb:9:4-9:5>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
expected type: None
Expr: <AttributeRef test.adb:32:9-32:30>
references: None
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "R_Access" test.adb:32:9-32:17>
references: <DefiningName "R_Access" test.adb:6:9-6:17>
type: None
expected type: None
Expr: <Id "Storage_Size" test.adb:29:18-29:30>
Expr: <Id "Storage_Size" test.adb:32:18-32:30>
references: None
type: None
expected type: None
Expand Down

0 comments on commit ba9d358

Please sign in to comment.