| author | |
| committer | |
| log | 82be338964ed5bbc596a48075e52724fdf92cde4 |
| tree | 9536f08d24c56911d5a304b2d8e89930c841d659 |
| parent | 2651b5ccdf2485172e9ba0345b9529733ee39273 |
| signature |
3 files changed, 19 insertions(+), 13 deletions(-)
lib/compiler/aro/aro/InitList.zig+13-7| ... | ... | @@ -22,9 +22,15 @@ const Item = struct { |
| 22 | 22 | |
| 23 | 23 | const InitList = @This(); |
| 24 | 24 | |
| 25 | list: std.ArrayList(Item) = .empty, | |
| 26 | node: Node.OptIndex = .null, | |
| 27 | tok: TokenIndex = 0, | |
| 25 | list: std.ArrayList(Item), | |
| 26 | node: Node.OptIndex, | |
| 27 | tok: TokenIndex, | |
| 28 | ||
| 29 | pub const empty: InitList = .{ | |
| 30 | .list = .empty, | |
| 31 | .node = .null, | |
| 32 | .tok = 0, | |
| 33 | }; | |
| 28 | 34 | |
| 29 | 35 | /// Deinitialize freeing all memory. |
| 30 | 36 | pub fn deinit(il: *InitList, gpa: Allocator) void { |
| ... | ... | @@ -43,7 +49,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { |
| 43 | 49 | if (il.list.items.len == 0) { |
| 44 | 50 | const item = try il.list.addOne(gpa); |
| 45 | 51 | item.* = .{ |
| 46 | .list = .{}, | |
| 52 | .list = .empty, | |
| 47 | 53 | .index = index, |
| 48 | 54 | }; |
| 49 | 55 | return &item.list; |
| ... | ... | @@ -51,7 +57,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { |
| 51 | 57 | // Append a new value to the end of the list. |
| 52 | 58 | const new = try il.list.addOne(gpa); |
| 53 | 59 | new.* = .{ |
| 54 | .list = .{}, | |
| 60 | .list = .empty, | |
| 55 | 61 | .index = index, |
| 56 | 62 | }; |
| 57 | 63 | return &new.list; |
| ... | ... | @@ -70,7 +76,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { |
| 70 | 76 | |
| 71 | 77 | // Insert a new value into a sorted position. |
| 72 | 78 | try il.list.insert(gpa, left, .{ |
| 73 | .list = .{}, | |
| 79 | .list = .empty, | |
| 74 | 80 | .index = index, |
| 75 | 81 | }); |
| 76 | 82 | return &il.list.items[left].list; |
| ... | ... | @@ -78,7 +84,7 @@ pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { |
| 78 | 84 | |
| 79 | 85 | test "basic usage" { |
| 80 | 86 | const gpa = testing.allocator; |
| 81 | var il: InitList = .{}; | |
| 87 | var il: InitList = .empty; | |
| 82 | 88 | defer il.deinit(gpa); |
| 83 | 89 | |
| 84 | 90 | { |
lib/compiler/aro/aro/Parser.zig+3-3| ... | ... | @@ -3977,7 +3977,7 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result { |
| 3977 | 3977 | final_init_qt = .invalid; |
| 3978 | 3978 | } |
| 3979 | 3979 | |
| 3980 | var il: InitList = .{}; | |
| 3980 | var il: InitList = .empty; | |
| 3981 | 3981 | defer il.deinit(p.comp.gpa); |
| 3982 | 3982 | |
| 3983 | 3983 | try p.initializerItem(&il, final_init_qt, l_brace); |
| ... | ... | @@ -4028,12 +4028,12 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI |
| 4028 | 4028 | try p.err(first_tok, .initializer_overrides, .{}); |
| 4029 | 4029 | try p.err(item.il.tok, .previous_initializer, .{}); |
| 4030 | 4030 | item.il.deinit(gpa); |
| 4031 | item.il.* = .{}; | |
| 4031 | item.il.* = .empty; | |
| 4032 | 4032 | } |
| 4033 | 4033 | try p.initializerItem(item.il, item.qt, inner_l_brace); |
| 4034 | 4034 | } else { |
| 4035 | 4035 | // discard further values |
| 4036 | var tmp_il: InitList = .{}; | |
| 4036 | var tmp_il: InitList = .empty; | |
| 4037 | 4037 | defer tmp_il.deinit(gpa); |
| 4038 | 4038 | try p.initializerItem(&tmp_il, .invalid, inner_l_brace); |
| 4039 | 4039 | if (!warned_excess) try p.err(first_tok, switch (init_qt.base(p.comp).type) { |
lib/compiler/aro/aro/Toolchain.zig+3-3| ... | ... | @@ -43,13 +43,13 @@ const Toolchain = @This(); |
| 43 | 43 | driver: *Driver, |
| 44 | 44 | |
| 45 | 45 | /// The list of toolchain specific path prefixes to search for libraries. |
| 46 | library_paths: PathList = .{}, | |
| 46 | library_paths: PathList = .empty, | |
| 47 | 47 | |
| 48 | 48 | /// The list of toolchain specific path prefixes to search for files. |
| 49 | file_paths: PathList = .{}, | |
| 49 | file_paths: PathList = .empty, | |
| 50 | 50 | |
| 51 | 51 | /// The list of toolchain specific path prefixes to search for programs. |
| 52 | program_paths: PathList = .{}, | |
| 52 | program_paths: PathList = .empty, | |
| 53 | 53 | |
| 54 | 54 | selected_multilib: Multilib = .{}, |
| 55 | 55 |