authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-21 15:05:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-09-24 20:01:19-07:00
log8cba6b1df813279735bf831018489a9e03788413
tree4e1e9d16bc6216dbfbd65b2d393f308157b93635
parent01132e0cf87a4e9ee5639b4b6b4b39606feab6a9

aro: update

This is f5fb720a5399ee98e45f36337b2f68a4d23a783c plus ehaas's nonnull attribute pull request currently at 4b26cb3ac610a0a070fc43e43da8b4cdf0e9101b with zig patches intact.

31 files changed, 1483 insertions(+), 1240 deletions(-)

lib/compiler/aro/aro/Attribute.zig+59-44
......@@ -345,6 +345,7 @@ fn diagnoseField(
345345
346346pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, arg_start: TokenIndex, node: Tree.Node, p: *Parser) !bool {
347347 switch (attr) {
348 .nonnull => return false,
348349 inline else => |tag| {
349350 const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
350351 const max_arg_count = comptime maxArgCount(tag);
......@@ -532,10 +533,7 @@ const attributes = struct {
532533 pub const @"noinline" = struct {};
533534 pub const noipa = struct {};
534535 // TODO: arbitrary number of arguments
535 // const nonnull = struct {
536 // // arg_index: []const u32,
537 // };
538 // };
536 pub const nonnull = struct {};
539537 pub const nonstring = struct {};
540538 pub const noplt = struct {};
541539 pub const @"noreturn" = struct {};
......@@ -802,8 +800,16 @@ fn ignoredAttrErr(p: *Parser, tok: TokenIndex, attr: Attribute.Tag, context: []c
802800 try p.errStr(.ignored_attribute, tok, str);
803801}
804802
805pub const applyParameterAttributes = applyVariableAttributes;
803pub fn applyParameterAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic) !QualType {
804 return applyVariableOrParameterAttributes(p, qt, attr_buf_start, diagnostic, .parameter);
805}
806
806807pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic) !QualType {
808 return applyVariableOrParameterAttributes(p, qt, attr_buf_start, diagnostic, .variable);
809}
810
811fn applyVariableOrParameterAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic, context: enum { parameter, variable }) !QualType {
812 const gpa = p.comp.gpa;
807813 const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
808814 const toks = p.attr_buf.items(.tok)[attr_buf_start..];
809815 p.attr_application_buf.items.len = 0;
......@@ -814,27 +820,33 @@ pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize,
814820 // zig fmt: off
815821 .alias, .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .weak, .used,
816822 .noinit, .retain, .persistent, .section, .mode, .asm_label, .nullability, .unaligned,
817 => try p.attr_application_buf.append(p.gpa, attr),
823 => try p.attr_application_buf.append(gpa, attr),
818824 // zig fmt: on
819825 .common => if (nocommon) {
820826 try p.err(tok, .ignore_common, .{});
821827 } else {
822 try p.attr_application_buf.append(p.gpa, attr);
828 try p.attr_application_buf.append(gpa, attr);
823829 common = true;
824830 },
825831 .nocommon => if (common) {
826832 try p.err(tok, .ignore_nocommon, .{});
827833 } else {
828 try p.attr_application_buf.append(p.gpa, attr);
834 try p.attr_application_buf.append(gpa, attr);
829835 nocommon = true;
830836 },
831837 .vector_size => try attr.applyVectorSize(p, tok, &base_qt),
832838 .aligned => try attr.applyAligned(p, base_qt, diagnostic),
839 .nonnull => {
840 switch (context) {
841 .parameter => try p.err(tok, .attribute_todo, .{ "nonnull", "parameters" }),
842 .variable => try p.err(tok, .nonnull_not_applicable, .{}),
843 }
844 },
833845 .nonstring => {
834846 if (base_qt.get(p.comp, .array)) |array_ty| {
835847 if (array_ty.elem.get(p.comp, .int)) |int_ty| switch (int_ty) {
836848 .char, .uchar, .schar => {
837 try p.attr_application_buf.append(p.gpa, attr);
849 try p.attr_application_buf.append(gpa, attr);
838850 continue;
839851 },
840852 else => {},
......@@ -845,12 +857,12 @@ pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize,
845857 .uninitialized => if (p.func.qt == null) {
846858 try p.err(tok, .local_variable_attribute, .{"uninitialized"});
847859 } else {
848 try p.attr_application_buf.append(p.gpa, attr);
860 try p.attr_application_buf.append(gpa, attr);
849861 },
850862 .cleanup => if (p.func.qt == null) {
851863 try p.err(tok, .local_variable_attribute, .{"cleanup"});
852864 } else {
853 try p.attr_application_buf.append(p.gpa, attr);
865 try p.attr_application_buf.append(gpa, attr);
854866 },
855867 .calling_convention => try applyCallingConvention(attr, p, tok, base_qt),
856868 .alloc_size,
......@@ -873,7 +885,7 @@ pub fn applyFieldAttributes(p: *Parser, field_qt: *QualType, attr_buf_start: usi
873885 // zig fmt: off
874886 .@"packed", .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned,
875887 .mode, .warn_unused_result, .nodiscard, .nullability, .unaligned,
876 => try p.attr_application_buf.append(p.gpa, attr),
888 => try p.attr_application_buf.append(p.comp.gpa, attr),
877889 // zig fmt: on
878890 .vector_size => try attr.applyVectorSize(p, tok, field_qt),
879891 .aligned => try attr.applyAligned(p, field_qt.*, null),
......@@ -884,6 +896,7 @@ pub fn applyFieldAttributes(p: *Parser, field_qt: *QualType, attr_buf_start: usi
884896}
885897
886898pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic) !QualType {
899 const gpa = p.comp.gpa;
887900 const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
888901 const toks = p.attr_buf.items(.tok)[attr_buf_start..];
889902 p.attr_application_buf.items.len = 0;
......@@ -891,13 +904,13 @@ pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diag
891904 for (attrs, toks) |attr, tok| switch (attr.tag) {
892905 // zig fmt: off
893906 .@"packed", .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .mode, .nullability, .unaligned,
894 => try p.attr_application_buf.append(p.gpa, attr),
907 => try p.attr_application_buf.append(gpa, attr),
895908 // zig fmt: on
896909 .transparent_union => try attr.applyTransparentUnion(p, tok, base_qt),
897910 .vector_size => try attr.applyVectorSize(p, tok, &base_qt),
898911 .aligned => try attr.applyAligned(p, base_qt, diagnostic),
899912 .designated_init => if (base_qt.is(p.comp, .@"struct")) {
900 try p.attr_application_buf.append(p.gpa, attr);
913 try p.attr_application_buf.append(gpa, attr);
901914 } else {
902915 try p.err(tok, .designated_init_invalid, .{});
903916 },
......@@ -913,6 +926,7 @@ pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diag
913926}
914927
915928pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) !QualType {
929 const gpa = p.comp.gpa;
916930 const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
917931 const toks = p.attr_buf.items(.tok)[attr_buf_start..];
918932 p.attr_application_buf.items.len = 0;
......@@ -927,37 +941,37 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
927941 .@"const", .warn_unused_result, .section, .returns_nonnull, .returns_twice, .@"error",
928942 .externally_visible, .retain, .flatten, .gnu_inline, .alias, .asm_label, .nodiscard,
929943 .reproducible, .unsequenced, .nothrow, .nullability, .unaligned,
930 => try p.attr_application_buf.append(p.gpa, attr),
944 => try p.attr_application_buf.append(gpa, attr),
931945 // zig fmt: on
932946 .hot => if (cold) {
933947 try p.err(tok, .ignore_hot, .{});
934948 } else {
935 try p.attr_application_buf.append(p.gpa, attr);
949 try p.attr_application_buf.append(gpa, attr);
936950 hot = true;
937951 },
938952 .cold => if (hot) {
939953 try p.err(tok, .ignore_cold, .{});
940954 } else {
941 try p.attr_application_buf.append(p.gpa, attr);
955 try p.attr_application_buf.append(gpa, attr);
942956 cold = true;
943957 },
944958 .always_inline => if (@"noinline") {
945959 try p.err(tok, .ignore_always_inline, .{});
946960 } else {
947 try p.attr_application_buf.append(p.gpa, attr);
961 try p.attr_application_buf.append(gpa, attr);
948962 always_inline = true;
949963 },
950964 .@"noinline" => if (always_inline) {
951965 try p.err(tok, .ignore_noinline, .{});
952966 } else {
953 try p.attr_application_buf.append(p.gpa, attr);
967 try p.attr_application_buf.append(gpa, attr);
954968 @"noinline" = true;
955969 },
956970 .aligned => try attr.applyAligned(p, base_qt, null),
957971 .format => try attr.applyFormat(p, base_qt),
958972 .calling_convention => try applyCallingConvention(attr, p, tok, base_qt),
959973 .fastcall => if (p.comp.target.cpu.arch == .x86) {
960 try p.attr_application_buf.append(p.gpa, .{
974 try p.attr_application_buf.append(gpa, .{
961975 .tag = .calling_convention,
962976 .args = .{ .calling_convention = .{ .cc = .fastcall } },
963977 .syntax = attr.syntax,
......@@ -966,7 +980,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
966980 try p.err(tok, .callconv_not_supported, .{"fastcall"});
967981 },
968982 .stdcall => if (p.comp.target.cpu.arch == .x86) {
969 try p.attr_application_buf.append(p.gpa, .{
983 try p.attr_application_buf.append(gpa, .{
970984 .tag = .calling_convention,
971985 .args = .{ .calling_convention = .{ .cc = .stdcall } },
972986 .syntax = attr.syntax,
......@@ -975,7 +989,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
975989 try p.err(tok, .callconv_not_supported, .{"stdcall"});
976990 },
977991 .thiscall => if (p.comp.target.cpu.arch == .x86) {
978 try p.attr_application_buf.append(p.gpa, .{
992 try p.attr_application_buf.append(gpa, .{
979993 .tag = .calling_convention,
980994 .args = .{ .calling_convention = .{ .cc = .thiscall } },
981995 .syntax = attr.syntax,
......@@ -984,7 +998,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
984998 try p.err(tok, .callconv_not_supported, .{"thiscall"});
985999 },
9861000 .vectorcall => if (p.comp.target.cpu.arch == .x86 or p.comp.target.cpu.arch.isAARCH64()) {
987 try p.attr_application_buf.append(p.gpa, .{
1001 try p.attr_application_buf.append(gpa, .{
9881002 .tag = .calling_convention,
9891003 .args = .{ .calling_convention = .{ .cc = .vectorcall } },
9901004 .syntax = attr.syntax,
......@@ -994,7 +1008,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
9941008 },
9951009 .cdecl => {},
9961010 .pcs => if (p.comp.target.cpu.arch.isArm()) {
997 try p.attr_application_buf.append(p.gpa, .{
1011 try p.attr_application_buf.append(gpa, .{
9981012 .tag = .calling_convention,
9991013 .args = .{ .calling_convention = .{ .cc = switch (attr.args.pcs.kind) {
10001014 .aapcs => .arm_aapcs,
......@@ -1006,7 +1020,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
10061020 try p.err(tok, .callconv_not_supported, .{"pcs"});
10071021 },
10081022 .riscv_vector_cc => if (p.comp.target.cpu.arch.isRISCV()) {
1009 try p.attr_application_buf.append(p.gpa, .{
1023 try p.attr_application_buf.append(gpa, .{
10101024 .tag = .calling_convention,
10111025 .args = .{ .calling_convention = .{ .cc = .riscv_vector } },
10121026 .syntax = attr.syntax,
......@@ -1015,7 +1029,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
10151029 try p.err(tok, .callconv_not_supported, .{"pcs"});
10161030 },
10171031 .aarch64_sve_pcs => if (p.comp.target.cpu.arch.isAARCH64()) {
1018 try p.attr_application_buf.append(p.gpa, .{
1032 try p.attr_application_buf.append(gpa, .{
10191033 .tag = .calling_convention,
10201034 .args = .{ .calling_convention = .{ .cc = .aarch64_sve_pcs } },
10211035 .syntax = attr.syntax,
......@@ -1024,7 +1038,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
10241038 try p.err(tok, .callconv_not_supported, .{"pcs"});
10251039 },
10261040 .aarch64_vector_pcs => if (p.comp.target.cpu.arch.isAARCH64()) {
1027 try p.attr_application_buf.append(p.gpa, .{
1041 try p.attr_application_buf.append(gpa, .{
10281042 .tag = .calling_convention,
10291043 .args = .{ .calling_convention = .{ .cc = .aarch64_vector_pcs } },
10301044 .syntax = attr.syntax,
......@@ -1033,14 +1047,14 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
10331047 try p.err(tok, .callconv_not_supported, .{"pcs"});
10341048 },
10351049 .sysv_abi => if (p.comp.target.cpu.arch == .x86_64 and p.comp.target.os.tag == .windows) {
1036 try p.attr_application_buf.append(p.gpa, .{
1050 try p.attr_application_buf.append(gpa, .{
10371051 .tag = .calling_convention,
10381052 .args = .{ .calling_convention = .{ .cc = .x86_64_sysv } },
10391053 .syntax = attr.syntax,
10401054 });
10411055 },
10421056 .ms_abi => if (p.comp.target.cpu.arch == .x86_64 and p.comp.target.os.tag != .windows) {
1043 try p.attr_application_buf.append(p.gpa, .{
1057 try p.attr_application_buf.append(gpa, .{
10441058 .tag = .calling_convention,
10451059 .args = .{ .calling_convention = .{ .cc = .x86_64_win } },
10461060 .syntax = attr.syntax,
......@@ -1048,7 +1062,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
10481062 },
10491063 .malloc => {
10501064 if (base_qt.get(p.comp, .func).?.return_type.isPointer(p.comp)) {
1051 try p.attr_application_buf.append(p.gpa, attr);
1065 try p.attr_application_buf.append(gpa, attr);
10521066 } else {
10531067 try ignoredAttrErr(p, tok, attr.tag, "functions that do not return pointers");
10541068 }
......@@ -1065,7 +1079,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
10651079 if (!arg_sk.isInt() or !arg_sk.isReal()) {
10661080 try p.err(tok, .alloc_align_required_int_param, .{});
10671081 } else {
1068 try p.attr_application_buf.append(p.gpa, attr);
1082 try p.attr_application_buf.append(gpa, attr);
10691083 }
10701084 }
10711085 } else {
......@@ -1098,7 +1112,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
10981112 .no_stack_protector,
10991113 .noclone,
11001114 .noipa,
1101 // .nonnull,
1115 .nonnull,
11021116 .noplt,
11031117 // .optimize,
11041118 .patchable_function_entry,
......@@ -1118,23 +1132,24 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
11181132}
11191133
11201134pub fn applyLabelAttributes(p: *Parser, attr_buf_start: usize) !QualType {
1135 const gpa = p.comp.gpa;
11211136 const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
11221137 const toks = p.attr_buf.items(.tok)[attr_buf_start..];
11231138 p.attr_application_buf.items.len = 0;
11241139 var hot = false;
11251140 var cold = false;
11261141 for (attrs, toks) |attr, tok| switch (attr.tag) {
1127 .unused => try p.attr_application_buf.append(p.gpa, attr),
1142 .unused => try p.attr_application_buf.append(gpa, attr),
11281143 .hot => if (cold) {
11291144 try p.err(tok, .ignore_hot, .{});
11301145 } else {
1131 try p.attr_application_buf.append(p.gpa, attr);
1146 try p.attr_application_buf.append(gpa, attr);
11321147 hot = true;
11331148 },
11341149 .cold => if (hot) {
11351150 try p.err(tok, .ignore_cold, .{});
11361151 } else {
1137 try p.attr_application_buf.append(p.gpa, attr);
1152 try p.attr_application_buf.append(gpa, attr);
11381153 cold = true;
11391154 },
11401155 else => try ignoredAttrErr(p, tok, attr.tag, "labels"),
......@@ -1151,7 +1166,7 @@ pub fn applyStatementAttributes(p: *Parser, expr_start: TokenIndex, attr_buf_sta
11511166 for (p.tok_ids[p.tok_i..]) |tok_id| {
11521167 switch (tok_id) {
11531168 .keyword_case, .keyword_default, .eof => {
1154 try p.attr_application_buf.append(p.gpa, attr);
1169 try p.attr_application_buf.append(p.comp.gpa, attr);
11551170 break;
11561171 },
11571172 .r_brace => {},
......@@ -1172,7 +1187,7 @@ pub fn applyEnumeratorAttributes(p: *Parser, qt: QualType, attr_buf_start: usize
11721187 const toks = p.attr_buf.items(.tok)[attr_buf_start..];
11731188 p.attr_application_buf.items.len = 0;
11741189 for (attrs, toks) |attr, tok| switch (attr.tag) {
1175 .deprecated, .unavailable => try p.attr_application_buf.append(p.gpa, attr),
1190 .deprecated, .unavailable => try p.attr_application_buf.append(p.comp.gpa, attr),
11761191 else => try ignoredAttrErr(p, tok, attr.tag, "enums"),
11771192 };
11781193 return applySelected(qt, p);
......@@ -1193,7 +1208,7 @@ fn applyAligned(attr: Attribute, p: *Parser, qt: QualType, diagnostic: ?Parser.D
11931208 try p.err(align_tok, .minimum_alignment, .{default_align});
11941209 }
11951210 }
1196 try p.attr_application_buf.append(p.gpa, attr);
1211 try p.attr_application_buf.append(p.comp.gpa, attr);
11971212}
11981213
11991214fn applyTransparentUnion(attr: Attribute, p: *Parser, tok: TokenIndex, qt: QualType) !void {
......@@ -1214,7 +1229,7 @@ fn applyTransparentUnion(attr: Attribute, p: *Parser, tok: TokenIndex, qt: QualT
12141229 return p.err(union_ty.fields[0].name_tok, .transparent_union_size_note, .{first_field_size});
12151230 }
12161231
1217 try p.attr_application_buf.append(p.gpa, attr);
1232 try p.attr_application_buf.append(p.comp.gpa, attr);
12181233}
12191234
12201235fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, qt: *QualType) !void {
......@@ -1245,7 +1260,7 @@ fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, qt: *QualType)
12451260 return p.err(tok, .vec_size_not_multiple, .{});
12461261 }
12471262
1248 qt.* = try p.comp.type_store.put(p.gpa, .{ .vector = .{
1263 qt.* = try p.comp.type_store.put(p.comp.gpa, .{ .vector = .{
12491264 .elem = qt.*,
12501265 .len = @intCast(vec_bytes / elem_size),
12511266 } });
......@@ -1254,7 +1269,7 @@ fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, qt: *QualType)
12541269fn applyFormat(attr: Attribute, p: *Parser, qt: QualType) !void {
12551270 // TODO validate
12561271 _ = qt;
1257 try p.attr_application_buf.append(p.gpa, attr);
1272 try p.attr_application_buf.append(p.comp.gpa, attr);
12581273}
12591274
12601275fn applyCallingConvention(attr: Attribute, p: *Parser, tok: TokenIndex, qt: QualType) !void {
......@@ -1264,11 +1279,11 @@ fn applyCallingConvention(attr: Attribute, p: *Parser, tok: TokenIndex, qt: Qual
12641279 switch (attr.args.calling_convention.cc) {
12651280 .c => {},
12661281 .stdcall, .thiscall, .fastcall, .regcall => switch (p.comp.target.cpu.arch) {
1267 .x86 => try p.attr_application_buf.append(p.gpa, attr),
1282 .x86 => try p.attr_application_buf.append(p.comp.gpa, attr),
12681283 else => try p.err(tok, .callconv_not_supported, .{p.tok_ids[tok].symbol()}),
12691284 },
12701285 .vectorcall => switch (p.comp.target.cpu.arch) {
1271 .x86, .aarch64, .aarch64_be => try p.attr_application_buf.append(p.gpa, attr),
1286 .x86, .aarch64, .aarch64_be => try p.attr_application_buf.append(p.comp.gpa, attr),
12721287 else => try p.err(tok, .callconv_not_supported, .{p.tok_ids[tok].symbol()}),
12731288 },
12741289 .riscv_vector,
......@@ -1285,7 +1300,7 @@ fn applyCallingConvention(attr: Attribute, p: *Parser, tok: TokenIndex, qt: Qual
12851300fn applySelected(qt: QualType, p: *Parser) !QualType {
12861301 if (p.attr_application_buf.items.len == 0) return qt;
12871302 if (qt.isInvalid()) return qt;
1288 return (try p.comp.type_store.put(p.gpa, .{ .attributed = .{
1303 return (try p.comp.type_store.put(p.comp.gpa, .{ .attributed = .{
12891304 .base = qt,
12901305 .attributes = p.attr_application_buf.items,
12911306 } })).withQualifiers(qt);
lib/compiler/aro/aro/Attribute/names.zig+498-495
......@@ -78,6 +78,7 @@ pub const Tag = enum(u16) { aarch64_sve_pcs,
7878 noinit,
7979 @"noinline",
8080 noipa,
81 nonnull,
8182 nonstring,
8283 noplt,
8384 @"noreturn",
......@@ -184,7 +185,7 @@ pub const longest_name = 30;
184185/// If found, returns the index of the node within the `dafsa` array.
185186/// Otherwise, returns `null`.
186187pub fn findInList(first_child_index: u16, char: u8) ?u16 {
187 @setEvalBranchQuota(230);
188 @setEvalBranchQuota(232);
188189 var index = first_child_index;
189190 while (true) {
190191 if (dafsa[index].char == char) return index;
......@@ -290,7 +291,7 @@ const dafsa = [_]Node{
290291 .{ .char = 'j', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 41 },
291292 .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 42 },
292293 .{ .char = 'm', .end_of_word = false, .end_of_list = false, .number = 5, .child_index = 43 },
293 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 25, .child_index = 46 },
294 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 26, .child_index = 46 },
294295 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 6, .child_index = 48 },
295296 .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 6, .child_index = 53 },
296297 .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 11, .child_index = 55 },
......@@ -325,7 +326,7 @@ const dafsa = [_]Node{
325326 .{ .char = 'o', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 106 },
326327 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 107 },
327328 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 108 },
328 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 24, .child_index = 109 },
329 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 25, .child_index = 109 },
329330 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 118 },
330331 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 120 },
331332 .{ .char = 'e', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 121 },
......@@ -392,574 +393,575 @@ const dafsa = [_]Node{
392393 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 198 },
393394 .{ .char = 'd', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 200 },
394395 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 3, .child_index = 201 },
395 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 203 },
396 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 204 },
397 .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 205 },
398 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 206 },
399 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 108 },
396 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 203 },
397 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 205 },
398 .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 206 },
400399 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 207 },
400 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 108 },
401 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 208 },
401402 .{ .char = 's', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
402 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 208 },
403 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 209 },
403404 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 75 },
404405 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
405 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 209 },
406 .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 210 },
407 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 211 },
408 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 213 },
409 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 214 },
410 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 215 },
411 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 216 },
412 .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 217 },
413 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 218 },
406 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 210 },
407 .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 211 },
408 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 212 },
409 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 214 },
410 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 215 },
411 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 216 },
412 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 217 },
413 .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 218 },
414 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 219 },
414415 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
415 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 219 },
416 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 220 },
417 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 221 },
418 .{ .char = 'm', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 222 },
419 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 223 },
420 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 224 },
421 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 225 },
422 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 226 },
423 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 227 },
424 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 228 },
425 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 229 },
426 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 230 },
427 .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 231 },
428 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 232 },
416 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 220 },
417 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 221 },
418 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 222 },
419 .{ .char = 'm', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 223 },
420 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 224 },
421 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 225 },
422 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 226 },
423 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 227 },
424 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 228 },
425 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 229 },
426 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 230 },
427 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 231 },
428 .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 232 },
429 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 233 },
429430 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
430431 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
431 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 233 },
432 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 234 },
433 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 235 },
434 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 236 },
435 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 237 },
436 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 238 },
437 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 239 },
432 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 234 },
433 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 235 },
434 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 236 },
435 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 237 },
436 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 238 },
437 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 239 },
438 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 240 },
438439 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 120 },
439 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 240 },
440 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 241 },
441 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 242 },
442 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 243 },
443 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 244 },
444 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 245 },
445 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
446 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
447 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 248 },
440 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 241 },
441 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 242 },
442 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 243 },
443 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 244 },
444 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 245 },
445 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
446 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
447 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 248 },
448 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 249 },
448449 .{ .char = 'd', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
449 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 249 },
450 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 250 },
450 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 250 },
451 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 251 },
451452 .{ .char = 'y', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
452 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 251 },
453 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 252 },
454 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 253 },
455 .{ .char = 'e', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 254 },
456 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 255 },
457 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
458 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
459 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 258 },
460 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 221 },
461 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 259 },
462 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 260 },
463 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 261 },
464 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
465 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 263 },
466 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 264 },
453 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 252 },
454 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 253 },
455 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 254 },
456 .{ .char = 'e', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 255 },
457 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
458 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
459 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 258 },
460 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 259 },
461 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 222 },
462 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 260 },
463 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 261 },
464 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
465 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
466 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 264 },
467 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 265 },
467468 .{ .char = 'f', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
468 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 265 },
469 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 266 },
470 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 267 },
469 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 266 },
470 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 267 },
471 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 268 },
471472 .{ .char = 'e', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
472 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 268 },
473 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 269 },
474 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 270 },
475 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 272 },
476 .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 273 },
477 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 8, .child_index = 274 },
478 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 277 },
479 .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 278 },
480 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 279 },
481 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 280 },
482 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 281 },
483 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 283 },
484 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 284 },
473 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 269 },
474 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 270 },
475 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 271 },
476 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 273 },
477 .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 274 },
478 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 8, .child_index = 275 },
479 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 278 },
480 .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 279 },
481 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 280 },
482 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 281 },
483 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 282 },
484 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 284 },
485 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 285 },
486 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 286 },
485487 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
486 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 285 },
487 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 286 },
488 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 287 },
489 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 288 },
490 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 289 },
491 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 290 },
492 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 291 },
493 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 292 },
494 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 293 },
495 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 294 },
496 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 295 },
497 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 296 },
498 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 297 },
488 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 287 },
489 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 288 },
490 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 289 },
491 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 290 },
492 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 291 },
493 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 292 },
494 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 293 },
495 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 294 },
496 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 295 },
497 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 296 },
498 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 297 },
499499 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 298 },
500 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 299 },
501 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 300 },
500 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 299 },
501 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 300 },
502502 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 301 },
503 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
503 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
504 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 303 },
505 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
504506 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 107 },
505 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 303 },
506 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 221 },
507 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
508 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 305 },
509 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 306 },
510 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 307 },
507 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 305 },
508 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 222 },
509 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 306 },
510 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 307 },
511511 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 308 },
512 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 309 },
512 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 309 },
513 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 310 },
514 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 311 },
513515 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
514 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 310 },
515 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 311 },
516 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 312 },
517 .{ .char = 'k', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 314 },
518 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 315 },
519 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 316 },
516 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 312 },
517 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 313 },
518 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 314 },
519 .{ .char = 'k', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 316 },
520 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 317 },
521 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 318 },
520522 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
521 .{ .char = 'n', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 317 },
522 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 318 },
523 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 320 },
524 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 321 },
525 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 322 },
526 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 323 },
523 .{ .char = 'n', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 319 },
524 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 320 },
525 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 322 },
526 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 323 },
527 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 324 },
528 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 325 },
527529 .{ .char = 'l', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
528 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 324 },
529 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 325 },
530 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
531 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 327 },
532 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
533 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 329 },
534 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 330 },
535 .{ .char = 'x', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 331 },
536 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 331 },
537 .{ .char = 'r', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
530 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
531 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 327 },
532 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
533 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 329 },
534 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 330 },
535 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 331 },
538536 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 332 },
539 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 333 },
540 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 334 },
541 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 335 },
542 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 336 },
537 .{ .char = 'x', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 333 },
538 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 333 },
539 .{ .char = 'r', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
540 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 334 },
541 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 335 },
542 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 336 },
543 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 337 },
544 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 338 },
543545 .{ .char = 'c', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
544 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 337 },
545 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 338 },
546 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
546 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 339 },
547 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 340 },
548 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
547549 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 197 },
548 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 339 },
549 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 340 },
550 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 341 },
550 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 341 },
551 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 342 },
552 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 343 },
551553 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 186 },
552 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 342 },
553 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 343 },
554 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
555 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 5, .child_index = 345 },
556 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 346 },
557 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 347 },
558 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 348 },
559 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 349 },
554 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
555 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 345 },
556 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 346 },
557 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 5, .child_index = 347 },
558 .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 348 },
559 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 349 },
560 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 350 },
561 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
560562 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 168 },
561 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 350 },
563 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 352 },
562564 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 99 },
563 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
565 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 353 },
564566 .{ .char = 'a', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
565 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 352 },
566 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 353 },
567 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 354 },
568 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 355 },
569 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 356 },
570 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 357 },
571 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 358 },
572 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
573 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 359 },
574 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 360 },
575 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 361 },
576 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 362 },
577 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 249 },
578 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 363 },
579 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 364 },
567 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 354 },
568 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 355 },
569 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 356 },
570 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 357 },
571 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 358 },
572 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 359 },
573 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 360 },
574 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 361 },
575 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
576 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 362 },
577 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 363 },
578 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 364 },
579 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 365 },
580 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 250 },
581 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 366 },
582 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 367 },
580583 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 123 },
581 .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 365 },
582 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 366 },
583 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
584 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 367 },
584 .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 368 },
585 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 354 },
586 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
587 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 369 },
585588 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
586 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 368 },
587 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 369 },
588 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 370 },
589 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 371 },
590 .{ .char = 'q', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 372 },
591 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 373 },
592 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 374 },
593 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 375 },
594 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 377 },
595 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 378 },
596 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 379 },
597 .{ .char = '6', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 380 },
589 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 370 },
590 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 371 },
591 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 372 },
592 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 373 },
593 .{ .char = 'q', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 374 },
594 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 375 },
595 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 376 },
596 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 377 },
597 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 379 },
598 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 380 },
599 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 381 },
600 .{ .char = '6', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 382 },
598601 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
599 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 381 },
600 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 383 },
602 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 383 },
603 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 385 },
601604 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 182 },
602 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 384 },
603 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 385 },
604 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 386 },
605 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 387 },
606 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 388 },
605 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 386 },
606 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 387 },
607 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 388 },
608 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 389 },
609 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 390 },
607610 .{ .char = 'n', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
608 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 330 },
609 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 389 },
610 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 390 },
611 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 391 },
612 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 392 },
613 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 393 },
614 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 394 },
615 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
616 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 395 },
617 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 396 },
618 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 397 },
619 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 398 },
620 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 399 },
611 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 332 },
612 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 391 },
613 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 392 },
614 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 393 },
615 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 394 },
616 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 395 },
617 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 396 },
618 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
619 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 397 },
620 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 398 },
621 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 399 },
622 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 400 },
623 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 401 },
621624 .{ .char = 'i', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
622 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 400 },
623 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 401 },
624 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 402 },
625 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 403 },
626 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 404 },
627 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 405 },
628 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 406 },
625 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 402 },
626 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 403 },
627 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 404 },
628 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 405 },
629 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 406 },
630 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 407 },
631 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 408 },
629632 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
630633 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
631 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 407 },
632 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 349 },
633 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 408 },
634 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 409 },
635 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 410 },
636 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 411 },
637 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 412 },
638 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 413 },
639 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 414 },
640 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 415 },
641 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 416 },
642 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 417 },
643 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 418 },
644 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 419 },
645 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 420 },
646 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 421 },
647 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
648 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 422 },
649 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 423 },
650 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 424 },
651 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 425 },
652 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 426 },
653 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 427 },
654 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 428 },
655 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 430 },
656 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 431 },
657 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 432 },
658 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 433 },
634 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 409 },
635 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
636 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
637 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 410 },
638 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 411 },
639 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 412 },
640 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 413 },
641 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 414 },
642 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 415 },
643 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 416 },
644 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 417 },
645 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 418 },
646 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 419 },
647 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 420 },
648 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 421 },
649 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 422 },
650 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 423 },
651 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 424 },
652 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 425 },
653 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 426 },
654 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 427 },
655 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 428 },
656 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 429 },
657 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 430 },
658 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 432 },
659 .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 433 },
660 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 434 },
661 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 435 },
659662 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 186 },
660 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 434 },
661 .{ .char = '4', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 435 },
662 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 436 },
663 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 437 },
664 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 438 },
665 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 291 },
666 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 440 },
667 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 441 },
663 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 436 },
664 .{ .char = '4', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 437 },
665 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 438 },
666 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 439 },
667 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 440 },
668 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 293 },
669 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 442 },
670 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 443 },
668671 .{ .char = 'p', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
669 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 433 },
670 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 442 },
671 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 443 },
672 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 444 },
673 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 445 },
674 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 446 },
675 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 447 },
676 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 448 },
677 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
678 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 449 },
679 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 450 },
680 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 451 },
672 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 435 },
673 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 444 },
674 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 445 },
675 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 446 },
676 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 447 },
677 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 448 },
678 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 449 },
679 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 450 },
680 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 353 },
681 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 451 },
681682 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 452 },
682 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 453 },
683 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 454 },
684 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 455 },
685 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 456 },
686 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 457 },
687 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 458 },
688 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 459 },
689 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 377 },
690 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
683 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 453 },
684 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 454 },
685 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 455 },
686 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 456 },
687 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 457 },
688 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 458 },
689 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 459 },
690 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 460 },
691 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 461 },
692 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 379 },
693 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
691694 .{ .char = 'w', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
692 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 460 },
693 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 461 },
694 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 462 },
695 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 462 },
696 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 463 },
697 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 464 },
695698 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
696 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 463 },
697 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 464 },
698 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 465 },
699 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 466 },
700 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 467 },
701 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
702 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 468 },
703 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 469 },
704 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 420 },
705 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 470 },
706 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 471 },
707 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 472 },
708 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 473 },
709 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 474 },
710 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 301 },
711 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 475 },
712 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 476 },
713 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 477 },
699 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 465 },
700 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 466 },
701 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 467 },
702 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 468 },
703 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 469 },
704 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
705 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 470 },
706 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 471 },
707 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 422 },
708 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 472 },
709 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 473 },
710 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 474 },
711 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 475 },
712 .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 476 },
713 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 303 },
714 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 477 },
715 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 478 },
716 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 479 },
714717 .{ .char = 'g', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
715 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 478 },
716 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 479 },
717 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 481 },
718 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 482 },
718 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 480 },
719 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 481 },
720 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 483 },
721 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 484 },
719722 .{ .char = 'e', .end_of_word = true, .end_of_list = false, .number = 1, .child_index = 0 },
720 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
721 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 483 },
722 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 484 },
723 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
724 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 485 },
725 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 486 },
723726 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
724 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 485 },
727 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 487 },
725728 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 176 },
726729 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
727 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 486 },
728 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 487 },
729 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 488 },
730 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 489 },
731 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 490 },
732 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 491 },
733 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 492 },
734 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 493 },
735 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 494 },
736 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
737 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 495 },
738 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 496 },
739 .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 497 },
730 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 488 },
731 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 489 },
732 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 490 },
733 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 491 },
734 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 492 },
735 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 493 },
736 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 494 },
737 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 495 },
738 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 496 },
739 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
740 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 497 },
741 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 498 },
742 .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 499 },
740743 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
741 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 498 },
742 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 499 },
743 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 500 },
744 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 501 },
745 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 503 },
746 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 504 },
747 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 505 },
744 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 500 },
745 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 501 },
746 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 502 },
747 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 503 },
748 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 505 },
749 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 506 },
750 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 507 },
748751 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 170 },
749 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 506 },
750 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 507 },
751752 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 508 },
752 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 509 },
753 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 510 },
754 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 511 },
755 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 437 },
756 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 512 },
757 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 513 },
758 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 514 },
759 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 515 },
760 .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 516 },
761 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 517 },
762 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 518 },
753 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 509 },
754 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 510 },
755 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 511 },
756 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 512 },
757 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 513 },
758 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 439 },
759 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 514 },
760 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 515 },
761 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 516 },
762 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 517 },
763 .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 518 },
764 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 519 },
765 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 520 },
763766 .{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
764 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
765 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 519 },
766 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 520 },
767 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
767768 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 521 },
768 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 522 },
769 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 433 },
770 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 523 },
771 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 524 },
772 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 232 },
773 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 525 },
774 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 526 },
775 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 527 },
776 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 528 },
777 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 529 },
778 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 530 },
779 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 532 },
769 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 522 },
770 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 523 },
771 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 524 },
772 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 435 },
773 .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 525 },
774 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 526 },
775 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 233 },
776 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 527 },
777 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 528 },
778 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 529 },
779 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 530 },
780 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 531 },
781 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 532 },
782 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 534 },
780783 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
781 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 509 },
782 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 533 },
783 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 534 },
784 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 535 },
785 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 536 },
786 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 537 },
787 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 538 },
788 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 539 },
789 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 540 },
790 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 541 },
791 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 542 },
784 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 511 },
785 .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 535 },
786 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 536 },
787 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 537 },
788 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 538 },
789 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 539 },
790 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 540 },
791 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 541 },
792 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 542 },
793 .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 543 },
794 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 544 },
792795 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
793796 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 170 },
794 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 543 },
795 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 544 },
796 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 545 },
797 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 546 },
798 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 547 },
799 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
800 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 548 },
801 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 549 },
802 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 550 },
803 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 551 },
804 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 552 },
805 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 553 },
806 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 554 },
807 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 555 },
808 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 556 },
809 .{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 557 },
810 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 558 },
811 .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 559 },
812 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 560 },
813 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 561 },
814 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 562 },
815 .{ .char = 'w', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 563 },
816 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 564 },
817 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
818 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 565 },
797 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 545 },
798 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 546 },
799 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 547 },
800 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 548 },
801 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 549 },
802 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
803 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 550 },
804 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 551 },
805 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 552 },
806 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 553 },
807 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 554 },
808 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 555 },
809 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 556 },
810 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 557 },
811 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 558 },
812 .{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 559 },
813 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 560 },
814 .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 561 },
815 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 562 },
816 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 563 },
817 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 564 },
818 .{ .char = 'w', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 565 },
819819 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 566 },
820 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
820821 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 567 },
821 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 568 },
822 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 568 },
823 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 569 },
824 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 570 },
822825 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
823 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 569 },
824 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 570 },
825 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 571 },
826 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 572 },
826 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 571 },
827 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 572 },
827828 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 573 },
828 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 574 },
829 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
830 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 576 },
831 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 577 },
832 .{ .char = 'h', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
833 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 578 },
834 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
829 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 574 },
830 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
831 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 576 },
832 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 577 },
833 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 578 },
835834 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 579 },
836 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 580 },
835 .{ .char = 'h', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
836 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 580 },
837 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
837838 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 581 },
838 .{ .char = 'e', .end_of_word = true, .end_of_list = true, .number = 5, .child_index = 582 },
839 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 583 },
840 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 584 },
841 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 585 },
842 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 586 },
843 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 587 },
844 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 588 },
845 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 589 },
846 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 590 },
847 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 414 },
848 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 591 },
849 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 592 },
839 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 582 },
840 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 583 },
841 .{ .char = 'e', .end_of_word = true, .end_of_list = true, .number = 5, .child_index = 584 },
842 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 585 },
843 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 586 },
844 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 587 },
845 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 588 },
846 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 589 },
847 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 590 },
848 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 591 },
849 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 592 },
850 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 416 },
851 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 593 },
852 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 594 },
850853 .{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
851 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 386 },
852 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 593 },
853 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 594 },
854 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 595 },
855 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 596 },
854 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 388 },
855 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 595 },
856 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 596 },
857 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 597 },
858 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 598 },
856859 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
857 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 597 },
858 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 598 },
859 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 599 },
860 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 600 },
861 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 601 },
862 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 602 },
863 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 603 },
864 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 607 },
865 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 608 },
866 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 609 },
867 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 610 },
868 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 611 },
860 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 599 },
861 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 600 },
862 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 601 },
863 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 602 },
864 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 603 },
865 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 604 },
866 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 605 },
867 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 609 },
868 .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 610 },
869 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 611 },
870 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 612 },
871 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 285 },
869872 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
870 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 612 },
871 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 613 },
873 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 613 },
874 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 614 },
872875 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
873 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 614 },
874876 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 615 },
875 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 616 },
876 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 617 },
877 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 618 },
878 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 608 },
879 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 619 },
880 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 620 },
881 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 621 },
882 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 622 },
883 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 342 },
884 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 623 },
885 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 624 },
886 .{ .char = 't', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 625 },
887 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 626 },
888 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 627 },
877 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 616 },
878 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 617 },
879 .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 618 },
880 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 619 },
881 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 610 },
882 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 620 },
883 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 621 },
884 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 622 },
885 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 623 },
886 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
887 .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 624 },
888 .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 625 },
889 .{ .char = 't', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 626 },
890 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 627 },
891 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 628 },
889892 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
890 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 628 },
891 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 629 },
892 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 366 },
893 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 630 },
894 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 631 },
895 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 632 },
896 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 633 },
897 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 634 },
893 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 629 },
894 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 630 },
895 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 631 },
896 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 632 },
897 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 633 },
898 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 634 },
899 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 635 },
898900 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
899 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 573 },
900 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 500 },
901 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 635 },
902 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 636 },
903 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 637 },
904 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 638 },
905 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 639 },
906 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 640 },
907 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 641 },
901 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
902 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 502 },
903 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 636 },
904 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 637 },
905 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 638 },
906 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 639 },
907 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 640 },
908 .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 641 },
909 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 642 },
908910 .{ .char = 'k', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
909 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 391 },
910 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 642 },
911 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
912 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 643 },
913 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 296 },
911 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 393 },
912 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 643 },
913 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
914914 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 644 },
915 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 645 },
916 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
917 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 646 },
918 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 647 },
919 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 648 },
920 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 649 },
921 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 226 },
922 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 650 },
923 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 651 },
924 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
925 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 652 },
926 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 653 },
927 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 654 },
928 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 655 },
915 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 298 },
916 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 645 },
917 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 646 },
918 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
919 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 647 },
920 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 648 },
921 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 649 },
922 .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 650 },
923 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 227 },
924 .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 651 },
925 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 652 },
926 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 346 },
927 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 653 },
928 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 654 },
929 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 655 },
930 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 656 },
929931 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 156 },
930 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 656 },
931932 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 657 },
932 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 658 },
933 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 204 },
934 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 659 },
935 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 660 },
936 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 661 },
937 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 662 },
938 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 663 },
939 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 664 },
940 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 665 },
941 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 666 },
942 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 216 },
943 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 667 },
944 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
945 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 668 },
933 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 658 },
934 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 659 },
935 .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 205 },
936 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 660 },
937 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 661 },
938 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 662 },
939 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 663 },
940 .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 664 },
941 .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 665 },
942 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 666 },
943 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 667 },
944 .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 217 },
945 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 668 },
946 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 577 },
947 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 669 },
946948 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
947 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 669 },
949 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 670 },
948950 .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
949 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 670 },
950 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 671 },
951 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 672 },
952 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 673 },
953 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 674 },
954 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 675 },
955 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 676 },
956 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 677 },
951 .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 671 },
952 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 672 },
953 .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 673 },
954 .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 674 },
955 .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 675 },
956 .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 676 },
957 .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 677 },
958 .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 678 },
957959 .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 170 },
958 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 678 },
960 .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 679 },
959961 .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
960962};
961963pub const data = blk: {
962 @setEvalBranchQuota(805);
964 @setEvalBranchQuota(812);
963965 break :blk [_]@This(){
964966 .{ .tag = .aarch64_sve_pcs, .properties = .{ .tag = .aarch64_sve_pcs, .gnu = true } },
965967 .{ .tag = .aarch64_vector_pcs, .properties = .{ .tag = .aarch64_vector_pcs, .gnu = true } },
......@@ -1028,6 +1030,7 @@ pub const data = blk: {
10281030 .{ .tag = .noinit, .properties = .{ .tag = .noinit, .gnu = true } },
10291031 .{ .tag = .@"noinline", .properties = .{ .tag = .@"noinline", .gnu = true, .declspec = true } },
10301032 .{ .tag = .noipa, .properties = .{ .tag = .noipa, .gnu = true } },
1033 .{ .tag = .nonnull, .properties = .{ .tag = .nonnull, .gnu = true } },
10311034 .{ .tag = .nonstring, .properties = .{ .tag = .nonstring, .gnu = true } },
10321035 .{ .tag = .noplt, .properties = .{ .tag = .noplt, .gnu = true } },
10331036 .{ .tag = .@"noreturn", .properties = .{ .tag = .@"noreturn", .c23 = true, .gnu = true, .declspec = true } },
lib/compiler/aro/aro/Builtins.zig+5-4
......@@ -312,12 +312,13 @@ pub const Iterator = struct {
312312};
313313
314314test Iterator {
315 const gpa = std.testing.allocator;
315316 var it = Iterator{};
316317
317 var seen = std.StringHashMap(Builtin).init(std.testing.allocator);
318 defer seen.deinit();
318 var seen: std.StringHashMapUnmanaged(Builtin) = .empty;
319 defer seen.deinit(gpa);
319320
320 var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
321 var arena_state = std.heap.ArenaAllocator.init(gpa);
321322 defer arena_state.deinit();
322323 const arena = arena_state.allocator();
323324
......@@ -333,7 +334,7 @@ test Iterator {
333334 std.debug.print("previous data: {}\n", .{seen.get(entry.name).?});
334335 return error.TestExpectedUniqueEntries;
335336 }
336 try seen.put(try arena.dupe(u8, entry.name), entry.builtin);
337 try seen.put(gpa, try arena.dupe(u8, entry.name), entry.builtin);
337338 }
338339 try std.testing.expectEqual(@as(usize, Builtin.data.len), seen.count());
339340}
lib/compiler/aro/aro/CodeGen.zig+9-8
......@@ -40,11 +40,11 @@ tree: *const Tree,
4040comp: *Compilation,
4141builder: Builder,
4242wip_switch: *WipSwitch = undefined,
43symbols: std.ArrayListUnmanaged(Symbol) = .{},
44ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
45phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
46record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{},
47record_cache: std.AutoHashMapUnmanaged(QualType, Interner.Ref) = .{},
43symbols: std.ArrayList(Symbol) = .empty,
44ret_nodes: std.ArrayList(Ir.Inst.Phi.Input) = .empty,
45phi_nodes: std.ArrayList(Ir.Inst.Phi.Input) = .empty,
46record_elem_buf: std.ArrayList(Interner.Ref) = .empty,
47record_cache: std.AutoHashMapUnmanaged(QualType, Interner.Ref) = .empty,
4848cond_dummy_ty: ?Interner.Ref = null,
4949bool_invert: bool = false,
5050bool_end_label: Ir.Ref = .none,
......@@ -56,10 +56,11 @@ compound_assign_dummy: ?Ir.Ref = null,
5656
5757fn fail(c: *CodeGen, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } {
5858 var sf = std.heap.stackFallback(1024, c.comp.gpa);
59 var buf = std.ArrayList(u8).init(sf.get());
60 defer buf.deinit();
59 const allocator = sf.get();
60 var buf: std.ArrayList(u8) = .empty;
61 defer buf.deinit(allocator);
6162
62 try buf.print(fmt, args);
63 try buf.print(allocator, fmt, args);
6364 try c.comp.diagnostics.add(.{ .text = buf.items, .kind = .@"fatal error", .location = null });
6465 return error.FatalError;
6566}
lib/compiler/aro/aro/Compilation.zig+68-47
......@@ -4,8 +4,9 @@ const EpochSeconds = std.time.epoch.EpochSeconds;
44const mem = std.mem;
55const Allocator = mem.Allocator;
66
7const Interner = @import("../backend.zig").Interner;
8const CodeGenOptions = @import("../backend.zig").CodeGenOptions;
7const backend = @import("../backend.zig");
8const Interner = backend.Interner;
9const CodeGenOptions = backend.CodeGenOptions;
910
1011const Builtins = @import("Builtins.zig");
1112const Builtin = Builtins.Builtin;
......@@ -127,24 +128,24 @@ diagnostics: *Diagnostics,
127128
128129code_gen_options: CodeGenOptions = .default,
129130environment: Environment = .{},
130sources: std.StringArrayHashMapUnmanaged(Source) = .{},
131sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
131132/// Allocated into `gpa`, but keys are externally managed.
132include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
133include_dirs: std.ArrayList([]const u8) = .empty,
133134/// Allocated into `gpa`, but keys are externally managed.
134system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
135system_include_dirs: std.ArrayList([]const u8) = .empty,
135136/// Allocated into `gpa`, but keys are externally managed.
136after_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
137after_include_dirs: std.ArrayList([]const u8) = .empty,
137138/// Allocated into `gpa`, but keys are externally managed.
138framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
139framework_dirs: std.ArrayList([]const u8) = .empty,
139140/// Allocated into `gpa`, but keys are externally managed.
140system_framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
141system_framework_dirs: std.ArrayList([]const u8) = .empty,
141142/// Allocated into `gpa`, but keys are externally managed.
142embed_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
143embed_dirs: std.ArrayList([]const u8) = .empty,
143144target: std.Target = @import("builtin").target,
144145cmodel: std.builtin.CodeModel = .default,
145pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{},
146pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
146147langopts: LangOpts = .{},
147generated_buf: std.ArrayListUnmanaged(u8) = .{},
148generated_buf: std.ArrayList(u8) = .empty,
148149builtins: Builtins = .{},
149150string_interner: StringInterner = .{},
150151interner: Interner = .{},
......@@ -245,6 +246,13 @@ fn generateSystemDefines(comp: *Compilation, w: *std.Io.Writer) !void {
245246 try w.print("#define __GNUC_PATCHLEVEL__ {d}\n", .{comp.langopts.gnuc_version % 100});
246247 }
247248
249 if (comp.code_gen_options.optimization_level.hasAnyOptimizations()) {
250 try define(w, "__OPTIMIZE__");
251 }
252 if (comp.code_gen_options.optimization_level.isSizeOptimized()) {
253 try define(w, "__OPTIMIZE_SIZE__");
254 }
255
248256 // os macros
249257 switch (comp.target.os.tag) {
250258 .linux => try defineStd(w, "linux", is_gnu),
......@@ -1379,8 +1387,8 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
13791387 const duped_path = try comp.gpa.dupe(u8, path);
13801388 errdefer comp.gpa.free(duped_path);
13811389
1382 var splice_list = std.array_list.Managed(u32).init(comp.gpa);
1383 defer splice_list.deinit();
1390 var splice_list: std.ArrayList(u32) = .empty;
1391 defer splice_list.deinit(comp.gpa);
13841392
13851393 const source_id: Source.Id = @enumFromInt(comp.sources.count() + 2);
13861394
......@@ -1413,9 +1421,9 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
14131421 },
14141422 .back_slash, .trailing_ws, .back_slash_cr => {
14151423 i = backslash_loc;
1416 try splice_list.append(i);
1424 try splice_list.append(comp.gpa, i);
14171425 if (state == .trailing_ws) {
1418 try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line);
1426 try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line, kind);
14191427 }
14201428 state = if (state == .back_slash_cr) .cr else .back_slash_cr;
14211429 },
......@@ -1433,10 +1441,10 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
14331441 .back_slash, .trailing_ws => {
14341442 i = backslash_loc;
14351443 if (state == .back_slash or state == .trailing_ws) {
1436 try splice_list.append(i);
1444 try splice_list.append(comp.gpa, i);
14371445 }
14381446 if (state == .trailing_ws) {
1439 try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line);
1447 try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line, kind);
14401448 }
14411449 },
14421450 .bom1, .bom2 => break,
......@@ -1486,11 +1494,11 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
14861494 }
14871495 }
14881496
1489 const splice_locs = try splice_list.toOwnedSlice();
1497 const splice_locs = try splice_list.toOwnedSlice(comp.gpa);
14901498 errdefer comp.gpa.free(splice_locs);
14911499
14921500 if (i != contents.len) {
1493 var list: std.ArrayListUnmanaged(u8) = .{
1501 var list: std.ArrayList(u8) = .{
14941502 .items = contents[0..i],
14951503 .capacity = contents.len,
14961504 };
......@@ -1510,13 +1518,21 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
15101518 return source;
15111519}
15121520
1513fn addNewlineEscapeError(comp: *Compilation, path: []const u8, buf: []const u8, splice_locs: []const u32, byte_offset: u32, line: u32) !void {
1521fn addNewlineEscapeError(
1522 comp: *Compilation,
1523 path: []const u8,
1524 buf: []const u8,
1525 splice_locs: []const u32,
1526 byte_offset: u32,
1527 line: u32,
1528 kind: Source.Kind,
1529) !void {
15141530 // Temporary source for getting the location for errors.
15151531 var tmp_source: Source = .{
15161532 .path = path,
15171533 .buf = buf,
15181534 .id = undefined,
1519 .kind = undefined,
1535 .kind = kind,
15201536 .splice_locs = splice_locs,
15211537 };
15221538
......@@ -1566,17 +1582,7 @@ fn addSourceFromPathExtra(comp: *Compilation, path: []const u8, kind: Source.Kin
15661582}
15671583
15681584pub fn addSourceFromFile(comp: *Compilation, file: std.fs.File, path: []const u8, kind: Source.Kind) !Source {
1569 var file_buf: [4096]u8 = undefined;
1570 var file_reader = file.reader(&file_buf);
1571 if (try file_reader.getSize() > std.math.maxInt(u32)) return error.FileTooBig;
1572
1573 var allocating: std.Io.Writer.Allocating = .init(comp.gpa);
1574 _ = allocating.writer.sendFileAll(&file_reader, .limited(std.math.maxInt(u32))) catch |e| switch (e) {
1575 error.WriteFailed => return error.OutOfMemory,
1576 error.ReadFailed => return file_reader.err.?,
1577 };
1578
1579 const contents = try allocating.toOwnedSlice();
1585 const contents = try comp.getFileContents(file, .unlimited);
15801586 errdefer comp.gpa.free(contents);
15811587 return comp.addSourceFromOwnedBuffer(path, contents, kind);
15821588}
......@@ -1671,7 +1677,7 @@ const FindInclude = struct {
16711677 if (try find.checkFrameworkDir(dir, .system)) |res| return res;
16721678 }
16731679 for (comp.after_include_dirs.items) |dir| {
1674 if (try find.checkIncludeDir(dir, .user)) |res| return res;
1680 if (try find.checkIncludeDir(dir, .system)) |res| return res;
16751681 }
16761682 if (comp.ms_cwd_source_id) |source_id| {
16771683 if (try find.checkMsCwdIncludeDir(source_id)) |res| return res;
......@@ -1766,26 +1772,38 @@ pub const IncludeType = enum {
17661772 angle_brackets,
17671773};
17681774
1769fn getFileContents(comp: *Compilation, path: []const u8, limit: std.Io.Limit) ![]const u8 {
1775fn getPathContents(comp: *Compilation, path: []const u8, limit: std.Io.Limit) ![]u8 {
17701776 if (mem.indexOfScalar(u8, path, 0) != null) {
17711777 return error.FileNotFound;
17721778 }
17731779
17741780 const file = try comp.cwd.openFile(path, .{});
17751781 defer file.close();
1782 return comp.getFileContents(file, limit);
1783}
17761784
1777 var allocating: std.Io.Writer.Allocating = .init(comp.gpa);
1778 defer allocating.deinit();
1779
1785fn getFileContents(comp: *Compilation, file: std.fs.File, limit: std.Io.Limit) ![]u8 {
17801786 var file_buf: [4096]u8 = undefined;
17811787 var file_reader = file.reader(&file_buf);
1782 if (limit.minInt64(try file_reader.getSize()) > std.math.maxInt(u32)) return error.FileTooBig;
1783
1784 _ = allocating.writer.sendFileAll(&file_reader, limit) catch |err| switch (err) {
1785 error.WriteFailed => return error.OutOfMemory,
1786 error.ReadFailed => return file_reader.err.?,
1787 };
17881788
1789 var allocating: std.Io.Writer.Allocating = .init(comp.gpa);
1790 defer allocating.deinit();
1791 if (file_reader.getSize()) |size| {
1792 const limited_size = limit.minInt64(size);
1793 if (limited_size > std.math.maxInt(u32)) return error.FileTooBig;
1794 try allocating.ensureUnusedCapacity(limited_size);
1795 } else |_| {}
1796
1797 var remaining = limit.min(.limited(std.math.maxInt(u32)));
1798 while (remaining.nonzero()) {
1799 const n = file_reader.interface.stream(&allocating.writer, remaining) catch |err| switch (err) {
1800 error.EndOfStream => return allocating.toOwnedSlice(),
1801 error.WriteFailed => return error.OutOfMemory,
1802 error.ReadFailed => return file_reader.err.?,
1803 };
1804 remaining = remaining.subtract(n).?;
1805 }
1806 if (limit == .unlimited) return error.FileTooBig;
17891807 return allocating.toOwnedSlice();
17901808}
17911809
......@@ -1797,9 +1815,10 @@ pub fn findEmbed(
17971815 include_type: IncludeType,
17981816 limit: std.Io.Limit,
17991817 opt_dep_file: ?*DepFile,
1800) !?[]const u8 {
1818) !?[]u8 {
18011819 if (std.fs.path.isAbsolute(filename)) {
1802 if (comp.getFileContents(filename, limit)) |some| {
1820 if (comp.getPathContents(filename, limit)) |some| {
1821 errdefer comp.gpa.free(some);
18031822 if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
18041823 return some;
18051824 } else |err| switch (err) {
......@@ -1819,7 +1838,8 @@ pub fn findEmbed(
18191838 if (comp.langopts.ms_extensions) {
18201839 std.mem.replaceScalar(u8, path, '\\', '/');
18211840 }
1822 if (comp.getFileContents(path, limit)) |some| {
1841 if (comp.getPathContents(path, limit)) |some| {
1842 errdefer comp.gpa.free(some);
18231843 if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
18241844 return some;
18251845 } else |err| switch (err) {
......@@ -1835,7 +1855,8 @@ pub fn findEmbed(
18351855 if (comp.langopts.ms_extensions) {
18361856 std.mem.replaceScalar(u8, path, '\\', '/');
18371857 }
1838 if (comp.getFileContents(path, limit)) |some| {
1858 if (comp.getPathContents(path, limit)) |some| {
1859 errdefer comp.gpa.free(some);
18391860 if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
18401861 return some;
18411862 } else |err| switch (err) {
lib/compiler/aro/aro/DepFile.zig+33-12
......@@ -28,7 +28,7 @@ pub fn write(d: *const DepFile, w: *std.Io.Writer) std.Io.Writer.Error!void {
2828 const max_columns = 75;
2929 var columns: usize = 0;
3030
31 try w.writeAll(d.target);
31 try writeTarget(d.target, w);
3232 columns += d.target.len;
3333 try w.writeByte(':');
3434 columns += 1;
......@@ -48,6 +48,26 @@ pub fn write(d: *const DepFile, w: *std.Io.Writer) std.Io.Writer.Error!void {
4848 try w.flush();
4949}
5050
51fn writeTarget(path: []const u8, w: *std.Io.Writer) !void {
52 for (path, 0..) |c, i| {
53 switch (c) {
54 ' ', '\t' => {
55 try w.writeByte('\\');
56 var j = i;
57 while (j != 0) {
58 j -= 1;
59 if (path[j] != '\\') break;
60 try w.writeByte('\\');
61 }
62 },
63 '$' => try w.writeByte('$'),
64 '#' => try w.writeByte('\\'),
65 else => {},
66 }
67 try w.writeByte(c);
68 }
69}
70
5171fn writePath(d: *const DepFile, path: []const u8, w: *std.Io.Writer) !void {
5272 switch (d.format) {
5373 .nmake => {
......@@ -58,18 +78,19 @@ fn writePath(d: *const DepFile, path: []const u8, w: *std.Io.Writer) !void {
5878 },
5979 .make => {
6080 for (path, 0..) |c, i| {
61 if (c == '#') {
62 try w.writeByte('\\');
63 } else if (c == '$') {
64 try w.writeByte('$');
65 } else if (c == ' ') {
66 try w.writeByte('\\');
67 var j = i;
68 while (j != 0) {
69 j -= 1;
70 if (path[j] != '\\') break;
81 switch (c) {
82 ' ' => {
7183 try w.writeByte('\\');
72 }
84 var j = i;
85 while (j != 0) {
86 j -= 1;
87 if (path[j] != '\\') break;
88 try w.writeByte('\\');
89 }
90 },
91 '$' => try w.writeByte('$'),
92 '#' => try w.writeByte('\\'),
93 else => {},
7394 }
7495 try w.writeByte(c);
7596 }
lib/compiler/aro/aro/Diagnostics.zig+17-3
......@@ -193,6 +193,8 @@ pub const Option = enum {
193193 @"microsoft-flexible-array",
194194 @"microsoft-anon-tag",
195195 @"out-of-scope-function",
196 @"date-time",
197 @"attribute-todo",
196198
197199 /// GNU extensions
198200 pub const gnu = [_]Option{
......@@ -278,6 +280,8 @@ pub const State = struct {
278280 extensions: Message.Kind = .off,
279281 /// How to treat individual options, set by -W<name>
280282 options: std.EnumMap(Option, Message.Kind) = .{},
283 /// Should warnings be suppressed in system headers, set by -Wsystem-headers
284 suppress_system_headers: bool = true,
281285};
282286
283287const Diagnostics = @This();
......@@ -288,7 +292,7 @@ output: union(enum) {
288292 color: std.Io.tty.Config,
289293 },
290294 to_list: struct {
291 messages: std.ArrayListUnmanaged(Message) = .empty,
295 messages: std.ArrayList(Message) = .empty,
292296 arena: std.heap.ArenaAllocator,
293297 },
294298 ignore,
......@@ -373,6 +377,16 @@ pub fn effectiveKind(d: *Diagnostics, message: anytype) Message.Kind {
373377 return .off;
374378 }
375379
380 if (@hasField(@TypeOf(message), "location")) {
381 if (message.location) |location| {
382 if (location.kind != .user and d.state.suppress_system_headers and
383 (message.kind == .warning or message.kind == .off))
384 {
385 return .off;
386 }
387 }
388 }
389
376390 var kind = message.kind;
377391
378392 // Get explicit kind set by -W<name>=
......@@ -418,9 +432,9 @@ pub fn addWithLocation(
418432 note_msg_loc: bool,
419433) Compilation.Error!void {
420434 var copy = msg;
421 copy.effective_kind = d.effectiveKind(msg);
422 if (copy.effective_kind == .off) return;
423435 if (expansion_locs.len != 0) copy.location = expansion_locs[expansion_locs.len - 1].expand(comp);
436 copy.effective_kind = d.effectiveKind(copy);
437 if (copy.effective_kind == .off) return;
424438 try d.addMessage(copy);
425439
426440 if (expansion_locs.len != 0) {
lib/compiler/aro/aro/Driver.zig+19-25
......@@ -45,8 +45,8 @@ const Driver = @This();
4545comp: *Compilation,
4646diagnostics: *Diagnostics,
4747
48inputs: std.ArrayListUnmanaged(Source) = .{},
49link_objects: std.ArrayListUnmanaged([]const u8) = .{},
48inputs: std.ArrayList(Source) = .empty,
49link_objects: std.ArrayList([]const u8) = .empty,
5050output_name: ?[]const u8 = null,
5151sysroot: ?[]const u8 = null,
5252resource_dir: ?[]const u8 = null,
......@@ -107,7 +107,6 @@ raw_cpu: ?[]const u8 = null,
107107use_assembly_backend: bool = false,
108108
109109// linker options
110use_linker: ?[]const u8 = null,
111110linker_path: ?[]const u8 = null,
112111nodefaultlibs: bool = false,
113112nolibc: bool = false,
......@@ -270,7 +269,7 @@ pub const usage =
270269pub fn parseArgs(
271270 d: *Driver,
272271 stdout: *std.Io.Writer,
273 macro_buf: *std.ArrayListUnmanaged(u8),
272 macro_buf: *std.ArrayList(u8),
274273 args: []const []const u8,
275274) (Compilation.Error || std.Io.Writer.Error)!bool {
276275 var i: usize = 1;
......@@ -322,7 +321,7 @@ pub fn parseArgs(
322321 }
323322 try macro_buf.print(d.comp.gpa, "#undef {s}\n", .{macro});
324323 } else if (mem.eql(u8, arg, "-O")) {
325 d.comp.code_gen_options.optimization_level = .@"0";
324 d.comp.code_gen_options.optimization_level = .@"1";
326325 } else if (mem.startsWith(u8, arg, "-O")) {
327326 d.comp.code_gen_options.optimization_level = backend.CodeGenOptions.OptimizationLevel.fromString(arg["-O".len..]) orelse {
328327 try d.err("invalid optimization level '{s}'", .{arg});
......@@ -600,6 +599,10 @@ pub fn parseArgs(
600599 d.diagnostics.state.enable_all_warnings = false;
601600 } else if (mem.eql(u8, arg, "-Weverything")) {
602601 d.diagnostics.state.enable_all_warnings = true;
602 } else if (mem.eql(u8, arg, "-Wno-system-headers")) {
603 d.diagnostics.state.suppress_system_headers = true;
604 } else if (mem.eql(u8, arg, "-Wsystem-headers")) {
605 d.diagnostics.state.suppress_system_headers = false;
603606 } else if (mem.eql(u8, arg, "-Werror")) {
604607 d.diagnostics.state.error_warnings = true;
605608 } else if (mem.eql(u8, arg, "-Wno-error")) {
......@@ -644,10 +647,6 @@ pub fn parseArgs(
644647 d.comp.langopts.preserve_comments = true;
645648 d.comp.langopts.preserve_comments_in_macros = true;
646649 comment_arg = arg;
647 } else if (option(arg, "-fuse-ld=")) |linker_name| {
648 d.use_linker = linker_name;
649 } else if (mem.eql(u8, arg, "-fuse-ld=")) {
650 d.use_linker = null;
651650 } else if (option(arg, "--ld-path=")) |linker_path| {
652651 d.linker_path = linker_path;
653652 } else if (mem.eql(u8, arg, "-r")) {
......@@ -917,13 +916,11 @@ pub fn errorDescription(e: anyerror) []const u8 {
917916 };
918917}
919918
920var stdout_buffer: [4096]u8 = undefined;
921
922919/// The entry point of the Aro compiler.
923920/// **MAY call `exit` if `fast_exit` is set.**
924921pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8, comptime fast_exit: bool, asm_gen_fn: ?AsmCodeGenFn) Compilation.Error!void {
925922 const user_macros = macros: {
926 var macro_buf: std.ArrayListUnmanaged(u8) = .empty;
923 var macro_buf: std.ArrayList(u8) = .empty;
927924 defer macro_buf.deinit(d.comp.gpa);
928925
929926 var stdout_buf: [256]u8 = undefined;
......@@ -1107,7 +1104,7 @@ fn processSource(
11071104
11081105 var name_buf: [std.fs.max_name_bytes]u8 = undefined;
11091106 var opt_dep_file = try d.initDepFile(source, &name_buf, false);
1110 defer if (opt_dep_file) |*dep_file| dep_file.deinit(pp.gpa);
1107 defer if (opt_dep_file) |*dep_file| dep_file.deinit(d.comp.gpa);
11111108
11121109 if (opt_dep_file) |*dep_file| pp.dep_file = dep_file;
11131110
......@@ -1164,14 +1161,11 @@ fn processSource(
11641161 else
11651162 std.fs.File.stdout();
11661163 defer if (d.output_name != null) file.close();
1167 var file_buffer: [1024]u8 = undefined;
1168 var file_writer = file.writer(&file_buffer);
11691164
1170 pp.prettyPrintTokens(&file_writer.interface, dump_mode) catch |er|
1171 return d.fatal("unable to write result: {s}", .{errorDescription(er)});
1165 var file_writer = file.writer(&writer_buf);
1166 pp.prettyPrintTokens(&file_writer.interface, dump_mode) catch
1167 return d.fatal("unable to write result: {s}", .{errorDescription(file_writer.err.?)});
11721168
1173 file_writer.interface.flush() catch |er|
1174 return d.fatal("unable to write result: {s}", .{errorDescription(er)});
11751169 if (fast_exit) std.process.exit(0); // Not linking, no need for cleanup.
11761170 return;
11771171 }
......@@ -1180,9 +1174,8 @@ fn processSource(
11801174 defer tree.deinit();
11811175
11821176 if (d.verbose_ast) {
1183 var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer);
1184 tree.dump(d.detectConfig(.stdout()), &stdout_writer.interface) catch {};
1185 stdout_writer.interface.flush() catch {};
1177 var stdout = std.fs.File.stdout().writer(&writer_buf);
1178 tree.dump(d.detectConfig(stdout.file), &stdout.interface) catch {};
11861179 }
11871180
11881181 d.printDiagnosticsStats();
......@@ -1299,12 +1292,13 @@ fn dumpLinkerArgs(w: *std.Io.Writer, items: []const []const u8) !void {
12991292/// The entry point of the Aro compiler.
13001293/// **MAY call `exit` if `fast_exit` is set.**
13011294pub fn invokeLinker(d: *Driver, tc: *Toolchain, comptime fast_exit: bool) Compilation.Error!void {
1302 var argv = std.array_list.Managed([]const u8).init(d.comp.gpa);
1303 defer argv.deinit();
1295 const gpa = d.comp.gpa;
1296 var argv: std.ArrayList([]const u8) = .empty;
1297 defer argv.deinit(gpa);
13041298
13051299 var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined;
13061300 const linker_path = try tc.getLinkerPath(&linker_path_buf);
1307 try argv.append(linker_path);
1301 try argv.append(gpa, linker_path);
13081302
13091303 try tc.buildLinkerArgs(&argv);
13101304
lib/compiler/aro/aro/Driver/Multilib.zig+32-23
......@@ -1,47 +1,50 @@
11const std = @import("std");
22const Filesystem = @import("Filesystem.zig").Filesystem;
33
4pub const Flags = std.ArrayListUnmanaged([]const u8);
5
64/// Large enough for GCCDetector for Linux; may need to be increased to support other toolchains.
75const max_multilibs = 4;
86
9const MultilibArray = std.ArrayListUnmanaged(Multilib);
10
117pub const Detected = struct {
12 multilibs: MultilibArray = .{},
8 multilib_buf: [max_multilibs]Multilib = undefined,
9 multilib_count: u8 = 0,
1310 selected: Multilib = .{},
1411 biarch_sibling: ?Multilib = null,
1512
16 pub fn filter(self: *Detected, multilib_filter: Filter, fs: Filesystem) void {
17 var found_count: usize = 0;
18 for (self.multilibs.items) |multilib| {
13 pub fn filter(d: *Detected, multilib_filter: Filter, fs: Filesystem) void {
14 var found_count: u8 = 0;
15 for (d.multilibs()) |multilib| {
1916 if (multilib_filter.exists(multilib, fs)) {
20 self.multilibs.items[found_count] = multilib;
17 d.multilib_buf[found_count] = multilib;
2118 found_count += 1;
2219 }
2320 }
24 self.multilibs.resize(found_count) catch unreachable;
21 d.multilib_count = found_count;
2522 }
2623
27 pub fn select(self: *Detected, flags: []const []const Flags) !bool {
28 var filtered: MultilibArray = .{};
29 for (self.multilibs.items) |multilib| {
30 for (flags) |multilib_flag| {
31 const matched = for (flags) |arg_flag| {
24 pub fn select(d: *Detected, check_flags: []const []const u8) !bool {
25 var selected: ?Multilib = null;
26
27 for (d.multilibs()) |multilib| {
28 for (multilib.flags()) |multilib_flag| {
29 const matched = for (check_flags) |arg_flag| {
3230 if (std.mem.eql(u8, arg_flag[1..], multilib_flag[1..])) break arg_flag;
3331 } else multilib_flag;
3432 if (matched[0] != multilib_flag[0]) break;
33 } else if (selected != null) {
34 return error.TooManyMultilibs;
3535 } else {
36 filtered.appendAssumeCapacity(multilib);
36 selected = multilib;
3737 }
3838 }
39 if (filtered.len == 0) return false;
40 if (filtered.len == 1) {
41 self.selected = filtered.get(0);
39 if (selected) |multilib| {
40 d.selected = multilib;
4241 return true;
4342 }
44 return error.TooManyMultilibs;
43 return false;
44 }
45
46 pub fn multilibs(d: *const Detected) []const Multilib {
47 return d.multilib_buf[0..d.multilib_count];
4548 }
4649};
4750
......@@ -58,14 +61,20 @@ const Multilib = @This();
5861gcc_suffix: []const u8 = "",
5962os_suffix: []const u8 = "",
6063include_suffix: []const u8 = "",
61flags: Flags = .{},
64flag_buf: [6][]const u8 = undefined,
65flag_count: u8 = 0,
6266priority: u32 = 0,
6367
64pub fn init(gcc_suffix: []const u8, os_suffix: []const u8, flags: []const []const u8) Multilib {
68pub fn init(gcc_suffix: []const u8, os_suffix: []const u8, init_flags: []const []const u8) Multilib {
6569 var self: Multilib = .{
6670 .gcc_suffix = gcc_suffix,
6771 .os_suffix = os_suffix,
72 .flag_count = @intCast(init_flags.len),
6873 };
69 self.flags.appendSliceAssumeCapacity(flags);
74 @memcpy(self.flag_buf[0..init_flags.len], init_flags);
7075 return self;
7176}
77
78pub fn flags(m: *const Multilib) []const []const u8 {
79 return m.flag_buf[0..m.flag_count];
80}
lib/compiler/aro/aro/InitList.zig+1-1
......@@ -22,7 +22,7 @@ const Item = struct {
2222
2323const InitList = @This();
2424
25list: std.ArrayListUnmanaged(Item) = .empty,
25list: std.ArrayList(Item) = .empty,
2626node: Node.OptIndex = .null,
2727tok: TokenIndex = 0,
2828
lib/compiler/aro/aro/Parser.zig+296-216
......@@ -32,12 +32,12 @@ const Type = TypeStore.Type;
3232const QualType = TypeStore.QualType;
3333const Value = @import("Value.zig");
3434
35const NodeList = std.array_list.Managed(Node.Index);
35const NodeList = std.ArrayList(Node.Index);
3636const Switch = struct {
3737 default: ?TokenIndex = null,
38 ranges: std.array_list.Managed(Range),
38 ranges: std.ArrayList(Range) = .empty,
3939 qt: QualType,
40 comp: *Compilation,
40 comp: *const Compilation,
4141
4242 const Range = struct {
4343 first: Value,
......@@ -45,13 +45,13 @@ const Switch = struct {
4545 tok: TokenIndex,
4646 };
4747
48 fn add(self: *Switch, first: Value, last: Value, tok: TokenIndex) !?Range {
49 for (self.ranges.items) |range| {
50 if (last.compare(.gte, range.first, self.comp) and first.compare(.lte, range.last, self.comp)) {
48 fn add(s: *Switch, first: Value, last: Value, tok: TokenIndex) !?Range {
49 for (s.ranges.items) |range| {
50 if (last.compare(.gte, range.first, s.comp) and first.compare(.lte, range.last, s.comp)) {
5151 return range; // They overlap.
5252 }
5353 }
54 try self.ranges.append(.{
54 try s.ranges.append(s.comp.gpa, .{
5555 .first = first,
5656 .last = last,
5757 .tok = tok,
......@@ -101,7 +101,6 @@ const Parser = @This();
101101pp: *Preprocessor,
102102comp: *Compilation,
103103diagnostics: *Diagnostics,
104gpa: mem.Allocator,
105104tok_ids: []const Token.Id,
106105tok_i: TokenIndex = 0,
107106
......@@ -110,21 +109,21 @@ tree: Tree,
110109
111110// buffers used during compilation
112111syms: SymbolStack = .{},
113strings: std.array_list.Managed(u8),
114labels: std.array_list.Managed(Label),
115list_buf: NodeList,
116decl_buf: NodeList,
112strings: std.array_list.Aligned(u8, .@"4") = .empty,
113labels: std.ArrayList(Label) = .empty,
114list_buf: NodeList = .empty,
115decl_buf: NodeList = .empty,
117116/// Function type parameters, also used for generic selection association
118117/// duplicate checking.
119param_buf: std.array_list.Managed(Type.Func.Param),
118param_buf: std.ArrayList(Type.Func.Param) = .empty,
120119/// Enum type fields.
121enum_buf: std.array_list.Managed(Type.Enum.Field),
120enum_buf: std.ArrayList(Type.Enum.Field) = .empty,
122121/// Record type fields.
123record_buf: std.array_list.Managed(Type.Record.Field),
122record_buf: std.ArrayList(Type.Record.Field) = .empty,
124123/// Attributes that have been parsed but not yet validated or applied.
125124attr_buf: std.MultiArrayList(TentativeAttribute) = .empty,
126125/// Used to store validated attributes before they are applied to types.
127attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty,
126attr_application_buf: std.ArrayList(Attribute) = .empty,
128127/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)
129128/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.
130129/// The key is the StringId of `Foo` and the value is the TokenIndex of `bar`
......@@ -177,7 +176,7 @@ record: struct {
177176 break;
178177 }
179178 }
180 try p.record_members.append(p.gpa, .{ .name = name, .tok = tok });
179 try p.record_members.append(p.comp.gpa, .{ .name = name, .tok = tok });
181180 }
182181
183182 fn addFieldsFromAnonymous(r: @This(), p: *Parser, record_ty: Type.Record) Error!void {
......@@ -192,7 +191,7 @@ record: struct {
192191 }
193192 }
194193} = .{},
195record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{},
194record_members: std.ArrayList(struct { tok: TokenIndex, name: StringId }) = .empty,
196195
197196@"switch": ?*Switch = null,
198197in_loop: bool = false,
......@@ -212,7 +211,7 @@ fn checkIdentifierCodepointWarnings(p: *Parser, codepoint: u21, loc: Source.Loca
212211 assert(codepoint >= 0x80);
213212
214213 const prev_total = p.diagnostics.total;
215 var sf = std.heap.stackFallback(1024, p.gpa);
214 var sf = std.heap.stackFallback(1024, p.comp.gpa);
216215 var allocating: std.Io.Writer.Allocating = .init(sf.get());
217216 defer allocating.deinit();
218217
......@@ -425,7 +424,7 @@ pub fn err(p: *Parser, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype)
425424 if (diagnostic.suppress_unless_version) |some| if (!p.comp.langopts.standard.atLeast(some)) return;
426425 if (p.diagnostics.effectiveKind(diagnostic) == .off) return;
427426
428 var sf = std.heap.stackFallback(1024, p.gpa);
427 var sf = std.heap.stackFallback(1024, p.comp.gpa);
429428 var allocating: std.Io.Writer.Allocating = .init(sf.get());
430429 defer allocating.deinit();
431430
......@@ -604,7 +603,7 @@ pub fn removeNull(p: *Parser, str: Value) !Value {
604603 defer p.strings.items.len = strings_top;
605604 {
606605 const bytes = p.comp.interner.get(str.ref()).bytes;
607 try p.strings.appendSlice(bytes[0 .. bytes.len - 1]);
606 try p.strings.appendSlice(p.comp.gpa, bytes[0 .. bytes.len - 1]);
608607 }
609608 return Value.intern(p.comp, .{ .bytes = p.strings.items[strings_top..] });
610609}
......@@ -799,30 +798,23 @@ fn diagnoseIncompleteDefinitions(p: *Parser) !void {
799798}
800799
801800/// root : (decl | assembly ';' | staticAssert)*
802pub fn parse(pp: *Preprocessor) Error!Tree {
801pub fn parse(pp: *Preprocessor) Compilation.Error!Tree {
802 const gpa = pp.comp.gpa;
803803 assert(pp.linemarkers == .none);
804804 pp.comp.pragmaEvent(.before_parse);
805805
806806 const expected_implicit_typedef_max = 7;
807 try pp.tokens.ensureUnusedCapacity(pp.gpa, expected_implicit_typedef_max);
807 try pp.tokens.ensureUnusedCapacity(gpa, expected_implicit_typedef_max);
808808
809809 var p: Parser = .{
810810 .pp = pp,
811811 .comp = pp.comp,
812812 .diagnostics = pp.diagnostics,
813 .gpa = pp.comp.gpa,
814813 .tree = .{
815814 .comp = pp.comp,
816815 .tokens = undefined, // Set after implicit typedefs
817816 },
818817 .tok_ids = pp.tokens.items(.id),
819 .strings = .init(pp.comp.gpa),
820 .labels = .init(pp.comp.gpa),
821 .list_buf = .init(pp.comp.gpa),
822 .decl_buf = .init(pp.comp.gpa),
823 .param_buf = .init(pp.comp.gpa),
824 .enum_buf = .init(pp.comp.gpa),
825 .record_buf = .init(pp.comp.gpa),
826818 .string_ids = .{
827819 .declspec_id = try pp.comp.internString("__declspec"),
828820 .main_id = try pp.comp.internString("main"),
......@@ -834,18 +826,18 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
834826 };
835827 errdefer p.tree.deinit();
836828 defer {
837 p.labels.deinit();
838 p.strings.deinit();
839 p.syms.deinit(pp.comp.gpa);
840 p.list_buf.deinit();
841 p.decl_buf.deinit();
842 p.param_buf.deinit();
843 p.enum_buf.deinit();
844 p.record_buf.deinit();
845 p.record_members.deinit(pp.comp.gpa);
846 p.attr_buf.deinit(pp.comp.gpa);
847 p.attr_application_buf.deinit(pp.comp.gpa);
848 p.tentative_defs.deinit(pp.comp.gpa);
829 p.labels.deinit(gpa);
830 p.strings.deinit(gpa);
831 p.syms.deinit(gpa);
832 p.list_buf.deinit(gpa);
833 p.decl_buf.deinit(gpa);
834 p.param_buf.deinit(gpa);
835 p.enum_buf.deinit(gpa);
836 p.record_buf.deinit(gpa);
837 p.record_members.deinit(gpa);
838 p.attr_buf.deinit(gpa);
839 p.attr_application_buf.deinit(gpa);
840 p.tentative_defs.deinit(gpa);
849841 }
850842
851843 try p.syms.pushScope(&p);
......@@ -907,7 +899,7 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
907899 },
908900 else => |e| return e,
909901 }) |node| {
910 try p.decl_buf.append(node);
902 try p.decl_buf.append(gpa, node);
911903 continue;
912904 }
913905 if (p.eatToken(.semicolon)) |tok| {
......@@ -915,7 +907,7 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
915907 const empty = try p.tree.addNode(.{ .empty_decl = .{
916908 .semicolon = tok,
917909 } });
918 try p.decl_buf.append(empty);
910 try p.decl_buf.append(gpa, empty);
919911 continue;
920912 }
921913 try p.err(p.tok_i, .expected_external_decl, .{});
......@@ -925,7 +917,9 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
925917 try p.diagnoseIncompleteDefinitions();
926918 }
927919
928 p.tree.root_decls = p.decl_buf.moveToUnmanaged();
920 p.tree.root_decls = p.decl_buf;
921 p.decl_buf = .empty;
922
929923 if (p.tree.root_decls.items.len == implicit_typedef_count) {
930924 try p.err(p.tok_i - 1, .empty_translation_unit, .{});
931925 }
......@@ -937,9 +931,11 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
937931}
938932
939933fn addImplicitTypedef(p: *Parser, name: []const u8, qt: QualType) !void {
934 const gpa = p.comp.gpa;
940935 const start = p.comp.generated_buf.items.len;
941 try p.comp.generated_buf.appendSlice(p.comp.gpa, name);
942 try p.comp.generated_buf.append(p.comp.gpa, '\n');
936 try p.comp.generated_buf.ensureUnusedCapacity(gpa, name.len + 1);
937 p.comp.generated_buf.appendSliceAssumeCapacity(name);
938 p.comp.generated_buf.appendAssumeCapacity('\n');
943939
944940 const name_tok: u32 = @intCast(p.pp.tokens.len);
945941 p.pp.tokens.appendAssumeCapacity(.{ .id = .identifier, .loc = .{
......@@ -958,13 +954,13 @@ fn addImplicitTypedef(p: *Parser, name: []const u8, qt: QualType) !void {
958954 });
959955
960956 const interned_name = try p.comp.internString(name);
961 const typedef_qt = (try p.comp.type_store.put(p.gpa, .{ .typedef = .{
957 const typedef_qt = (try p.comp.type_store.put(gpa, .{ .typedef = .{
962958 .base = qt,
963959 .name = interned_name,
964960 .decl_node = node,
965961 } })).withQualifiers(qt);
966962 try p.syms.defineTypedef(p, interned_name, typedef_qt, name_tok, node);
967 try p.decl_buf.append(node);
963 try p.decl_buf.append(gpa, node);
968964}
969965
970966fn skipToPragmaSentinel(p: *Parser) void {
......@@ -1082,6 +1078,7 @@ fn typedefDefined(p: *Parser, name: StringId, ty: QualType) void {
10821078/// : declSpec (initDeclarator ( ',' initDeclarator)*)? ';'
10831079/// | declSpec declarator decl* compoundStmt
10841080fn decl(p: *Parser) Error!bool {
1081 const gpa = p.comp.gpa;
10851082 _ = try p.pragma();
10861083 const first_tok = p.tok_i;
10871084 const attr_buf_top = p.attr_buf.len;
......@@ -1116,7 +1113,7 @@ fn decl(p: *Parser) Error!bool {
11161113 };
11171114 if (decl_spec.noreturn) |tok| {
11181115 const attr = Attribute{ .tag = .noreturn, .args = .{ .noreturn = .{} }, .syntax = .keyword };
1119 try p.attr_buf.append(p.gpa, .{ .attr = attr, .tok = tok });
1116 try p.attr_buf.append(gpa, .{ .attr = attr, .tok = tok });
11201117 }
11211118
11221119 var decl_node = try p.tree.addNode(.{ .empty_decl = .{
......@@ -1194,7 +1191,7 @@ fn decl(p: *Parser) Error!bool {
11941191 const func_qt = init_d.d.qt.base(p.comp).qt;
11951192 const params_len = func_qt.get(p.comp, .func).?.params.len;
11961193
1197 const new_params = try p.param_buf.addManyAsSlice(params_len);
1194 const new_params = try p.param_buf.addManyAsSlice(gpa, params_len);
11981195 for (new_params) |*new_param| {
11991196 new_param.name = .empty;
12001197 }
......@@ -1280,7 +1277,7 @@ fn decl(p: *Parser) Error!bool {
12801277 }
12811278 }
12821279 // Update the functio type to contain the declared parameters.
1283 p.func.qt = try p.comp.type_store.put(p.gpa, .{ .func = .{
1280 p.func.qt = try p.comp.type_store.put(gpa, .{ .func = .{
12841281 .kind = .normal,
12851282 .params = new_params,
12861283 .return_type = func_ty.return_type,
......@@ -1293,7 +1290,7 @@ fn decl(p: *Parser) Error!bool {
12931290 }
12941291
12951292 // bypass redefinition check to avoid duplicate errors
1296 try p.syms.define(p.gpa, .{
1293 try p.syms.define(gpa, .{
12971294 .kind = .def,
12981295 .name = param.name,
12991296 .tok = param.name_tok,
......@@ -1334,7 +1331,7 @@ fn decl(p: *Parser) Error!bool {
13341331 .definition = null,
13351332 } }, @intFromEnum(decl_node));
13361333
1337 try p.decl_buf.append(decl_node);
1334 try p.decl_buf.append(gpa, decl_node);
13381335
13391336 // check gotos
13401337 if (func.qt == null) {
......@@ -1382,7 +1379,7 @@ fn decl(p: *Parser) Error!bool {
13821379 if (node_qt.get(p.comp, .array)) |array_ty| {
13831380 if (array_ty.len == .incomplete) {
13841381 // Create tentative array node with fixed type.
1385 node_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
1382 node_qt = try p.comp.type_store.put(gpa, .{ .array = .{
13861383 .elem = array_ty.elem,
13871384 .len = .{ .fixed = 1 },
13881385 } });
......@@ -1408,14 +1405,14 @@ fn decl(p: *Parser) Error!bool {
14081405 },
14091406 }, @intFromEnum(decl_node));
14101407 }
1411 try p.decl_buf.append(decl_node);
1408 try p.decl_buf.append(gpa, decl_node);
14121409
14131410 const interned_name = try p.comp.internString(p.tokSlice(init_d.d.name));
14141411 if (decl_spec.storage_class == .typedef) {
14151412 const typedef_qt = if (init_d.d.qt.isInvalid())
14161413 init_d.d.qt
14171414 else
1418 (try p.comp.type_store.put(p.gpa, .{ .typedef = .{
1415 (try p.comp.type_store.put(gpa, .{ .typedef = .{
14191416 .base = init_d.d.qt,
14201417 .name = interned_name,
14211418 .decl_node = decl_node,
......@@ -1500,6 +1497,7 @@ fn staticAssertMessage(p: *Parser, cond_node: Node.Index, maybe_message: ?Result
15001497/// : keyword_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';'
15011498/// | keyword_c23_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';'
15021499fn staticAssert(p: *Parser) Error!bool {
1500 const gpa = p.comp.gpa;
15031501 const static_assert = p.eatToken(.keyword_static_assert) orelse p.eatToken(.keyword_c23_static_assert) orelse return false;
15041502 const l_paren = try p.expectToken(.l_paren);
15051503 const res_token = p.tok_i;
......@@ -1539,7 +1537,7 @@ fn staticAssert(p: *Parser) Error!bool {
15391537 }
15401538 } else {
15411539 if (!res.val.toBool(p.comp)) {
1542 var sf = std.heap.stackFallback(1024, p.gpa);
1540 var sf = std.heap.stackFallback(1024, gpa);
15431541 var allocating: std.Io.Writer.Allocating = .init(sf.get());
15441542 defer allocating.deinit();
15451543
......@@ -1558,7 +1556,7 @@ fn staticAssert(p: *Parser) Error!bool {
15581556 .message = if (str) |some| some.node else null,
15591557 },
15601558 });
1561 try p.decl_buf.append(node);
1559 try p.decl_buf.append(gpa, node);
15621560 return true;
15631561}
15641562
......@@ -1632,6 +1630,7 @@ pub const DeclSpec = struct {
16321630/// : keyword_typeof '(' typeName ')'
16331631/// | keyword_typeof '(' expr ')'
16341632fn typeof(p: *Parser) Error!?QualType {
1633 const gpa = p.comp.gpa;
16351634 var unqual = false;
16361635 switch (p.tok_ids[p.tok_i]) {
16371636 .keyword_typeof, .keyword_typeof1, .keyword_typeof2 => p.tok_i += 1,
......@@ -1646,7 +1645,7 @@ fn typeof(p: *Parser) Error!?QualType {
16461645 try p.expectClosing(l_paren, .r_paren);
16471646 if (qt.isInvalid()) return null;
16481647
1649 return (try p.comp.type_store.put(p.gpa, .{ .typeof = .{
1648 return (try p.comp.type_store.put(gpa, .{ .typeof = .{
16501649 .base = qt,
16511650 .expr = null,
16521651 } })).withQualifiers(qt);
......@@ -1655,7 +1654,7 @@ fn typeof(p: *Parser) Error!?QualType {
16551654 try p.expectClosing(l_paren, .r_paren);
16561655 if (typeof_expr.qt.isInvalid()) return null;
16571656
1658 const typeof_qt = try p.comp.type_store.put(p.gpa, .{ .typeof = .{
1657 const typeof_qt = try p.comp.type_store.put(gpa, .{ .typeof = .{
16591658 .base = typeof_expr.qt,
16601659 .expr = typeof_expr.node,
16611660 } });
......@@ -1704,7 +1703,7 @@ fn declSpec(p: *Parser) Error!?DeclSpec {
17041703 continue;
17051704 },
17061705 .keyword_forceinline, .keyword_forceinline2 => {
1707 try p.attr_buf.append(p.gpa, .{
1706 try p.attr_buf.append(p.comp.gpa, .{
17081707 .attr = .{ .tag = .always_inline, .args = .{ .always_inline = .{} }, .syntax = .keyword },
17091708 .tok = p.tok_i,
17101709 });
......@@ -1883,11 +1882,12 @@ fn diagnose(p: *Parser, attr: Attribute.Tag, arguments: *Attribute.Arguments, ar
18831882/// attributeList : (attribute (',' attribute)*)?
18841883fn gnuAttributeList(p: *Parser) Error!void {
18851884 if (p.tok_ids[p.tok_i] == .r_paren) return;
1885 const gpa = p.comp.gpa;
18861886
1887 if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(p.gpa, attr);
1887 if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(gpa, attr);
18881888 while (p.tok_ids[p.tok_i] != .r_paren) {
18891889 _ = try p.expectToken(.comma);
1890 if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(p.gpa, attr);
1890 if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(gpa, attr);
18911891 }
18921892}
18931893
......@@ -1900,14 +1900,14 @@ fn c23AttributeList(p: *Parser) Error!void {
19001900 } else {
19011901 p.tok_i -= 1;
19021902 }
1903 if (try p.attribute(.c23, namespace)) |attr| try p.attr_buf.append(p.gpa, attr);
1903 if (try p.attribute(.c23, namespace)) |attr| try p.attr_buf.append(p.comp.gpa, attr);
19041904 _ = p.eatToken(.comma);
19051905 }
19061906}
19071907
19081908fn msvcAttributeList(p: *Parser) Error!void {
19091909 while (p.tok_ids[p.tok_i] != .r_paren) {
1910 if (try p.attribute(.declspec, null)) |attr| try p.attr_buf.append(p.gpa, attr);
1910 if (try p.attribute(.declspec, null)) |attr| try p.attr_buf.append(p.comp.gpa, attr);
19111911 _ = p.eatToken(.comma);
19121912 }
19131913}
......@@ -1979,6 +1979,7 @@ fn attributeSpecifierExtra(p: *Parser, declarator_name: ?TokenIndex) Error!void
19791979fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize, decl_node: Node.Index) Error!?InitDeclarator {
19801980 const this_attr_buf_top = p.attr_buf.len;
19811981 defer p.attr_buf.len = this_attr_buf_top;
1982 const gpa = p.comp.gpa;
19821983
19831984 var init_d = InitDeclarator{
19841985 .d = (try p.declarator(decl_spec.qt, .normal)) orelse return null,
......@@ -2081,7 +2082,7 @@ fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize, decl_no
20812082 if (base_array_ty.len == .incomplete) if (init_list_expr.qt.get(p.comp, .array)) |init_array_ty| {
20822083 switch (init_array_ty.len) {
20832084 .fixed, .static => |len| {
2084 init_d.d.qt = (try p.comp.type_store.put(p.gpa, .{ .array = .{
2085 init_d.d.qt = (try p.comp.type_store.put(gpa, .{ .array = .{
20852086 .elem = base_array_ty.elem,
20862087 .len = .{ .fixed = len },
20872088 } })).withQualifiers(init_d.d.qt);
......@@ -2132,11 +2133,11 @@ fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize, decl_no
21322133 break :incomplete;
21332134 },
21342135 .@"struct", .@"union" => |record_ty| {
2135 _ = try p.tentative_defs.getOrPutValue(p.gpa, record_ty.name, init_d.d.name);
2136 _ = try p.tentative_defs.getOrPutValue(gpa, record_ty.name, init_d.d.name);
21362137 break :incomplete;
21372138 },
21382139 .@"enum" => |enum_ty| {
2139 _ = try p.tentative_defs.getOrPutValue(p.gpa, enum_ty.name, init_d.d.name);
2140 _ = try p.tentative_defs.getOrPutValue(gpa, enum_ty.name, init_d.d.name);
21402141 break :incomplete;
21412142 },
21422143 else => {},
......@@ -2234,6 +2235,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool {
22342235 => {
22352236 const align_tok = p.tok_i;
22362237 p.tok_i += 1;
2238 const gpa = p.comp.gpa;
22372239 const l_paren = try p.expectToken(.l_paren);
22382240 const typename_start = p.tok_i;
22392241 if (try p.typeName()) |inner_qt| {
......@@ -2241,7 +2243,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool {
22412243 try p.err(typename_start, .invalid_alignof, .{inner_qt});
22422244 }
22432245 const alignment = Attribute.Alignment{ .requested = inner_qt.alignof(p.comp) };
2244 try p.attr_buf.append(p.gpa, .{
2246 try p.attr_buf.append(gpa, .{
22452247 .attr = .{ .tag = .aligned, .args = .{
22462248 .aligned = .{ .alignment = alignment, .__name_tok = align_tok },
22472249 }, .syntax = .keyword },
......@@ -2257,7 +2259,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool {
22572259 return error.ParsingFailed;
22582260 }
22592261 args.aligned.alignment.?.node = .pack(res.node);
2260 try p.attr_buf.append(p.gpa, .{
2262 try p.attr_buf.append(gpa, .{
22612263 .attr = .{ .tag = .aligned, .args = args, .syntax = .keyword },
22622264 .tok = align_tok,
22632265 });
......@@ -2336,7 +2338,7 @@ fn getAnonymousName(p: *Parser, kind_tok: TokenIndex) !StringId {
23362338 else => "record field",
23372339 };
23382340
2339 var arena = p.comp.type_store.anon_name_arena.promote(p.gpa);
2341 var arena = p.comp.type_store.anon_name_arena.promote(p.comp.gpa);
23402342 defer p.comp.type_store.anon_name_arena = arena.state;
23412343 const str = try std.fmt.allocPrint(
23422344 arena.allocator(),
......@@ -2350,6 +2352,7 @@ fn getAnonymousName(p: *Parser, kind_tok: TokenIndex) !StringId {
23502352/// : (keyword_struct | keyword_union) IDENTIFIER? { recordDecls }
23512353/// | (keyword_struct | keyword_union) IDENTIFIER
23522354fn recordSpec(p: *Parser) Error!QualType {
2355 const gpa = p.comp.gpa;
23532356 const starting_pragma_pack = p.pragma_pack;
23542357 const kind_tok = p.tok_i;
23552358 const is_struct = p.tok_ids[kind_tok] == .keyword_struct;
......@@ -2358,7 +2361,7 @@ fn recordSpec(p: *Parser) Error!QualType {
23582361 defer p.attr_buf.len = attr_buf_top;
23592362 try p.attributeSpecifier();
23602363
2361 const reserved_index = try p.tree.nodes.addOne(p.gpa);
2364 const reserved_index = try p.tree.nodes.addOne(gpa);
23622365
23632366 const maybe_ident = try p.eatIdentifier();
23642367 const l_brace = p.eatToken(.l_brace) orelse {
......@@ -2378,13 +2381,13 @@ fn recordSpec(p: *Parser) Error!QualType {
23782381 .decl_node = @enumFromInt(reserved_index),
23792382 .fields = &.{},
23802383 };
2381 const record_qt = try p.comp.type_store.put(p.gpa, if (is_struct)
2384 const record_qt = try p.comp.type_store.put(gpa, if (is_struct)
23822385 .{ .@"struct" = record_ty }
23832386 else
23842387 .{ .@"union" = record_ty });
23852388
23862389 const attributed_qt = try Attribute.applyTypeAttributes(p, record_qt, attr_buf_top, null);
2387 try p.syms.define(p.gpa, .{
2390 try p.syms.define(gpa, .{
23882391 .kind = if (is_struct) .@"struct" else .@"union",
23892392 .name = interned_name,
23902393 .tok = ident,
......@@ -2401,7 +2404,7 @@ fn recordSpec(p: *Parser) Error!QualType {
24012404 .{ .struct_forward_decl = fw }
24022405 else
24032406 .{ .union_forward_decl = fw }, reserved_index);
2404 try p.decl_buf.append(@enumFromInt(reserved_index));
2407 try p.decl_buf.append(gpa, @enumFromInt(reserved_index));
24052408 return attributed_qt;
24062409 }
24072410 };
......@@ -2435,7 +2438,7 @@ fn recordSpec(p: *Parser) Error!QualType {
24352438 .layout = null,
24362439 .fields = &.{},
24372440 };
2438 const record_qt = try p.comp.type_store.put(p.gpa, if (is_struct)
2441 const record_qt = try p.comp.type_store.put(gpa, if (is_struct)
24392442 .{ .@"struct" = record_ty }
24402443 else
24412444 .{ .@"union" = record_ty });
......@@ -2443,7 +2446,7 @@ fn recordSpec(p: *Parser) Error!QualType {
24432446 // declare a symbol for the type
24442447 // We need to replace the symbol's type if it has attributes
24452448 if (maybe_ident != null) {
2446 try p.syms.define(p.gpa, .{
2449 try p.syms.define(gpa, .{
24472450 .kind = if (is_struct) .@"struct" else .@"union",
24482451 .name = record_ty.name,
24492452 .tok = maybe_ident.?,
......@@ -2455,7 +2458,7 @@ fn recordSpec(p: *Parser) Error!QualType {
24552458 break :blk .{ record_ty, record_qt };
24562459 };
24572460
2458 try p.decl_buf.append(@enumFromInt(reserved_index));
2461 try p.decl_buf.append(gpa, @enumFromInt(reserved_index));
24592462 const decl_buf_top = p.decl_buf.items.len;
24602463 const record_buf_top = p.record_buf.items.len;
24612464 errdefer p.decl_buf.items.len = decl_buf_top - 1;
......@@ -2512,10 +2515,10 @@ fn recordSpec(p: *Parser) Error!QualType {
25122515 const base_type = qt.base(p.comp);
25132516 if (is_struct) {
25142517 std.debug.assert(base_type.type.@"struct".name == record_ty.name);
2515 try p.comp.type_store.set(p.gpa, .{ .@"struct" = record_ty }, @intFromEnum(base_type.qt._index));
2518 try p.comp.type_store.set(gpa, .{ .@"struct" = record_ty }, @intFromEnum(base_type.qt._index));
25162519 } else {
25172520 std.debug.assert(base_type.type.@"union".name == record_ty.name);
2518 try p.comp.type_store.set(p.gpa, .{ .@"union" = record_ty }, @intFromEnum(base_type.qt._index));
2521 try p.comp.type_store.set(gpa, .{ .@"union" = record_ty }, @intFromEnum(base_type.qt._index));
25192522 }
25202523 break :blk false;
25212524 };
......@@ -2603,6 +2606,7 @@ fn recordDecls(p: *Parser) Error!void {
26032606/// recordDecl : typeSpec+ (recordDeclarator (',' recordDeclarator)*)?
26042607/// recordDeclarator : declarator (':' integerConstExpr)?
26052608fn recordDecl(p: *Parser) Error!bool {
2609 const gpa = p.comp.gpa;
26062610 const attr_buf_top = p.attr_buf.len;
26072611 defer p.attr_buf.len = attr_buf_top;
26082612
......@@ -2698,7 +2702,7 @@ fn recordDecl(p: *Parser) Error!bool {
26982702
26992703 const attr_index: u32 = @intCast(p.comp.type_store.attributes.items.len);
27002704 const attr_len: u32 = @intCast(to_append.len);
2701 try p.comp.type_store.attributes.appendSlice(p.gpa, to_append);
2705 try p.comp.type_store.attributes.appendSlice(gpa, to_append);
27022706
27032707 if (name_tok == 0 and bits == null) unnamed: {
27042708 var is_typedef = false;
......@@ -2717,7 +2721,7 @@ fn recordDecl(p: *Parser) Error!bool {
27172721 try p.err(first_tok, .anonymous_struct, .{});
27182722 }
27192723 // An anonymous record appears as indirect fields on the parent
2720 try p.record_buf.append(.{
2724 try p.record_buf.append(gpa, .{
27212725 .name = try p.getAnonymousName(first_tok),
27222726 .qt = qt,
27232727 ._attr_index = attr_index,
......@@ -2731,7 +2735,7 @@ fn recordDecl(p: *Parser) Error!bool {
27312735 .bit_width = null,
27322736 },
27332737 });
2734 try p.decl_buf.append(node);
2738 try p.decl_buf.append(gpa, node);
27352739 try p.record.addFieldsFromAnonymous(p, record_ty);
27362740 break; // must be followed by a semicolon
27372741 },
......@@ -2746,7 +2750,7 @@ fn recordDecl(p: *Parser) Error!bool {
27462750 continue;
27472751 } else {
27482752 const interned_name = if (name_tok != 0) try p.comp.internString(p.tokSlice(name_tok)) else try p.getAnonymousName(first_tok);
2749 try p.record_buf.append(.{
2753 try p.record_buf.append(gpa, .{
27502754 .name = interned_name,
27512755 .qt = qt,
27522756 .name_tok = name_tok,
......@@ -2762,7 +2766,7 @@ fn recordDecl(p: *Parser) Error!bool {
27622766 .bit_width = bits_node,
27632767 },
27642768 });
2765 try p.decl_buf.append(node);
2769 try p.decl_buf.append(gpa, node);
27662770 }
27672771
27682772 if (!qt.isInvalid()) {
......@@ -2834,6 +2838,7 @@ fn specQual(p: *Parser) Error!?QualType {
28342838/// : keyword_enum IDENTIFIER? (: typeName)? { enumerator (',' enumerator)? ',') }
28352839/// | keyword_enum IDENTIFIER (: typeName)?
28362840fn enumSpec(p: *Parser) Error!QualType {
2841 const gpa = p.comp.gpa;
28372842 const enum_tok = p.tok_i;
28382843 p.tok_i += 1;
28392844 const attr_buf_top = p.attr_buf.len;
......@@ -2864,7 +2869,7 @@ fn enumSpec(p: *Parser) Error!QualType {
28642869 break :fixed fixed;
28652870 } else null;
28662871
2867 const reserved_index = try p.tree.nodes.addOne(p.gpa);
2872 const reserved_index = try p.tree.nodes.addOne(gpa);
28682873
28692874 const l_brace = p.eatToken(.l_brace) orelse {
28702875 const ident = maybe_ident orelse {
......@@ -2879,7 +2884,7 @@ fn enumSpec(p: *Parser) Error!QualType {
28792884 try p.checkEnumFixedTy(fixed_qt, ident, prev);
28802885 return prev.qt;
28812886 } else {
2882 const enum_qt = try p.comp.type_store.put(p.gpa, .{ .@"enum" = .{
2887 const enum_qt = try p.comp.type_store.put(gpa, .{ .@"enum" = .{
28832888 .name = interned_name,
28842889 .tag = fixed_qt,
28852890 .fixed = fixed_qt != null,
......@@ -2889,7 +2894,7 @@ fn enumSpec(p: *Parser) Error!QualType {
28892894 } });
28902895
28912896 const attributed_qt = try Attribute.applyTypeAttributes(p, enum_qt, attr_buf_top, null);
2892 try p.syms.define(p.gpa, .{
2897 try p.syms.define(gpa, .{
28932898 .kind = .@"enum",
28942899 .name = interned_name,
28952900 .tok = ident,
......@@ -2897,7 +2902,7 @@ fn enumSpec(p: *Parser) Error!QualType {
28972902 .val = .{},
28982903 });
28992904
2900 try p.decl_buf.append(try p.addNode(.{ .enum_forward_decl = .{
2905 try p.decl_buf.append(gpa, try p.addNode(.{ .enum_forward_decl = .{
29012906 .name_or_kind_tok = ident,
29022907 .container_qt = attributed_qt,
29032908 .definition = null,
......@@ -2940,12 +2945,12 @@ fn enumSpec(p: *Parser) Error!QualType {
29402945 .fixed = fixed_qt != null,
29412946 .fields = &.{},
29422947 };
2943 const enum_qt = try p.comp.type_store.put(p.gpa, .{ .@"enum" = enum_ty });
2948 const enum_qt = try p.comp.type_store.put(gpa, .{ .@"enum" = enum_ty });
29442949 break :blk .{ enum_ty, enum_qt };
29452950 };
29462951
29472952 // reserve space for this enum
2948 try p.decl_buf.append(@enumFromInt(reserved_index));
2953 try p.decl_buf.append(gpa, @enumFromInt(reserved_index));
29492954 const decl_buf_top = p.decl_buf.items.len;
29502955 const list_buf_top = p.list_buf.items.len;
29512956 const enum_buf_top = p.enum_buf.items.len;
......@@ -2958,8 +2963,8 @@ fn enumSpec(p: *Parser) Error!QualType {
29582963
29592964 var e = Enumerator.init(fixed_qt);
29602965 while (try p.enumerator(&e)) |field_and_node| {
2961 try p.enum_buf.append(field_and_node.field);
2962 try p.list_buf.append(field_and_node.node);
2966 try p.enum_buf.append(gpa, field_and_node.field);
2967 try p.list_buf.append(gpa, field_and_node.node);
29632968 if (p.eatToken(.comma) == null) break;
29642969 }
29652970
......@@ -2996,7 +3001,7 @@ fn enumSpec(p: *Parser) Error!QualType {
29963001
29973002 const symbol = p.syms.getPtr(field.name, .vars);
29983003 _ = try symbol.val.intCast(dest_ty, p.comp);
2999 try p.tree.value_map.put(p.gpa, field_node, symbol.val);
3004 try p.tree.value_map.put(gpa, field_node, symbol.val);
30003005
30013006 symbol.qt = dest_ty;
30023007 field.qt = dest_ty;
......@@ -3022,12 +3027,12 @@ fn enumSpec(p: *Parser) Error!QualType {
30223027 enum_ty.decl_node = @enumFromInt(reserved_index);
30233028 const base_type = attributed_qt.base(p.comp);
30243029 std.debug.assert(base_type.type.@"enum".name == enum_ty.name);
3025 try p.comp.type_store.set(p.gpa, .{ .@"enum" = enum_ty }, @intFromEnum(base_type.qt._index));
3030 try p.comp.type_store.set(gpa, .{ .@"enum" = enum_ty }, @intFromEnum(base_type.qt._index));
30263031 }
30273032
30283033 // declare a symbol for the type
30293034 if (maybe_ident != null and !defined) {
3030 try p.syms.define(p.gpa, .{
3035 try p.syms.define(gpa, .{
30313036 .kind = .@"enum",
30323037 .name = enum_ty.name,
30333038 .qt = attributed_qt,
......@@ -3231,7 +3236,7 @@ fn enumerator(p: *Parser, e: *Enumerator) Error!?EnumFieldAndNode {
32313236 .init = field_init,
32323237 },
32333238 });
3234 try p.tree.value_map.put(p.gpa, node, e.val);
3239 try p.tree.value_map.put(p.comp.gpa, node, e.val);
32353240
32363241 const interned_name = try p.comp.internString(p.tokSlice(name_tok));
32373242 try p.syms.defineEnumeration(p, interned_name, attributed_qt, name_tok, e.val, node);
......@@ -3297,7 +3302,7 @@ fn typeQual(p: *Parser, b: *TypeStore.Builder, allow_attr: bool) Error!bool {
32973302 } else switch (b.nullability) {
32983303 .none => {
32993304 b.nullability = new;
3300 try p.attr_buf.append(p.gpa, .{
3305 try p.attr_buf.append(p.comp.gpa, .{
33013306 .attr = .{ .tag = .nullability, .args = .{
33023307 .nullability = .{ .kind = switch (tok_id) {
33033308 .keyword_nonnull => .nonnull,
......@@ -3341,7 +3346,7 @@ fn msTypeAttribute(p: *Parser) !bool {
33413346 .keyword_cdecl,
33423347 .keyword_cdecl2,
33433348 => {
3344 try p.attr_buf.append(p.gpa, .{
3349 try p.attr_buf.append(p.comp.gpa, .{
33453350 .attr = .{ .tag = .calling_convention, .args = .{
33463351 .calling_convention = .{ .cc = switch (p.tok_ids[p.tok_i]) {
33473352 .keyword_stdcall,
......@@ -3496,7 +3501,7 @@ fn declarator(
34963501 var builder: TypeStore.Builder = .{ .parser = p };
34973502 _ = try p.typeQual(&builder, true);
34983503
3499 const pointer_qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
3504 const pointer_qt = try p.comp.type_store.put(p.comp.gpa, .{ .pointer = .{
35003505 .child = d.qt,
35013506 .decayed = null,
35023507 } });
......@@ -3611,6 +3616,7 @@ fn directDeclarator(
36113616 base_declarator: *Declarator,
36123617 kind: Declarator.Kind,
36133618) Error!QualType {
3619 const gpa = p.comp.gpa;
36143620 if (p.eatToken(.l_bracket)) |l_bracket| {
36153621 // Check for C23 attribute
36163622 if (p.tok_ids[p.tok_i] == .l_bracket) {
......@@ -3674,7 +3680,7 @@ fn directDeclarator(
36743680 try p.err(base_declarator.name, .variable_len_array_file_scope, .{});
36753681 }
36763682
3677 const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
3683 const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
36783684 .elem = outer,
36793685 .len = .{ .variable = size.node },
36803686 } });
......@@ -3690,7 +3696,7 @@ fn directDeclarator(
36903696 }
36913697
36923698 const len = size.val.toInt(u64, p.comp) orelse std.math.maxInt(u64);
3693 const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
3699 const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
36943700 .elem = outer,
36953701 .len = if (static != null)
36963702 .{ .static = len }
......@@ -3700,13 +3706,13 @@ fn directDeclarator(
37003706 return builder.finishQuals(array_qt);
37013707 }
37023708 } else if (star) |_| {
3703 const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
3709 const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
37043710 .elem = outer,
37053711 .len = .unspecified_variable,
37063712 } });
37073713 return builder.finishQuals(array_qt);
37083714 } else {
3709 const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
3715 const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
37103716 .elem = outer,
37113717 .len = .incomplete,
37123718 } });
......@@ -3729,7 +3735,7 @@ fn directDeclarator(
37293735 // Set after call to `directDeclarator` since we will return
37303736 // a function type from here.
37313737 base_declarator.declarator_type = .func;
3732 return p.comp.type_store.put(p.gpa, .{ .func = func_ty });
3738 return p.comp.type_store.put(gpa, .{ .func = func_ty });
37333739 }
37343740
37353741 // Set here so the call to directDeclarator for the return type
......@@ -3756,7 +3762,7 @@ fn directDeclarator(
37563762 const name_tok = try p.expectIdentifier();
37573763 const interned_name = try p.comp.internString(p.tokSlice(name_tok));
37583764 try p.syms.defineParam(p, interned_name, undefined, name_tok, null);
3759 try p.param_buf.append(.{
3765 try p.param_buf.append(gpa, .{
37603766 .name = interned_name,
37613767 .name_tok = name_tok,
37623768 .qt = .int,
......@@ -3776,7 +3782,7 @@ fn directDeclarator(
37763782 // a function type from here.
37773783 base_declarator.declarator_type = .func;
37783784
3779 return p.comp.type_store.put(p.gpa, .{ .func = func_ty });
3785 return p.comp.type_store.put(gpa, .{ .func = func_ty });
37803786 } else return base_declarator.qt;
37813787}
37823788
......@@ -3789,6 +3795,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param {
37893795
37903796 // Clearing the param buf is handled in directDeclarator.
37913797 const param_buf_top = p.param_buf.items.len;
3798 const gpa = p.comp.gpa;
37923799
37933800 while (true) {
37943801 const attr_buf_top = p.attr_buf.len;
......@@ -3802,7 +3809,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param {
38023809 const identifier = try p.expectIdentifier();
38033810 try p.err(identifier, .unknown_type_name, .{p.tokSlice(identifier)});
38043811
3805 try p.param_buf.append(.{
3812 try p.param_buf.append(gpa, .{
38063813 .name = try p.comp.internString(p.tokSlice(identifier)),
38073814 .name_tok = identifier,
38083815 .qt = .int,
......@@ -3882,7 +3889,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param {
38823889 try p.syms.defineParam(p, interned_name, param_qt, name_tok, node);
38833890 }
38843891
3885 try p.param_buf.append(.{
3892 try p.param_buf.append(gpa, .{
38863893 .name = interned_name,
38873894 .name_tok = if (name_tok == 0) first_tok else name_tok,
38883895 .qt = param_qt,
......@@ -3932,7 +3939,7 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result {
39323939 }
39333940
39343941 var il: InitList = .{};
3935 defer il.deinit(p.gpa);
3942 defer il.deinit(p.comp.gpa);
39363943
39373944 try p.initializerItem(&il, final_init_qt, l_brace);
39383945
......@@ -3944,10 +3951,11 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result {
39443951 };
39453952}
39463953
3947const IndexList = std.ArrayListUnmanaged(u64);
3954const IndexList = std.ArrayList(u64);
39483955
39493956/// initializerItems : designation? initializer (',' designation? initializer)* ','?
39503957fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenIndex) Error!void {
3958 const gpa = p.comp.gpa;
39513959 const is_scalar = !init_qt.isInvalid() and init_qt.scalarKind(p.comp) != .none;
39523960
39533961 if (p.eatToken(.r_brace)) |_| {
......@@ -3962,7 +3970,7 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI
39623970 }
39633971
39643972 var index_list: IndexList = .empty;
3965 defer index_list.deinit(p.gpa);
3973 defer index_list.deinit(gpa);
39663974
39673975 var seen_any = false;
39683976 var warned_excess = init_qt.isInvalid();
......@@ -3980,14 +3988,14 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI
39803988 if (item.il.tok != 0 and !init_qt.isInvalid()) {
39813989 try p.err(first_tok, .initializer_overrides, .{});
39823990 try p.err(item.il.tok, .previous_initializer, .{});
3983 item.il.deinit(p.gpa);
3991 item.il.deinit(gpa);
39843992 item.il.* = .{};
39853993 }
39863994 try p.initializerItem(item.il, item.qt, inner_l_brace);
39873995 } else {
39883996 // discard further values
39893997 var tmp_il: InitList = .{};
3990 defer tmp_il.deinit(p.gpa);
3998 defer tmp_il.deinit(gpa);
39913999 try p.initializerItem(&tmp_il, .invalid, inner_l_brace);
39924000 if (!warned_excess) try p.err(first_tok, switch (init_qt.base(p.comp).type) {
39934001 .array => if (il.node != .null and p.isStringInit(init_qt, il.node.unpack().?))
......@@ -4042,6 +4050,7 @@ fn designation(p: *Parser, il: *InitList, init_qt: QualType, index_list: *IndexL
40424050 .l_bracket, .period => index_list.items.len = 0,
40434051 else => return false,
40444052 }
4053 const gpa = p.comp.gpa;
40454054
40464055 var cur_qt = init_qt;
40474056 var cur_il = il;
......@@ -4074,8 +4083,8 @@ fn designation(p: *Parser, il: *InitList, init_qt: QualType, index_list: *IndexL
40744083 return error.ParsingFailed;
40754084 }
40764085
4077 try index_list.append(p.gpa, index_int);
4078 cur_il = try cur_il.find(p.gpa, index_int);
4086 try index_list.append(gpa, index_int);
4087 cur_il = try cur_il.find(gpa, index_int);
40794088 cur_qt = array_ty.elem;
40804089 } else if (p.eatToken(.period)) |period| {
40814090 const field_tok = try p.expectIdentifier();
......@@ -4094,16 +4103,16 @@ fn designation(p: *Parser, il: *InitList, init_qt: QualType, index_list: *IndexL
40944103 if (field.name_tok == 0) if (field.qt.getRecord(p.comp)) |field_record_ty| {
40954104 // Recurse into anonymous field if it has a field by the name.
40964105 if (!field_record_ty.hasField(p.comp, target_name)) continue;
4097 try index_list.append(p.gpa, field_index);
4098 cur_il = try il.find(p.gpa, field_index);
4106 try index_list.append(gpa, field_index);
4107 cur_il = try il.find(gpa, field_index);
40994108 record_ty = field_record_ty;
41004109 field_index = 0;
41014110 continue;
41024111 };
41034112 if (field.name == target_name) {
41044113 cur_qt = field.qt;
4105 try index_list.append(p.gpa, field_index);
4106 cur_il = try cur_il.find(p.gpa, field_index);
4114 try index_list.append(gpa, field_index);
4115 cur_il = try cur_il.find(gpa, field_index);
41074116 break;
41084117 }
41094118 field_index += 1;
......@@ -4132,7 +4141,8 @@ fn findScalarInitializer(
41324141 index_list_top: u32,
41334142) Error!bool {
41344143 if (qt.isInvalid()) return false;
4135 if (index_list.items.len <= index_list_top) try index_list.append(p.gpa, 0);
4144 const gpa = p.comp.gpa;
4145 if (index_list.items.len <= index_list_top) try index_list.append(gpa, 0);
41364146 const index = index_list.items[index_list_top];
41374147
41384148 switch (qt.base(p.comp).type) {
......@@ -4147,7 +4157,7 @@ fn findScalarInitializer(
41474157 return true;
41484158 }
41494159
4150 const elem_il = try il.find(p.gpa, index);
4160 const elem_il = try il.find(gpa, index);
41514161 if (try p.setInitializerIfEqual(elem_il, complex_ty, first_tok, res) or
41524162 try p.findScalarInitializer(
41534163 elem_il,
......@@ -4180,7 +4190,7 @@ fn findScalarInitializer(
41804190 return true;
41814191 }
41824192
4183 const elem_il = try il.find(p.gpa, index);
4193 const elem_il = try il.find(gpa, index);
41844194 if (try p.setInitializerIfEqual(elem_il, vector_ty.elem, first_tok, res) or
41854195 try p.findScalarInitializer(
41864196 elem_il,
......@@ -4229,7 +4239,7 @@ fn findScalarInitializer(
42294239 return true;
42304240 }
42314241
4232 const elem_il = try il.find(p.gpa, index);
4242 const elem_il = try il.find(gpa, index);
42334243 if (try p.setInitializerIfEqual(elem_il, array_ty.elem, first_tok, res) or
42344244 try p.findScalarInitializer(
42354245 elem_il,
......@@ -4262,7 +4272,7 @@ fn findScalarInitializer(
42624272 }
42634273
42644274 const field = struct_ty.fields[@intCast(index)];
4265 const field_il = try il.find(p.gpa, index);
4275 const field_il = try il.find(gpa, index);
42664276 if (try p.setInitializerIfEqual(field_il, field.qt, first_tok, res) or
42674277 try p.findScalarInitializer(
42684278 field_il,
......@@ -4297,7 +4307,7 @@ fn findScalarInitializer(
42974307 }
42984308
42994309 const field = union_ty.fields[@intCast(index)];
4300 const field_il = try il.find(p.gpa, index);
4310 const field_il = try il.find(gpa, index);
43014311 if (try p.setInitializerIfEqual(field_il, field.qt, first_tok, res) or
43024312 try p.findScalarInitializer(
43034313 field_il,
......@@ -4342,7 +4352,8 @@ fn findBracedInitializer(
43424352 if (il.node != .null) return .{ .il = il, .qt = qt };
43434353 return null;
43444354 }
4345 if (index_list.items.len == 0) try index_list.append(p.gpa, 0);
4355 const gpa = p.comp.gpa;
4356 if (index_list.items.len == 0) try index_list.append(gpa, 0);
43464357 const index = index_list.items[0];
43474358
43484359 switch (qt.base(p.comp).type) {
......@@ -4352,7 +4363,7 @@ fn findBracedInitializer(
43524363 if (index < 2) {
43534364 index_list.items[0] = index + 1;
43544365 index_list.items.len = 1;
4355 return .{ .il = try il.find(p.gpa, index), .qt = complex_ty };
4366 return .{ .il = try il.find(gpa, index), .qt = complex_ty };
43564367 }
43574368 },
43584369 .vector => |vector_ty| {
......@@ -4361,7 +4372,7 @@ fn findBracedInitializer(
43614372 if (index < vector_ty.len) {
43624373 index_list.items[0] = index + 1;
43634374 index_list.items.len = 1;
4364 return .{ .il = try il.find(p.gpa, index), .qt = vector_ty.elem };
4375 return .{ .il = try il.find(gpa, index), .qt = vector_ty.elem };
43654376 }
43664377 },
43674378 .array => |array_ty| {
......@@ -4374,7 +4385,7 @@ fn findBracedInitializer(
43744385 if (index < max_len) {
43754386 index_list.items[0] = index + 1;
43764387 index_list.items.len = 1;
4377 return .{ .il = try il.find(p.gpa, index), .qt = array_ty.elem };
4388 return .{ .il = try il.find(gpa, index), .qt = array_ty.elem };
43784389 }
43794390 },
43804391 .@"struct" => |struct_ty| {
......@@ -4384,7 +4395,7 @@ fn findBracedInitializer(
43844395 index_list.items[0] = index + 1;
43854396 index_list.items.len = 1;
43864397 const field_qt = struct_ty.fields[@intCast(index)].qt;
4387 return .{ .il = try il.find(p.gpa, index), .qt = field_qt };
4398 return .{ .il = try il.find(gpa, index), .qt = field_qt };
43884399 }
43894400 },
43904401 .@"union" => |union_ty| {
......@@ -4395,7 +4406,7 @@ fn findBracedInitializer(
43954406 index_list.items[0] = index + 1;
43964407 index_list.items.len = 1;
43974408 const field_qt = union_ty.fields[@intCast(index)].qt;
4398 return .{ .il = try il.find(p.gpa, index), .qt = field_qt };
4409 return .{ .il = try il.find(gpa, index), .qt = field_qt };
43994410 }
44004411 },
44014412 else => {
......@@ -4495,6 +4506,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
44954506
44964507 if (il.node.unpack()) |some| return some;
44974508
4509 const gpa = p.comp.gpa;
44984510 switch (init_qt.base(p.comp).type) {
44994511 .complex => |complex_ty| {
45004512 if (il.list.items.len == 0) {
......@@ -4535,7 +4547,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
45354547 128 => .{ .complex = .{ .cf128 = .{ first_val.toFloat(f128, p.comp), second_val.toFloat(f128, p.comp) } } },
45364548 else => unreachable,
45374549 });
4538 try p.tree.value_map.put(p.gpa, node, complex_val);
4550 try p.tree.value_map.put(gpa, node, complex_val);
45394551 return node;
45404552 },
45414553 .vector => |vector_ty| {
......@@ -4555,12 +4567,12 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
45554567 .qt = elem_ty,
45564568 },
45574569 });
4558 try p.list_buf.append(elem);
4570 try p.list_buf.append(gpa, elem);
45594571 }
45604572 start = init.index + 1;
45614573
45624574 const elem = try p.convertInitList(init.list, elem_ty);
4563 try p.list_buf.append(elem);
4575 try p.list_buf.append(gpa, elem);
45644576 }
45654577
45664578 if (start < max_len) {
......@@ -4571,7 +4583,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
45714583 .qt = elem_ty,
45724584 },
45734585 });
4574 try p.list_buf.append(elem);
4586 try p.list_buf.append(gpa, elem);
45754587 }
45764588
45774589 return p.addNode(.{ .array_init_expr = .{
......@@ -4605,12 +4617,12 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
46054617 .qt = elem_ty,
46064618 },
46074619 });
4608 try p.list_buf.append(elem);
4620 try p.list_buf.append(gpa, elem);
46094621 }
46104622 start = init.index + 1;
46114623
46124624 const elem = try p.convertInitList(init.list, elem_ty);
4613 try p.list_buf.append(elem);
4625 try p.list_buf.append(gpa, elem);
46144626 }
46154627
46164628 const max_elems = p.comp.maxArrayBytes() / (@max(1, elem_ty.sizeofOrNull(p.comp) orelse 1));
......@@ -4621,7 +4633,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
46214633
46224634 var arr_init_qt = init_qt;
46234635 if (array_ty.len == .incomplete) {
4624 arr_init_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
4636 arr_init_qt = try p.comp.type_store.put(gpa, .{ .array = .{
46254637 .elem = array_ty.elem,
46264638 .len = .{ .fixed = start },
46274639 } });
......@@ -4633,7 +4645,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
46334645 .qt = elem_ty,
46344646 },
46354647 });
4636 try p.list_buf.append(elem);
4648 try p.list_buf.append(gpa, elem);
46374649 }
46384650
46394651 return p.addNode(.{ .array_init_expr = .{
......@@ -4651,7 +4663,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
46514663 for (struct_ty.fields, 0..) |field, i| {
46524664 if (init_index < il.list.items.len and il.list.items[init_index].index == i) {
46534665 const item = try p.convertInitList(il.list.items[init_index].list, field.qt);
4654 try p.list_buf.append(item);
4666 try p.list_buf.append(gpa, item);
46554667 init_index += 1;
46564668 } else {
46574669 const item = try p.addNode(.{
......@@ -4660,7 +4672,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
46604672 .qt = field.qt,
46614673 },
46624674 });
4663 try p.list_buf.append(item);
4675 try p.list_buf.append(gpa, item);
46644676 }
46654677 }
46664678
......@@ -4706,19 +4718,20 @@ fn msvcAsmStmt(p: *Parser) Error!?Node.Index {
47064718}
47074719
47084720/// asmOperand : ('[' IDENTIFIER ']')? asmStr '(' expr ')'
4709fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void {
4721fn asmOperand(p: *Parser, names: *std.ArrayList(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void {
4722 const gpa = p.comp.gpa;
47104723 if (p.eatToken(.l_bracket)) |l_bracket| {
47114724 const ident = (try p.eatIdentifier()) orelse {
47124725 try p.err(p.tok_i, .expected_identifier, .{});
47134726 return error.ParsingFailed;
47144727 };
4715 try names.append(ident);
4728 try names.append(gpa, ident);
47164729 try p.expectClosing(l_bracket, .r_bracket);
47174730 } else {
4718 try names.append(null);
4731 try names.append(gpa, null);
47194732 }
47204733 const constraint = try p.asmStr();
4721 try constraints.append(constraint.node);
4734 try constraints.append(gpa, constraint.node);
47224735
47234736 const l_paren = p.eatToken(.l_paren) orelse {
47244737 try p.err(p.tok_i, .expected_token, .{ p.tok_ids[p.tok_i], .l_paren });
......@@ -4727,7 +4740,7 @@ fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constrain
47274740 const maybe_res = try p.expr();
47284741 try p.expectClosing(l_paren, .r_paren);
47294742 const res = try p.expectResult(maybe_res);
4730 try exprs.append(res.node);
4743 try exprs.append(gpa, res.node);
47314744}
47324745
47334746/// gnuAsmStmt
......@@ -4737,6 +4750,7 @@ fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constrain
47374750/// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)*
47384751/// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)* : IDENTIFIER (',' IDENTIFIER)*
47394752fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex, l_paren: TokenIndex) Error!Node.Index {
4753 const gpa = p.comp.gpa;
47404754 const asm_str = try p.asmStr();
47414755 try p.checkAsmStr(asm_str.val, l_paren);
47424756
......@@ -4752,18 +4766,22 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
47524766 const expected_items = 8; // arbitrarily chosen, most assembly will have fewer than 8 inputs/outputs/constraints/names
47534767 const bytes_needed = expected_items * @sizeOf(?TokenIndex) + expected_items * 3 * @sizeOf(Node.Index);
47544768
4755 var stack_fallback = std.heap.stackFallback(bytes_needed, p.gpa);
4769 var stack_fallback = std.heap.stackFallback(bytes_needed, gpa);
47564770 const allocator = stack_fallback.get();
47574771
47584772 // TODO: Consider using a TokenIndex of 0 instead of null if we need to store the names in the tree
4759 var names = std.array_list.Managed(?TokenIndex).initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
4760 defer names.deinit();
4761 var constraints = NodeList.initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
4762 defer constraints.deinit();
4763 var exprs = NodeList.initCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
4764 defer exprs.deinit();
4765 var clobbers = NodeList.initCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
4766 defer clobbers.deinit();
4773 var names: std.ArrayList(?TokenIndex) = .empty;
4774 defer names.deinit(allocator);
4775 names.ensureUnusedCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
4776 var constraints: NodeList = .empty;
4777 defer constraints.deinit(allocator);
4778 constraints.ensureUnusedCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
4779 var exprs: NodeList = .empty;
4780 defer exprs.deinit(allocator);
4781 exprs.ensureUnusedCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
4782 var clobbers: NodeList = .empty;
4783 defer clobbers.deinit(allocator);
4784 clobbers.ensureUnusedCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
47674785
47684786 // Outputs
47694787 var ate_extra_colon = false;
......@@ -4813,7 +4831,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
48134831 if (!ate_extra_colon and p.tok_ids[p.tok_i].isStringLiteral()) {
48144832 while (true) {
48154833 const clobber = try p.asmStr();
4816 try clobbers.append(clobber.node);
4834 try clobbers.append(allocator, clobber.node);
48174835 if (p.eatToken(.comma) == null) break;
48184836 }
48194837 }
......@@ -4837,10 +4855,10 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
48374855 };
48384856 const ident_str = p.tokSlice(ident);
48394857 const label = p.findLabel(ident_str) orelse blk: {
4840 try p.labels.append(.{ .unresolved_goto = ident });
4858 try p.labels.append(gpa, .{ .unresolved_goto = ident });
48414859 break :blk ident;
48424860 };
4843 try names.append(ident);
4861 try names.append(allocator, ident);
48444862
48454863 const label_addr_node = try p.addNode(.{
48464864 .addr_of_label = .{
......@@ -4848,7 +4866,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
48484866 .qt = .void_pointer,
48494867 },
48504868 });
4851 try exprs.append(label_addr_node);
4869 try exprs.append(allocator, label_addr_node);
48524870
48534871 num_labels += 1;
48544872 if (p.eatToken(.comma) == null) break;
......@@ -4922,7 +4940,7 @@ fn assembly(p: *Parser, kind: enum { global, decl_label, stmt }) Error!?Node.Ind
49224940 const str = try p.removeNull(asm_str.val);
49234941
49244942 const attr = Attribute{ .tag = .asm_label, .args = .{ .asm_label = .{ .name = str } }, .syntax = .keyword };
4925 try p.attr_buf.append(p.gpa, .{ .attr = attr, .tok = asm_tok });
4943 try p.attr_buf.append(p.comp.gpa, .{ .attr = attr, .tok = asm_tok });
49264944 },
49274945 .global => {
49284946 const asm_str = try p.asmStr();
......@@ -4985,6 +5003,7 @@ fn asmStr(p: *Parser) Error!Result {
49855003fn stmt(p: *Parser) Error!Node.Index {
49865004 if (try p.labeledStmt()) |some| return some;
49875005 if (try p.compoundStmt(false, null)) |some| return some;
5006 const gpa = p.comp.gpa;
49885007 if (p.eatToken(.keyword_if)) |kw_if| {
49895008 const l_paren = try p.expectToken(.l_paren);
49905009
......@@ -5035,14 +5054,13 @@ fn stmt(p: *Parser) Error!Node.Index {
50355054 try p.expectClosing(l_paren, .r_paren);
50365055
50375056 const old_switch = p.@"switch";
5038 var @"switch" = Switch{
5039 .ranges = std.array_list.Managed(Switch.Range).init(p.gpa),
5057 var @"switch": Switch = .{
50405058 .qt = cond.qt,
50415059 .comp = p.comp,
50425060 };
50435061 p.@"switch" = &@"switch";
50445062 defer {
5045 @"switch".ranges.deinit();
5063 @"switch".ranges.deinit(gpa);
50465064 p.@"switch" = old_switch;
50475065 }
50485066
......@@ -5183,7 +5201,7 @@ fn stmt(p: *Parser) Error!Node.Index {
51835201 p.computed_goto_tok = p.computed_goto_tok orelse goto_tok;
51845202
51855203 if (!goto_expr.qt.isInvalid() and !goto_expr.qt.isPointer(p.comp)) {
5186 const result_qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
5204 const result_qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
51875205 .child = .{ .@"const" = true, ._index = .void },
51885206 .decayed = null,
51895207 } });
......@@ -5204,7 +5222,7 @@ fn stmt(p: *Parser) Error!Node.Index {
52045222 const name_tok = try p.expectIdentifier();
52055223 const str = p.tokSlice(name_tok);
52065224 if (p.findLabel(str) == null) {
5207 try p.labels.append(.{ .unresolved_goto = name_tok });
5225 try p.labels.append(gpa, .{ .unresolved_goto = name_tok });
52085226 }
52095227 _ = try p.expectToken(.semicolon);
52105228 return p.addNode(.{ .goto_stmt = .{ .label_tok = name_tok } });
......@@ -5259,7 +5277,7 @@ fn labeledStmt(p: *Parser) Error!?Node.Index {
52595277 try p.err(some, .previous_label, .{str});
52605278 } else {
52615279 p.label_count += 1;
5262 try p.labels.append(.{ .label = name_tok });
5280 try p.labels.append(p.comp.gpa, .{ .label = name_tok });
52635281 var i: usize = 0;
52645282 while (i < p.labels.items.len) {
52655283 if (p.labels.items[i] == .unresolved_goto and
......@@ -5370,6 +5388,7 @@ const StmtExprState = struct {
53705388fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState) Error!?Node.Index {
53715389 const l_brace = p.eatToken(.l_brace) orelse return null;
53725390
5391 const gpa = p.comp.gpa;
53735392 const decl_buf_top = p.decl_buf.items.len;
53745393 defer p.decl_buf.items.len = decl_buf_top;
53755394
......@@ -5406,7 +5425,7 @@ fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState)
54065425 .last_expr_qt = s.qt(&p.tree),
54075426 };
54085427 }
5409 try p.decl_buf.append(s);
5428 try p.decl_buf.append(gpa, s);
54105429
54115430 if (noreturn_index == null and p.nodeIsNoreturn(s) == .yes) {
54125431 noreturn_index = p.tok_i;
......@@ -5456,10 +5475,10 @@ fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState)
54565475 .return_qt = ret_qt,
54575476 .operand = .{ .implicit = return_zero },
54585477 } });
5459 try p.decl_buf.append(implicit_ret);
5478 try p.decl_buf.append(gpa, implicit_ret);
54605479 }
5461 if (p.func.ident) |some| try p.decl_buf.insert(decl_buf_top, some.node);
5462 if (p.func.pretty_ident) |some| try p.decl_buf.insert(decl_buf_top, some.node);
5480 if (p.func.ident) |some| try p.decl_buf.insert(gpa, decl_buf_top, some.node);
5481 if (p.func.pretty_ident) |some| try p.decl_buf.insert(gpa, decl_buf_top, some.node);
54635482 }
54645483
54655484 return try p.addNode(.{ .compound_stmt = .{
......@@ -5988,6 +6007,7 @@ pub const Result = struct {
59886007
59896008 fn adjustCondExprPtrs(a: *Result, tok: TokenIndex, b: *Result, p: *Parser) !bool {
59906009 assert(a.qt.isPointer(p.comp) and b.qt.isPointer(p.comp));
6010 const gpa = p.comp.gpa;
59916011
59926012 const a_elem = a.qt.childType(p.comp);
59936013 const b_elem = b.qt.childType(p.comp);
......@@ -6014,14 +6034,14 @@ pub const Result = struct {
60146034 }
60156035
60166036 if (!adjusted_elem_qt.eqlQualified(a_elem, p.comp)) {
6017 a.qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
6037 a.qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
60186038 .child = adjusted_elem_qt,
60196039 .decayed = null,
60206040 } });
60216041 try a.implicitCast(p, .bitcast, tok);
60226042 }
60236043 if (!adjusted_elem_qt.eqlQualified(b_elem, p.comp)) {
6024 b.qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
6044 b.qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
60256045 .child = adjusted_elem_qt,
60266046 .decayed = null,
60276047 } });
......@@ -6659,7 +6679,7 @@ pub const Result = struct {
66596679 /// Saves value without altering the result.
66606680 fn putValue(res: *const Result, p: *Parser) !void {
66616681 if (res.val.opt_ref == .none or res.val.opt_ref == .null) return;
6662 if (!p.in_macro) try p.tree.value_map.put(p.gpa, res.node, res.val);
6682 if (!p.in_macro) try p.tree.value_map.put(p.comp.gpa, res.node, res.val);
66636683 }
66646684
66656685 fn castType(res: *Result, p: *Parser, dest_qt: QualType, operand_tok: TokenIndex, l_paren: TokenIndex) !void {
......@@ -7085,9 +7105,13 @@ pub const Result = struct {
70857105 return; // ok
70867106 }
70877107 } else {
7088 if (c == .assign and (dest_unqual.is(p.comp, .array) or dest_unqual.is(p.comp, .func))) {
7089 try p.err(tok, .not_assignable, .{});
7090 return;
7108 if (c == .assign) {
7109 const base_type = dest_unqual.base(p.comp);
7110 switch (base_type.type) {
7111 .array => return p.err(tok, .array_not_assignable, .{base_type.qt}),
7112 .func => return p.err(tok, .non_object_not_assignable, .{base_type.qt}),
7113 else => {},
7114 }
70917115 } else if (c == .test_coerce) {
70927116 return error.CoercionFailed;
70937117 }
......@@ -7186,6 +7210,47 @@ fn nonAssignExpr(assign_node: std.meta.Tag(Node)) std.meta.Tag(Node) {
71867210 };
71877211}
71887212
7213fn unwrapNestedOperation(p: *Parser, node_idx: Node.Index) ?Node.DeclRef {
7214 return loop: switch (node_idx.get(&p.tree)) {
7215 inline .array_access_expr,
7216 .member_access_ptr_expr,
7217 .member_access_expr,
7218 => |memb_or_arr_access| continue :loop memb_or_arr_access.base.get(&p.tree),
7219 inline .cast,
7220 .paren_expr,
7221 .pre_inc_expr,
7222 .post_inc_expr,
7223 .pre_dec_expr,
7224 .post_dec_expr,
7225 => |cast_or_unary| continue :loop cast_or_unary.operand.get(&p.tree),
7226 .sub_expr,
7227 .add_expr,
7228 => |bin| continue :loop bin.lhs.get(&p.tree),
7229 .call_expr => |call| continue :loop call.callee.get(&p.tree),
7230 .decl_ref_expr => |decl_ref| decl_ref,
7231 else => null,
7232 };
7233}
7234
7235fn issueDeclaredConstHereNote(p: *Parser, decl_ref: Tree.Node.DeclRef, var_name: []const u8) Compilation.Error!void {
7236 const location = switch (decl_ref.decl.get(&p.tree)) {
7237 .variable => |variable| variable.name_tok,
7238 .param => |param| param.name_tok,
7239 else => return,
7240 };
7241 try p.err(location, .declared_const_here, .{var_name});
7242}
7243
7244fn issueConstAssignmetDiagnostics(p: *Parser, node_idx: Node.Index, tok: TokenIndex) Compilation.Error!void {
7245 if (p.unwrapNestedOperation(node_idx)) |unwrapped| {
7246 const name = p.tokSlice(unwrapped.name_tok);
7247 try p.err(tok, .const_var_assignment, .{ name, unwrapped.qt });
7248 try p.issueDeclaredConstHereNote(unwrapped, name);
7249 } else {
7250 try p.err(tok, .not_assignable, .{});
7251 }
7252}
7253
71897254/// assignExpr
71907255/// : condExpr
71917256/// | unExpr ('=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=') assignExpr
......@@ -7209,7 +7274,7 @@ fn assignExpr(p: *Parser) Error!?Result {
72097274
72107275 var is_const: bool = undefined;
72117276 if (!p.tree.isLvalExtra(lhs.node, &is_const) or is_const) {
7212 try p.err(tok, .not_assignable, .{});
7277 try p.issueConstAssignmetDiagnostics(lhs.node, tok);
72137278 lhs.qt = .invalid;
72147279 }
72157280
......@@ -7702,12 +7767,13 @@ fn shufflevector(p: *Parser, builtin_tok: TokenIndex) Error!Result {
77027767 };
77037768 const negative_one = try Value.intern(p.comp, .{ .int = .{ .i64 = -1 } });
77047769
7770 const gpa = p.comp.gpa;
77057771 const list_buf_top = p.list_buf.items.len;
77067772 defer p.list_buf.items.len = list_buf_top;
77077773 while (p.eatToken(.comma)) |_| {
77087774 const index_tok = p.tok_i;
77097775 const index = try p.integerConstExpr(.gnu_folding_extension);
7710 try p.list_buf.append(index.node);
7776 try p.list_buf.append(gpa, index.node);
77117777 if (index.val.compare(.lt, negative_one, p.comp)) {
77127778 try p.err(index_tok, .shufflevector_negative_index, .{});
77137779 } else if (max_index != null and index.val.compare(.gte, max_index.?, p.comp)) {
......@@ -7727,7 +7793,7 @@ fn shufflevector(p: *Parser, builtin_tok: TokenIndex) Error!Result {
77277793 } else if (p.list_buf.items.len == list_buf_top) {
77287794 res_qt = lhs.qt;
77297795 } else {
7730 res_qt = try p.comp.type_store.put(p.gpa, .{ .vector = .{
7796 res_qt = try p.comp.type_store.put(gpa, .{ .vector = .{
77317797 .elem = lhs.qt.childType(p.comp),
77327798 .len = @intCast(p.list_buf.items.len - list_buf_top),
77337799 } });
......@@ -8086,6 +8152,7 @@ fn computeOffset(p: *Parser, res: Result) !Value {
80868152/// | keyword_alignof '(' typeName ')'
80878153/// | keyword_c23_alignof '(' typeName ')'
80888154fn unExpr(p: *Parser) Error!?Result {
8155 const gpa = p.comp.gpa;
80898156 const tok = p.tok_i;
80908157 switch (p.tok_ids[tok]) {
80918158 .ampersand_ampersand => {
......@@ -8097,7 +8164,7 @@ fn unExpr(p: *Parser) Error!?Result {
80978164
80988165 const str = p.tokSlice(name_tok);
80998166 if (p.findLabel(str) == null) {
8100 try p.labels.append(.{ .unresolved_goto = name_tok });
8167 try p.labels.append(gpa, .{ .unresolved_goto = name_tok });
81018168 }
81028169
81038170 return .{
......@@ -8139,7 +8206,7 @@ fn unExpr(p: *Parser) Error!?Result {
81398206 }
81408207 addr_val = try p.computeOffset(operand);
81418208
8142 operand.qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
8209 operand.qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
81438210 .child = operand.qt,
81448211 .decayed = null,
81458212 } });
......@@ -8845,6 +8912,7 @@ fn checkComplexArg(p: *Parser, builtin_tok: TokenIndex, first_after: TokenIndex,
88458912}
88468913
88478914fn callExpr(p: *Parser, lhs: Result) Error!Result {
8915 const gpa = p.comp.gpa;
88488916 const l_paren = p.tok_i;
88498917 p.tok_i += 1;
88508918
......@@ -8892,7 +8960,7 @@ fn callExpr(p: *Parser, lhs: Result) Error!Result {
88928960
88938961 try call_expr.checkVarArg(p, first_after, param_tok, &arg, arg_count);
88948962 try arg.saveValue(p);
8895 try p.list_buf.append(arg.node);
8963 try p.list_buf.append(gpa, arg.node);
88968964 arg_count += 1;
88978965
88988966 _ = p.eatToken(.comma) orelse {
......@@ -8927,7 +8995,7 @@ fn callExpr(p: *Parser, lhs: Result) Error!Result {
89278995 }
89288996 }
89298997 try arg.saveValue(p);
8930 try p.list_buf.append(arg.node);
8998 try p.list_buf.append(gpa, arg.node);
89318999 arg_count += 1;
89329000
89339001 _ = p.eatToken(.comma) orelse {
......@@ -9024,6 +9092,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
90249092 return grouped_expr;
90259093 }
90269094
9095 const gpa = p.comp.gpa;
90279096 switch (p.tok_ids[p.tok_i]) {
90289097 .identifier, .extended_identifier => {
90299098 const name_tok = try p.expectIdentifier();
......@@ -9134,7 +9203,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
91349203 else
91359204 try p.err(name_tok, .implicit_func_decl, .{name});
91369205
9137 const func_qt = try p.comp.type_store.put(p.gpa, .{ .func = .{
9206 const func_qt = try p.comp.type_store.put(gpa, .{ .func = .{
91389207 .return_type = .int,
91399208 .kind = .old_style,
91409209 .params = &.{},
......@@ -9150,7 +9219,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
91509219 },
91519220 });
91529221
9153 try p.decl_buf.append(node);
9222 try p.decl_buf.append(gpa, node);
91549223 try p.syms.declareSymbol(p, interned_name, func_qt, name_tok, node);
91559224
91569225 return .{
......@@ -9211,8 +9280,11 @@ fn primaryExpr(p: *Parser) Error!?Result {
92119280 const strings_top = p.strings.items.len;
92129281 defer p.strings.items.len = strings_top;
92139282
9214 try p.strings.appendSlice(p.tokSlice(p.func.name));
9215 try p.strings.append(0);
9283 const name = p.tokSlice(p.func.name);
9284 try p.strings.ensureUnusedCapacity(gpa, name.len + 1);
9285
9286 p.strings.appendSliceAssumeCapacity(name);
9287 p.strings.appendAssumeCapacity(0);
92169288 const predef = try p.makePredefinedIdentifier(p.strings.items[strings_top..]);
92179289 ty = predef.qt;
92189290 p.func.ident = predef;
......@@ -9220,7 +9292,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
92209292 const predef = try p.makePredefinedIdentifier("\x00");
92219293 ty = predef.qt;
92229294 p.func.ident = predef;
9223 try p.decl_buf.append(predef.node);
9295 try p.decl_buf.append(gpa, predef.node);
92249296 }
92259297 if (p.func.qt == null) try p.err(p.tok_i, .predefined_top_level, .{});
92269298
......@@ -9241,7 +9313,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
92419313 if (p.func.pretty_ident) |some| {
92429314 qt = some.qt;
92439315 } else if (p.func.qt) |func_qt| {
9244 var sf = std.heap.stackFallback(1024, p.gpa);
9316 var sf = std.heap.stackFallback(1024, gpa);
92459317 var allocating: std.Io.Writer.Allocating = .init(sf.get());
92469318 defer allocating.deinit();
92479319
......@@ -9255,7 +9327,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
92559327 const predef = try p.makePredefinedIdentifier("top level\x00");
92569328 qt = predef.qt;
92579329 p.func.pretty_ident = predef;
9258 try p.decl_buf.append(predef.node);
9330 try p.decl_buf.append(gpa, predef.node);
92599331 }
92609332 if (p.func.qt == null) try p.err(p.tok_i, .predefined_top_level, .{});
92619333 return .{
......@@ -9332,7 +9404,8 @@ fn primaryExpr(p: *Parser) Error!?Result {
93329404}
93339405
93349406fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result {
9335 const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
9407 const gpa = p.comp.gpa;
9408 const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
93369409 .elem = .{ .@"const" = true, ._index = .int_char },
93379410 .len = .{ .fixed = slice.len },
93389411 } });
......@@ -9340,7 +9413,7 @@ fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result {
93409413 const val = try Value.intern(p.comp, .{ .bytes = slice });
93419414
93429415 const str_lit = try p.addNode(.{ .string_literal_expr = .{ .qt = array_qt, .literal_tok = p.tok_i, .kind = .ascii } });
9343 if (!p.in_macro) try p.tree.value_map.put(p.gpa, str_lit, val);
9416 if (!p.in_macro) try p.tree.value_map.put(gpa, str_lit, val);
93449417
93459418 return .{ .qt = array_qt, .node = try p.addNode(.{
93469419 .variable = .{
......@@ -9356,6 +9429,7 @@ fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result {
93569429}
93579430
93589431fn stringLiteral(p: *Parser) Error!Result {
9432 const gpa = p.comp.gpa;
93599433 const string_start = p.tok_i;
93609434 var string_end = p.tok_i;
93619435 var string_kind: text_literal.Kind = .char;
......@@ -9380,7 +9454,7 @@ fn stringLiteral(p: *Parser) Error!Result {
93809454 defer p.strings.items.len = strings_top;
93819455
93829456 const literal_start = mem.alignForward(usize, strings_top, @intFromEnum(char_width));
9383 try p.strings.resize(literal_start);
9457 try p.strings.resize(gpa, literal_start);
93849458
93859459 while (p.tok_i < string_end) : (p.tok_i += 1) {
93869460 const this_kind = text_literal.Kind.classify(p.tok_ids[p.tok_i], .string_literal).?;
......@@ -9395,7 +9469,7 @@ fn stringLiteral(p: *Parser) Error!Result {
93959469 .incorrect_encoding_is_error = count > 1,
93969470 };
93979471
9398 try p.strings.ensureUnusedCapacity((slice.len + 1) * @intFromEnum(char_width)); // +1 for null terminator
9472 try p.strings.ensureUnusedCapacity(gpa, (slice.len + 1) * @intFromEnum(char_width)); // +1 for null terminator
93999473 while (try char_literal_parser.next()) |item| switch (item) {
94009474 .value => |v| {
94019475 switch (char_width) {
......@@ -9443,7 +9517,7 @@ fn stringLiteral(p: *Parser) Error!Result {
94439517 const dest_len = std.mem.alignBackward(usize, capacity_slice.len, 2);
94449518 const dest = std.mem.bytesAsSlice(u16, capacity_slice[0..dest_len]);
94459519 const words_written = std.unicode.utf8ToUtf16Le(dest, view.bytes) catch unreachable;
9446 p.strings.resize(p.strings.items.len + words_written * 2) catch unreachable;
9520 p.strings.resize(gpa, p.strings.items.len + words_written * 2) catch unreachable;
94479521 },
94489522 .@"4" => {
94499523 var it = view.iterator();
......@@ -9465,11 +9539,11 @@ fn stringLiteral(p: *Parser) Error!Result {
94659539 p.comp.interner.strings.items.len,
94669540 string_kind.internalStorageAlignment(p.comp),
94679541 );
9468 try p.comp.interner.strings.resize(p.gpa, interned_align);
9542 try p.comp.interner.strings.resize(gpa, interned_align);
94699543
94709544 const val = try Value.intern(p.comp, .{ .bytes = slice });
94719545
9472 const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
9546 const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
94739547 .elem = string_kind.elementType(p.comp),
94749548 .len = .{ .fixed = @divExact(slice.len, @intFromEnum(char_width)) },
94759549 } });
......@@ -9510,6 +9584,7 @@ fn charLiteral(p: *Parser) Error!?Result {
95109584 if (char_kind == .utf_8) try p.err(p.tok_i, .u8_char_lit, .{});
95119585 var val: u32 = 0;
95129586
9587 const gpa = p.comp.gpa;
95139588 const slice = char_kind.contentSlice(p.tokSlice(p.tok_i));
95149589
95159590 var is_multichar = false;
......@@ -9528,21 +9603,24 @@ fn charLiteral(p: *Parser) Error!?Result {
95289603 };
95299604
95309605 const max_chars_expected = 4;
9531 var stack_fallback = std.heap.stackFallback(max_chars_expected * @sizeOf(u32), p.comp.gpa);
9532 var chars = std.array_list.Managed(u32).initCapacity(stack_fallback.get(), max_chars_expected) catch unreachable; // stack allocation already succeeded
9533 defer chars.deinit();
9606 var sf = std.heap.stackFallback(max_chars_expected * @sizeOf(u32), gpa);
9607 const allocator = sf.get();
9608 var chars: std.ArrayList(u32) = .empty;
9609 defer chars.deinit(allocator);
9610
9611 chars.ensureUnusedCapacity(allocator, max_chars_expected) catch unreachable; // stack allocation already succeeded
95349612
95359613 while (try char_literal_parser.next()) |item| switch (item) {
9536 .value => |v| try chars.append(v),
9537 .codepoint => |c| try chars.append(c),
9614 .value => |v| try chars.append(allocator, v),
9615 .codepoint => |c| try chars.append(allocator, c),
95389616 .improperly_encoded => |s| {
9539 try chars.ensureUnusedCapacity(s.len);
9617 try chars.ensureUnusedCapacity(allocator, s.len);
95409618 for (s) |c| chars.appendAssumeCapacity(c);
95419619 },
95429620 .utf8_text => |view| {
95439621 var it = view.iterator();
95449622 var max_codepoint_seen: u21 = 0;
9545 try chars.ensureUnusedCapacity(view.bytes.len);
9623 try chars.ensureUnusedCapacity(allocator, view.bytes.len);
95469624 while (it.nextCodepoint()) |c| {
95479625 max_codepoint_seen = @max(max_codepoint_seen, c);
95489626 chars.appendAssumeCapacity(c);
......@@ -9603,7 +9681,7 @@ fn charLiteral(p: *Parser) Error!?Result {
96039681 _ = try value.intCast(.char, p.comp);
96049682 }
96059683
9606 const res = Result{
9684 const res: Result = .{
96079685 .qt = if (p.in_macro) macro_qt else char_literal_qt,
96089686 .val = value,
96099687 .node = try p.addNode(.{ .char_literal = .{
......@@ -9618,7 +9696,7 @@ fn charLiteral(p: *Parser) Error!?Result {
96189696 },
96199697 } }),
96209698 };
9621 if (!p.in_macro) try p.tree.value_map.put(p.gpa, res.node, res.val);
9699 if (!p.in_macro) try p.tree.value_map.put(gpa, res.node, res.val);
96229700 return res;
96239701}
96249702
......@@ -9633,7 +9711,7 @@ fn parseFloat(p: *Parser, buf: []const u8, suffix: NumberSuffix, tok_i: TokenInd
96339711 else => unreachable,
96349712 };
96359713 const val = try Value.intern(p.comp, key: {
9636 try p.strings.ensureUnusedCapacity(buf.len);
9714 try p.strings.ensureUnusedCapacity(p.comp.gpa, buf.len);
96379715
96389716 const strings_top = p.strings.items.len;
96399717 defer p.strings.items.len = strings_top;
......@@ -9821,14 +9899,15 @@ fn parseInt(p: *Parser, prefix: NumberPrefix, buf: []const u8, suffix: NumberSuf
98219899}
98229900
98239901fn bitInt(p: *Parser, base: u8, buf: []const u8, suffix: NumberSuffix, tok_i: TokenIndex) Error!Result {
9902 const gpa = p.comp.gpa;
98249903 try p.err(tok_i, .pre_c23_compat, .{"'_BitInt' suffix for literals"});
98259904 try p.err(tok_i, .bitint_suffix, .{});
98269905
9827 var managed = try big.int.Managed.init(p.gpa);
9906 var managed = try big.int.Managed.init(gpa);
98289907 defer managed.deinit();
98299908
98309909 {
9831 try p.strings.ensureUnusedCapacity(buf.len);
9910 try p.strings.ensureUnusedCapacity(gpa, buf.len);
98329911
98339912 const strings_top = p.strings.items.len;
98349913 defer p.strings.items.len = strings_top;
......@@ -9853,7 +9932,7 @@ fn bitInt(p: *Parser, base: u8, buf: []const u8, suffix: NumberSuffix, tok_i: To
98539932 break :blk @intCast(bits_needed);
98549933 };
98559934
9856 const int_qt = try p.comp.type_store.put(p.gpa, .{ .bit_int = .{
9935 const int_qt = try p.comp.type_store.put(gpa, .{ .bit_int = .{
98579936 .bits = bits_needed,
98589937 .signedness = suffix.signedness(),
98599938 } });
......@@ -9986,6 +10065,7 @@ fn parseNoEval(p: *Parser, comptime func: fn (*Parser) Error!?Result) Error!Resu
998610065/// : typeName ':' assignExpr
998710066/// | keyword_default ':' assignExpr
998810067fn genericSelection(p: *Parser) Error!?Result {
10068 const gpa = p.comp.gpa;
998910069 const kw_generic = p.tok_i;
999010070 p.tok_i += 1;
999110071 const l_paren = try p.expectToken(.l_paren);
......@@ -10030,8 +10110,8 @@ fn genericSelection(p: *Parser) Error!?Result {
1003010110 .expr = res.node,
1003110111 },
1003210112 });
10033 try p.list_buf.append(res.node);
10034 try p.param_buf.append(.{ .name = undefined, .qt = qt, .name_tok = start, .node = .null });
10113 try p.list_buf.append(gpa, res.node);
10114 try p.param_buf.append(gpa, .{ .name = undefined, .qt = qt, .name_tok = start, .node = .null });
1003510115
1003610116 if (qt.eql(controlling_qt, p.comp)) {
1003710117 if (chosen_tok == null) {
......@@ -10083,7 +10163,7 @@ fn genericSelection(p: *Parser) Error!?Result {
1008310163 return error.ParsingFailed;
1008410164 }
1008510165 } else if (default_tok != null) {
10086 try p.list_buf.append(default.node);
10166 try p.list_buf.append(gpa, default.node);
1008710167 }
1008810168
1008910169 for (p.list_buf.items[list_buf_top..], list_buf_top..) |item, i| {
lib/compiler/aro/aro/Parser/Diagnostic.zig+27
......@@ -2304,6 +2304,7 @@ pub const overflow_result_requires_ptr: Diagnostic = .{
23042304pub const attribute_todo: Diagnostic = .{
23052305 .fmt = "TODO: implement '{s}' attribute for {s}",
23062306 .kind = .warning,
2307 .opt = .@"attribute-todo",
23072308};
23082309
23092310pub const invalid_type_underlying_enum: Diagnostic = .{
......@@ -2395,3 +2396,29 @@ pub const invalid_nullability: Diagnostic = .{
23952396 .fmt = "nullability specifier cannot be applied to non-pointer type {qt}",
23962397 .kind = .@"error",
23972398};
2399
2400pub const array_not_assignable: Diagnostic = .{
2401 .fmt = "array type {qt} is not assignable",
2402 .kind = .@"error",
2403};
2404
2405pub const non_object_not_assignable: Diagnostic = .{
2406 .fmt = "non-object type {qt} is not assignable",
2407 .kind = .@"error",
2408};
2409
2410pub const const_var_assignment: Diagnostic = .{
2411 .fmt = "cannot assign to variable '{s}' with const-qualified type {qt}",
2412 .kind = .@"error",
2413};
2414
2415pub const declared_const_here: Diagnostic = .{
2416 .fmt = "variable '{s}' declared const here",
2417 .kind = .note,
2418};
2419
2420pub const nonnull_not_applicable: Diagnostic = .{
2421 .fmt = "'nonnull' attribute only applies to functions, methods, and parameters",
2422 .kind = .warning,
2423 .opt = .@"ignored-attributes",
2424};
lib/compiler/aro/aro/Pragma.zig+2-2
......@@ -60,7 +60,7 @@ pub fn pasteTokens(pp: *Preprocessor, start_idx: TokenIndex) ![]const u8 {
6060 .string_literal => {
6161 if (rparen_count != 0) return error.ExpectedStringLiteral;
6262 const str = pp.expandedSlice(tok);
63 try pp.char_buf.appendSlice(str[1 .. str.len - 1]);
63 try pp.char_buf.appendSlice(pp.comp.gpa, str[1 .. str.len - 1]);
6464 },
6565 else => return error.ExpectedStringLiteral,
6666 }
......@@ -194,7 +194,7 @@ pub const Diagnostic = struct {
194194};
195195
196196pub fn err(pp: *Preprocessor, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) Compilation.Error!void {
197 var sf = std.heap.stackFallback(1024, pp.gpa);
197 var sf = std.heap.stackFallback(1024, pp.comp.gpa);
198198 var allocating: std.Io.Writer.Allocating = .init(sf.get());
199199 defer allocating.deinit();
200200
lib/compiler/aro/aro/Preprocessor.zig+275-245
......@@ -21,7 +21,7 @@ const Token = Tree.Token;
2121const TokenWithExpansionLocs = Tree.TokenWithExpansionLocs;
2222
2323const DefineMap = std.StringArrayHashMapUnmanaged(Macro);
24const RawTokenList = std.array_list.Managed(RawToken);
24const RawTokenList = std.ArrayList(RawToken);
2525const max_include_depth = 200;
2626
2727/// Errors that can be returned when expanding a macro.
......@@ -115,16 +115,15 @@ const TokenState = struct {
115115
116116comp: *Compilation,
117117diagnostics: *Diagnostics,
118gpa: mem.Allocator,
119118
120119arena: std.heap.ArenaAllocator,
121defines: DefineMap = .{},
120defines: DefineMap = .empty,
122121/// Do not directly mutate this; use addToken / addTokenAssumeCapacity / ensureTotalTokenCapacity / ensureUnusedTokenCapacity
123tokens: Token.List = .{},
122tokens: Token.List = .empty,
124123/// Do not directly mutate this; must be kept in sync with `tokens`
125expansion_entries: std.MultiArrayList(ExpansionEntry) = .{},
126token_buf: RawTokenList,
127char_buf: std.array_list.Managed(u8),
124expansion_entries: std.MultiArrayList(ExpansionEntry) = .empty,
125token_buf: RawTokenList = .empty,
126char_buf: std.ArrayList(u8) = .empty,
128127/// Counter that is incremented each time preprocess() is called
129128/// Can be used to distinguish multiple preprocessings of the same file
130129preprocess_count: u32 = 0,
......@@ -133,9 +132,9 @@ add_expansion_nl: u32 = 0,
133132include_depth: u8 = 0,
134133counter: u32 = 0,
135134expansion_source_loc: Source.Location = undefined,
136poisoned_identifiers: std.StringHashMap(void),
135poisoned_identifiers: std.StringHashMapUnmanaged(void) = .empty,
137136/// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any
138include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},
137include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty,
139138
140139/// Store `keyword_define` and `keyword_undef` tokens.
141140/// Used to implement preprocessor debug dump options
......@@ -143,7 +142,7 @@ include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},
143142store_macro_tokens: bool = false,
144143
145144/// Memory is retained to avoid allocation on every single token.
146top_expansion_buf: ExpandBuf,
145top_expansion_buf: ExpandBuf = .empty,
147146
148147/// Dump current state to stderr.
149148verbose: bool = false,
......@@ -156,7 +155,7 @@ hideset: Hideset,
156155
157156/// Epoch used for __DATE__, __TIME__, and possibly __TIMESTAMP__
158157source_epoch: SourceEpoch,
159m_times: std.AutoHashMapUnmanaged(Source.Id, u64) = .{},
158m_times: std.AutoHashMapUnmanaged(Source.Id, u64) = .empty,
160159
161160/// The dependency file tracking all includes and embeds.
162161dep_file: ?*DepFile = null,
......@@ -176,12 +175,7 @@ pub fn init(comp: *Compilation, source_epoch: SourceEpoch) Preprocessor {
176175 const pp: Preprocessor = .{
177176 .comp = comp,
178177 .diagnostics = comp.diagnostics,
179 .gpa = comp.gpa,
180 .arena = std.heap.ArenaAllocator.init(comp.gpa),
181 .token_buf = RawTokenList.init(comp.gpa),
182 .char_buf = std.array_list.Managed(u8).init(comp.gpa),
183 .poisoned_identifiers = std.StringHashMap(void).init(comp.gpa),
184 .top_expansion_buf = ExpandBuf.init(comp.gpa),
178 .arena = .init(comp.gpa),
185179 .hideset = .{ .comp = comp },
186180 .source_epoch = source_epoch,
187181 };
......@@ -207,7 +201,7 @@ pub fn initDefault(comp: *Compilation) !Preprocessor {
207201
208202// `param_tok_id` is comptime so that the generated `tokens` list is unique for every macro.
209203fn addBuiltinMacro(pp: *Preprocessor, name: []const u8, is_func: bool, comptime param_tok_id: Token.Id) !void {
210 try pp.defines.putNoClobber(pp.gpa, name, .{
204 try pp.defines.putNoClobber(pp.comp.gpa, name, .{
211205 .params = &[1][]const u8{"X"},
212206 .tokens = &[1]RawToken{.{
213207 .id = param_tok_id,
......@@ -248,30 +242,33 @@ pub fn addBuiltinMacros(pp: *Preprocessor) !void {
248242}
249243
250244pub fn deinit(pp: *Preprocessor) void {
251 pp.defines.deinit(pp.gpa);
252 pp.tokens.deinit(pp.gpa);
245 const gpa = pp.comp.gpa;
246 pp.defines.deinit(gpa);
247 pp.tokens.deinit(gpa);
253248 pp.arena.deinit();
254 pp.token_buf.deinit();
255 pp.char_buf.deinit();
256 pp.poisoned_identifiers.deinit();
257 pp.include_guards.deinit(pp.gpa);
258 pp.top_expansion_buf.deinit();
249 pp.token_buf.deinit(gpa);
250 pp.char_buf.deinit(gpa);
251 pp.poisoned_identifiers.deinit(gpa);
252 pp.include_guards.deinit(gpa);
253 pp.top_expansion_buf.deinit(gpa);
259254 pp.hideset.deinit();
260 for (pp.expansion_entries.items(.locs)) |locs| TokenWithExpansionLocs.free(locs, pp.gpa);
261 pp.expansion_entries.deinit(pp.gpa);
262 pp.m_times.deinit(pp.gpa);
255 for (pp.expansion_entries.items(.locs)) |locs| TokenWithExpansionLocs.free(locs, gpa);
256 pp.expansion_entries.deinit(gpa);
257 pp.m_times.deinit(gpa);
258 pp.* = undefined;
263259}
264260
265261/// Free buffers that are not needed after preprocessing
266262fn clearBuffers(pp: *Preprocessor) void {
267 pp.token_buf.clearAndFree();
268 pp.char_buf.clearAndFree();
269 pp.top_expansion_buf.clearAndFree();
263 const gpa = pp.comp.gpa;
264 pp.token_buf.clearAndFree(gpa);
265 pp.char_buf.clearAndFree(gpa);
266 pp.top_expansion_buf.clearAndFree(gpa);
270267 pp.hideset.clearAndFree();
271268}
272269
273270fn mTime(pp: *Preprocessor, source_id: Source.Id) !u64 {
274 const gop = try pp.m_times.getOrPut(pp.gpa, source_id);
271 const gop = try pp.m_times.getOrPut(pp.comp.gpa, source_id);
275272 if (!gop.found_existing) {
276273 gop.value_ptr.* = pp.comp.getSourceMTimeUncached(source_id) orelse 0;
277274 }
......@@ -385,6 +382,7 @@ fn findIncludeGuard(pp: *Preprocessor, source: Source) ?[]const u8 {
385382}
386383
387384fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!TokenWithExpansionLocs {
385 const gpa = pp.comp.gpa;
388386 var guard_name = pp.findIncludeGuard(source);
389387
390388 pp.preprocess_count += 1;
......@@ -418,7 +416,7 @@ fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!TokenWithExpans
418416 tok = tokenizer.next();
419417 if (tok.id == .nl or tok.id == .eof) break;
420418 if (tok.id == .whitespace) tok.id = .macro_ws;
421 try pp.top_expansion_buf.append(tokFromRaw(tok));
419 try pp.top_expansion_buf.append(gpa, tokFromRaw(tok));
422420 }
423421 try pp.stringify(pp.top_expansion_buf.items);
424422 const slice = pp.char_buf.items[char_top + 1 .. pp.char_buf.items.len - 2];
......@@ -713,7 +711,7 @@ fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!TokenWithExpans
713711 try pp.err(tok, .newline_eof, .{});
714712 }
715713 if (guard_name) |name| {
716 if (try pp.include_guards.fetchPut(pp.gpa, source.id, name)) |prev| {
714 if (try pp.include_guards.fetchPut(pp.comp.gpa, source.id, name)) |prev| {
717715 assert(mem.eql(u8, name, prev.value));
718716 }
719717 }
......@@ -761,8 +759,11 @@ pub const Diagnostic = @import("Preprocessor/Diagnostic.zig");
761759
762760fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) Compilation.Error!void {
763761 if (pp.diagnostics.effectiveKind(diagnostic) == .off) return;
762 const old_suppress_system = pp.diagnostics.state.suppress_system_headers;
763 defer pp.diagnostics.state.suppress_system_headers = old_suppress_system;
764 if (diagnostic.show_in_system_headers) pp.diagnostics.state.suppress_system_headers = false;
764765
765 var sf = std.heap.stackFallback(1024, pp.gpa);
766 var sf = std.heap.stackFallback(1024, pp.comp.gpa);
766767 var allocating: std.Io.Writer.Allocating = .init(sf.get());
767768 defer allocating.deinit();
768769
......@@ -791,7 +792,7 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C
791792}
792793
793794fn fatal(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: anytype) Compilation.Error {
794 var sf = std.heap.stackFallback(1024, pp.gpa);
795 var sf = std.heap.stackFallback(1024, pp.comp.gpa);
795796 var allocating: std.Io.Writer.Allocating = .init(sf.get());
796797 defer allocating.deinit();
797798
......@@ -813,11 +814,12 @@ fn fatalNotFound(pp: *Preprocessor, tok: TokenWithExpansionLocs, filename: []con
813814 pp.diagnostics.state.fatal_errors = true;
814815 defer pp.diagnostics.state.fatal_errors = old;
815816
816 var sf = std.heap.stackFallback(1024, pp.gpa);
817 var buf = std.array_list.Managed(u8).init(sf.get());
818 defer buf.deinit();
817 var sf = std.heap.stackFallback(1024, pp.comp.gpa);
818 const allocator = sf.get();
819 var buf: std.ArrayList(u8) = .empty;
820 defer buf.deinit(allocator);
819821
820 try buf.print("'{s}' not found", .{filename});
822 try buf.print(allocator, "'{s}' not found", .{filename});
821823 try pp.diagnostics.addWithLocation(pp.comp, .{
822824 .kind = .@"fatal error",
823825 .text = buf.items,
......@@ -831,14 +833,16 @@ fn verboseLog(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args:
831833 const source = pp.comp.getSource(raw.source);
832834 const line_col = source.lineCol(.{ .id = raw.source, .line = raw.line, .byte_offset = raw.start });
833835
834 var stderr_buffer: [64]u8 = undefined;
835 var writer = std.debug.lockStderrWriter(&stderr_buffer);
836 defer std.debug.unlockStderrWriter();
837 writer.print("{s}:{d}:{d}: ", .{ source.path, line_col.line_no, line_col.col }) catch return;
838 writer.print(fmt, args) catch return;
839 writer.writeByte('\n') catch return;
840 writer.writeAll(line_col.line) catch return;
841 writer.writeByte('\n') catch return;
836 var stderr_buf: [4096]u8 = undefined;
837 var stderr = std.fs.File.stderr().writer(&stderr_buf);
838 const w = &stderr.interface;
839
840 w.print("{s}:{d}:{d}: ", .{ source.path, line_col.line_no, line_col.col }) catch return;
841 w.print(fmt, args) catch return;
842 w.writeByte('\n') catch return;
843 w.writeAll(line_col.line) catch return;
844 w.writeByte('\n') catch return;
845 w.flush() catch return;
842846}
843847
844848/// Consume next token, error if it is not an identifier.
......@@ -880,9 +884,10 @@ fn restoreTokenState(pp: *Preprocessor, state: TokenState) void {
880884
881885/// Consume all tokens until a newline and parse the result into a boolean.
882886fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
887 const gpa = pp.comp.gpa;
883888 const token_state = pp.getTokenState();
884889 defer {
885 for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
890 for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
886891 pp.restoreTokenState(token_state);
887892 }
888893
......@@ -894,7 +899,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
894899 .whitespace => if (pp.top_expansion_buf.items.len == 0) continue,
895900 else => {},
896901 }
897 try pp.top_expansion_buf.append(tokFromRaw(tok));
902 try pp.top_expansion_buf.append(gpa, tokFromRaw(tok));
898903 } else unreachable;
899904 if (pp.top_expansion_buf.items.len != 0) {
900905 pp.expansion_source_loc = pp.top_expansion_buf.items[0].loc;
......@@ -989,11 +994,9 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
989994 .pp = pp,
990995 .comp = pp.comp,
991996 .diagnostics = pp.diagnostics,
992 .gpa = pp.gpa,
993997 .tok_ids = pp.tokens.items(.id),
994998 .tok_i = @intCast(token_state.tokens_len),
995999 .in_macro = true,
996 .strings = std.array_list.Managed(u8).init(pp.comp.gpa),
9971000
9981001 .tree = undefined,
9991002 .labels = undefined,
......@@ -1005,7 +1008,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
10051008 .attr_buf = undefined,
10061009 .string_ids = undefined,
10071010 };
1008 defer parser.strings.deinit();
1011 defer parser.strings.deinit(gpa);
10091012 return parser.macroExpr();
10101013}
10111014
......@@ -1140,34 +1143,35 @@ fn skipToNl(tokenizer: *Tokenizer) void {
11401143 }
11411144}
11421145
1143const ExpandBuf = std.array_list.Managed(TokenWithExpansionLocs);
1144fn removePlacemarkers(buf: *ExpandBuf) void {
1146const ExpandBuf = std.ArrayList(TokenWithExpansionLocs);
1147fn removePlacemarkers(gpa: Allocator, buf: *ExpandBuf) void {
11451148 var i: usize = buf.items.len -% 1;
11461149 while (i < buf.items.len) : (i -%= 1) {
11471150 if (buf.items[i].id == .placemarker) {
11481151 const placemarker = buf.orderedRemove(i);
1149 TokenWithExpansionLocs.free(placemarker.expansion_locs, buf.allocator);
1152 TokenWithExpansionLocs.free(placemarker.expansion_locs, gpa);
11501153 }
11511154 }
11521155}
11531156
1154const MacroArguments = std.array_list.Managed([]const TokenWithExpansionLocs);
1155fn deinitMacroArguments(allocator: Allocator, args: *const MacroArguments) void {
1157const MacroArguments = std.ArrayList([]const TokenWithExpansionLocs);
1158fn deinitMacroArguments(gpa: Allocator, args: *MacroArguments) void {
11561159 for (args.items) |item| {
1157 for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, allocator);
1158 allocator.free(item);
1160 for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
1161 gpa.free(item);
11591162 }
1160 args.deinit();
1163 args.deinit(gpa);
11611164}
11621165
11631166fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf {
1164 var buf = ExpandBuf.init(pp.gpa);
1165 errdefer buf.deinit();
1167 const gpa = pp.comp.gpa;
1168 var buf: ExpandBuf = .empty;
1169 errdefer buf.deinit(gpa);
11661170 if (simple_macro.tokens.len == 0) {
1167 try buf.append(.{ .id = .placemarker, .loc = .{ .id = .generated } });
1171 try buf.append(gpa, .{ .id = .placemarker, .loc = .{ .id = .generated } });
11681172 return buf;
11691173 }
1170 try buf.ensureTotalCapacity(simple_macro.tokens.len);
1174 try buf.ensureTotalCapacity(gpa, simple_macro.tokens.len);
11711175
11721176 // Add all of the simple_macros tokens to the new buffer handling any concats.
11731177 var i: usize = 0;
......@@ -1193,25 +1197,26 @@ fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf
11931197 .macro_file => {
11941198 const start = pp.comp.generated_buf.items.len;
11951199 const source = pp.comp.getSource(pp.expansion_source_loc.id);
1196 try pp.comp.generated_buf.print(pp.gpa, "\"{f}\"\n", .{fmtEscapes(source.path)});
1200 try pp.comp.generated_buf.print(gpa, "\"{f}\"\n", .{fmtEscapes(source.path)});
11971201
11981202 buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .string_literal, tok));
11991203 },
12001204 .macro_line => {
12011205 const start = pp.comp.generated_buf.items.len;
12021206 const source = pp.comp.getSource(pp.expansion_source_loc.id);
1203 try pp.comp.generated_buf.print(pp.gpa, "{d}\n", .{source.physicalLine(pp.expansion_source_loc)});
1207 try pp.comp.generated_buf.print(gpa, "{d}\n", .{source.physicalLine(pp.expansion_source_loc)});
12041208
12051209 buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok));
12061210 },
12071211 .macro_counter => {
12081212 defer pp.counter += 1;
12091213 const start = pp.comp.generated_buf.items.len;
1210 try pp.comp.generated_buf.print(pp.gpa, "{d}\n", .{pp.counter});
1214 try pp.comp.generated_buf.print(gpa, "{d}\n", .{pp.counter});
12111215
12121216 buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok));
12131217 },
12141218 .macro_date, .macro_time => {
1219 try pp.err(pp.expansion_source_loc, .date_time, .{});
12151220 const start = pp.comp.generated_buf.items.len;
12161221 const timestamp = switch (pp.source_epoch) {
12171222 .system, .provided => |ts| ts,
......@@ -1220,6 +1225,7 @@ fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf
12201225 buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .string_literal, tok));
12211226 },
12221227 .macro_timestamp => {
1228 try pp.err(pp.expansion_source_loc, .date_time, .{});
12231229 const start = pp.comp.generated_buf.items.len;
12241230 const timestamp = switch (pp.source_epoch) {
12251231 .provided => |ts| ts,
......@@ -1251,8 +1257,9 @@ const DateTimeStampKind = enum {
12511257 }
12521258};
12531259
1254fn writeDateTimeStamp(pp: *Preprocessor, kind: DateTimeStampKind, timestamp: u64) !void {
1260fn writeDateTimeStamp(pp: *const Preprocessor, kind: DateTimeStampKind, timestamp: u64) !void {
12551261 std.debug.assert(std.time.epoch.Month.jan.numeric() == 1);
1262 const gpa = pp.comp.gpa;
12561263
12571264 const epoch_seconds = std.time.epoch.EpochSeconds{ .secs = timestamp };
12581265 const epoch_day = epoch_seconds.getEpochDay();
......@@ -1267,21 +1274,21 @@ fn writeDateTimeStamp(pp: *Preprocessor, kind: DateTimeStampKind, timestamp: u64
12671274
12681275 switch (kind) {
12691276 .date => {
1270 try pp.comp.generated_buf.print(pp.gpa, "\"{s} {d: >2} {d}\"", .{
1277 try pp.comp.generated_buf.print(gpa, "\"{s} {d: >2} {d}\"", .{
12711278 month_name,
12721279 month_day.day_index + 1,
12731280 year_day.year,
12741281 });
12751282 },
12761283 .time => {
1277 try pp.comp.generated_buf.print(pp.gpa, "\"{d:0>2}:{d:0>2}:{d:0>2}\"", .{
1284 try pp.comp.generated_buf.print(gpa, "\"{d:0>2}:{d:0>2}:{d:0>2}\"", .{
12781285 day_seconds.getHoursIntoDay(),
12791286 day_seconds.getMinutesIntoHour(),
12801287 day_seconds.getSecondsIntoMinute(),
12811288 });
12821289 },
12831290 .timestamp => {
1284 try pp.comp.generated_buf.print(pp.gpa, "\"{s} {s} {d: >2} {d:0>2}:{d:0>2}:{d:0>2} {d}\"", .{
1291 try pp.comp.generated_buf.print(gpa, "\"{s} {s} {d: >2} {d:0>2}:{d:0>2}:{d:0>2} {d}\"", .{
12851292 day_name,
12861293 month_name,
12871294 month_day.day_index + 1,
......@@ -1312,7 +1319,7 @@ fn pasteStringsUnsafe(pp: *Preprocessor, toks: []const TokenWithExpansionLocs) !
13121319 if (tok.id == .macro_ws) continue;
13131320 if (tok.id != .string_literal) return error.ExpectedStringLiteral;
13141321 const str = pp.expandedSlice(tok);
1315 try pp.char_buf.appendSlice(str[1 .. str.len - 1]);
1322 try pp.char_buf.appendSlice(pp.comp.gpa, str[1 .. str.len - 1]);
13161323 }
13171324 return pp.char_buf.items[char_top..];
13181325}
......@@ -1322,16 +1329,17 @@ fn pragmaOperator(pp: *Preprocessor, arg_tok: TokenWithExpansionLocs, operator_l
13221329 const arg_slice = pp.expandedSlice(arg_tok);
13231330 const content = arg_slice[1 .. arg_slice.len - 1];
13241331 const directive = "#pragma ";
1332 const gpa = pp.comp.gpa;
13251333
13261334 pp.char_buf.clearRetainingCapacity();
13271335 const total_len = directive.len + content.len + 1; // destringify can never grow the string, + 1 for newline
1328 try pp.char_buf.ensureUnusedCapacity(total_len);
1336 try pp.char_buf.ensureUnusedCapacity(gpa, total_len);
13291337 pp.char_buf.appendSliceAssumeCapacity(directive);
13301338 pp.destringify(content);
13311339 pp.char_buf.appendAssumeCapacity('\n');
13321340
13331341 const start = pp.comp.generated_buf.items.len;
1334 try pp.comp.generated_buf.appendSlice(pp.gpa, pp.char_buf.items);
1342 try pp.comp.generated_buf.appendSlice(gpa, pp.char_buf.items);
13351343 var tmp_tokenizer = Tokenizer{
13361344 .buf = pp.comp.generated_buf.items,
13371345 .langopts = pp.comp.langopts,
......@@ -1353,9 +1361,10 @@ fn msPragmaOperator(pp: *Preprocessor, pragma_tok: TokenWithExpansionLocs, args:
13531361 try pp.err(pragma_tok, .unknown_pragma, .{});
13541362 return;
13551363 }
1364 const gpa = pp.comp.gpa;
13561365
13571366 {
1358 var copy = try pragma_tok.dupe(pp.gpa);
1367 var copy = try pragma_tok.dupe(gpa);
13591368 copy.id = .keyword_pragma;
13601369 try pp.addToken(copy);
13611370 }
......@@ -1364,7 +1373,7 @@ fn msPragmaOperator(pp: *Preprocessor, pragma_tok: TokenWithExpansionLocs, args:
13641373 for (args) |tok| {
13651374 switch (tok.id) {
13661375 .macro_ws, .comment => continue,
1367 else => try pp.addToken(try tok.dupe(pp.gpa)),
1376 else => try pp.addToken(try tok.dupe(gpa)),
13681377 }
13691378 }
13701379 try pp.addToken(.{ .id = .nl, .loc = .{ .id = .generated } });
......@@ -1406,7 +1415,8 @@ fn destringify(pp: *Preprocessor, str: []const u8) void {
14061415/// Stringify `tokens` into pp.char_buf.
14071416/// See https://gcc.gnu.org/onlinedocs/gcc-11.2.0/cpp/Stringizing.html#Stringizing
14081417fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void {
1409 try pp.char_buf.append('"');
1418 const gpa = pp.comp.gpa;
1419 try pp.char_buf.append(gpa, '"');
14101420 var ws_state: enum { start, need, not_needed } = .start;
14111421 for (tokens) |tok| {
14121422 if (tok.id == .macro_ws) {
......@@ -1414,7 +1424,7 @@ fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void {
14141424 ws_state = .need;
14151425 continue;
14161426 }
1417 if (ws_state == .need) try pp.char_buf.append(' ');
1427 if (ws_state == .need) try pp.char_buf.append(gpa, ' ');
14181428 ws_state = .not_needed;
14191429
14201430 // backslashes not inside strings are not escaped
......@@ -1434,14 +1444,14 @@ fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void {
14341444
14351445 for (pp.expandedSlice(tok)) |c| {
14361446 if (c == '"')
1437 try pp.char_buf.appendSlice("\\\"")
1447 try pp.char_buf.appendSlice(gpa, "\\\"")
14381448 else if (c == '\\' and is_str)
1439 try pp.char_buf.appendSlice("\\\\")
1449 try pp.char_buf.appendSlice(gpa, "\\\\")
14401450 else
1441 try pp.char_buf.append(c);
1451 try pp.char_buf.append(gpa, c);
14421452 }
14431453 }
1444 try pp.char_buf.ensureUnusedCapacity(2);
1454 try pp.char_buf.ensureUnusedCapacity(gpa, 2);
14451455 if (pp.char_buf.items[pp.char_buf.items.len - 1] != '\\') {
14461456 pp.char_buf.appendSliceAssumeCapacity("\"\n");
14471457 return;
......@@ -1492,7 +1502,7 @@ fn reconstructIncludeString(pp: *Preprocessor, param_toks: []const TokenWithExpa
14921502
14931503 for (params, 0..) |tok, i| {
14941504 const str = pp.expandedSliceExtra(tok, .preserve_macro_ws);
1495 try pp.char_buf.appendSlice(str);
1505 try pp.char_buf.appendSlice(pp.comp.gpa, str);
14961506 if (embed_args) |some| {
14971507 if ((i == 0 and tok.id == .string_literal) or tok.id == .angle_bracket_right) {
14981508 some.* = params[i + 1 ..];
......@@ -1649,25 +1659,26 @@ fn expandFuncMacro(
16491659 expanded_args: *const MacroArguments,
16501660 hideset_arg: Hideset.Index,
16511661) MacroError!ExpandBuf {
1662 const gpa = pp.comp.gpa;
16521663 var hideset = hideset_arg;
1653 var buf = ExpandBuf.init(pp.gpa);
1654 try buf.ensureTotalCapacity(func_macro.tokens.len);
1655 errdefer buf.deinit();
1664 var buf: ExpandBuf = .empty;
1665 errdefer buf.deinit(gpa);
1666 try buf.ensureTotalCapacity(gpa, func_macro.tokens.len);
16561667
1657 var expanded_variable_arguments = ExpandBuf.init(pp.gpa);
1658 defer expanded_variable_arguments.deinit();
1659 var variable_arguments = ExpandBuf.init(pp.gpa);
1660 defer variable_arguments.deinit();
1668 var expanded_variable_arguments: ExpandBuf = .empty;
1669 defer expanded_variable_arguments.deinit(gpa);
1670 var variable_arguments: ExpandBuf = .empty;
1671 defer variable_arguments.deinit(gpa);
16611672
16621673 if (func_macro.var_args) {
16631674 var i: usize = func_macro.params.len;
16641675 while (i < expanded_args.items.len) : (i += 1) {
1665 try variable_arguments.appendSlice(args.items[i]);
1666 try expanded_variable_arguments.appendSlice(expanded_args.items[i]);
1676 try variable_arguments.appendSlice(gpa, args.items[i]);
1677 try expanded_variable_arguments.appendSlice(gpa, expanded_args.items[i]);
16671678 if (i != expanded_args.items.len - 1) {
1668 const comma = TokenWithExpansionLocs{ .id = .comma, .loc = .{ .id = .generated } };
1669 try variable_arguments.append(comma);
1670 try expanded_variable_arguments.append(comma);
1679 const comma: TokenWithExpansionLocs = .{ .id = .comma, .loc = .{ .id = .generated } };
1680 try variable_arguments.append(gpa, comma);
1681 try expanded_variable_arguments.append(gpa, comma);
16711682 }
16721683 }
16731684 }
......@@ -1681,8 +1692,8 @@ fn expandFuncMacro(
16811692 const raw_next = func_macro.tokens[tok_i + 1];
16821693 tok_i += 1;
16831694
1684 var va_opt_buf = ExpandBuf.init(pp.gpa);
1685 defer va_opt_buf.deinit();
1695 var va_opt_buf: ExpandBuf = .empty;
1696 defer va_opt_buf.deinit(gpa);
16861697
16871698 const next = switch (raw_next.id) {
16881699 .macro_ws => continue,
......@@ -1709,7 +1720,7 @@ fn expandFuncMacro(
17091720 }
17101721 const slice = getPasteArgs(args.items[raw.end]);
17111722 const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line };
1712 try bufCopyTokens(&buf, slice, &.{raw_loc});
1723 try bufCopyTokens(gpa, &buf, slice, &.{raw_loc});
17131724 },
17141725 .macro_param => {
17151726 if (tok_i + 1 < func_macro.tokens.len and func_macro.tokens[tok_i + 1].id == .hash_hash) {
......@@ -1717,11 +1728,11 @@ fn expandFuncMacro(
17171728 }
17181729 const arg = expanded_args.items[raw.end];
17191730 const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line };
1720 try bufCopyTokens(&buf, arg, &.{raw_loc});
1731 try bufCopyTokens(gpa, &buf, arg, &.{raw_loc});
17211732 },
17221733 .keyword_va_args => {
17231734 const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line };
1724 try bufCopyTokens(&buf, expanded_variable_arguments.items, &.{raw_loc});
1735 try bufCopyTokens(gpa, &buf, expanded_variable_arguments.items, &.{raw_loc});
17251736 },
17261737 .keyword_va_opt => {
17271738 try pp.expandVaOpt(&buf, raw, variable_arguments.items.len != 0);
......@@ -1736,9 +1747,9 @@ fn expandFuncMacro(
17361747 try pp.stringify(arg);
17371748
17381749 const start = pp.comp.generated_buf.items.len;
1739 try pp.comp.generated_buf.appendSlice(pp.gpa, pp.char_buf.items);
1750 try pp.comp.generated_buf.appendSlice(gpa, pp.char_buf.items);
17401751
1741 try buf.append(try pp.makeGeneratedToken(start, .string_literal, tokFromRaw(raw)));
1752 try buf.append(gpa, try pp.makeGeneratedToken(start, .string_literal, tokFromRaw(raw)));
17421753 },
17431754 .macro_param_has_attribute,
17441755 .macro_param_has_declspec_attribute,
......@@ -1757,8 +1768,8 @@ fn expandFuncMacro(
17571768 } else try pp.handleBuiltinMacro(raw.id, arg, macro_tok.loc);
17581769 const start = pp.comp.generated_buf.items.len;
17591770
1760 try pp.comp.generated_buf.print(pp.gpa, "{}\n", .{@intFromBool(result)});
1761 try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
1771 try pp.comp.generated_buf.print(gpa, "{}\n", .{@intFromBool(result)});
1772 try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
17621773 },
17631774 .macro_param_has_c_attribute => {
17641775 const arg = expanded_args.items[0];
......@@ -1808,8 +1819,8 @@ fn expandFuncMacro(
18081819 const exists = Attribute.fromString(.gnu, vendor_str, attr_str) != null;
18091820
18101821 const start = pp.comp.generated_buf.items.len;
1811 try pp.comp.generated_buf.appendSlice(pp.gpa, if (exists) "1\n" else "0\n");
1812 try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
1822 try pp.comp.generated_buf.appendSlice(gpa, if (exists) "1\n" else "0\n");
1823 try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
18131824 continue;
18141825 }
18151826 if (!pp.comp.langopts.standard.atLeast(.c23)) break :res not_found;
......@@ -1829,8 +1840,8 @@ fn expandFuncMacro(
18291840 break :res attrs.get(attr_str) orelse not_found;
18301841 };
18311842 const start = pp.comp.generated_buf.items.len;
1832 try pp.comp.generated_buf.appendSlice(pp.gpa, result);
1833 try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
1843 try pp.comp.generated_buf.appendSlice(gpa, result);
1844 try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
18341845 },
18351846 .macro_param_has_embed => {
18361847 const arg = expanded_args.items[0];
......@@ -1936,12 +1947,12 @@ fn expandFuncMacro(
19361947 const contents = (try pp.comp.findEmbed(filename, arg[0].loc.id, include_type, .limited(1), pp.dep_file)) orelse
19371948 break :res not_found;
19381949
1939 defer pp.comp.gpa.free(contents);
1950 defer gpa.free(contents);
19401951 break :res if (contents.len != 0) "1\n" else "2\n";
19411952 };
19421953 const start = pp.comp.generated_buf.items.len;
1943 try pp.comp.generated_buf.appendSlice(pp.comp.gpa, result);
1944 try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
1954 try pp.comp.generated_buf.appendSlice(gpa, result);
1955 try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
19451956 },
19461957 .macro_param_pragma_operator => {
19471958 // Clang and GCC require exactly one token (so, no parentheses or string pasting)
......@@ -1993,7 +2004,7 @@ fn expandFuncMacro(
19932004 }
19942005 if (ident) |*some| {
19952006 some.id = .identifier;
1996 try buf.append(some.*);
2007 try buf.append(gpa, some.*);
19972008 } else {
19982009 try pp.err(macro_tok, .expected_identifier, .{});
19992010 }
......@@ -2023,10 +2034,10 @@ fn expandFuncMacro(
20232034 try pp.err(hash_hash, .comma_deletion_va_args, .{});
20242035 } else {
20252036 // C standard, retain the comma
2026 try buf.append(tokFromRaw(raw));
2037 try buf.append(gpa, tokFromRaw(raw));
20272038 }
20282039 } else {
2029 try buf.append(tokFromRaw(raw));
2040 try buf.append(gpa, tokFromRaw(raw));
20302041 if (expanded_variable_arguments.items.len > 0 or variable_arguments.items.len == func_macro.params.len) {
20312042 try pp.err(hash_hash, .comma_deletion_va_args, .{});
20322043 }
......@@ -2035,23 +2046,23 @@ fn expandFuncMacro(
20352046 .byte_offset = maybe_va_args.start,
20362047 .line = maybe_va_args.line,
20372048 };
2038 try bufCopyTokens(&buf, expanded_variable_arguments.items, &.{raw_loc});
2049 try bufCopyTokens(gpa, &buf, expanded_variable_arguments.items, &.{raw_loc});
20392050 }
20402051 continue;
20412052 }
20422053 }
20432054 // Regular comma, no token pasting with __VA_ARGS__
2044 try buf.append(tokFromRaw(raw));
2055 try buf.append(gpa, tokFromRaw(raw));
20452056 },
2046 else => try buf.append(tokFromRaw(raw)),
2057 else => try buf.append(gpa, tokFromRaw(raw)),
20472058 }
20482059 }
2049 removePlacemarkers(&buf);
2060 removePlacemarkers(gpa, &buf);
20502061
20512062 const macro_expansion_locs = macro_tok.expansionSlice();
20522063 for (buf.items) |*tok| {
2053 try tok.addExpansionLocation(pp.gpa, &.{macro_tok.loc});
2054 try tok.addExpansionLocation(pp.gpa, macro_expansion_locs);
2064 try tok.addExpansionLocation(gpa, &.{macro_tok.loc});
2065 try tok.addExpansionLocation(gpa, macro_expansion_locs);
20552066 const tok_hidelist = pp.hideset.get(tok.loc);
20562067 const new_hidelist = try pp.hideset.@"union"(tok_hidelist, hideset);
20572068 try pp.hideset.put(tok.loc, new_hidelist);
......@@ -2078,16 +2089,16 @@ fn expandVaOpt(
20782089 };
20792090 while (tokenizer.index < raw.end) {
20802091 const tok = tokenizer.next();
2081 try buf.append(tokFromRaw(tok));
2092 try buf.append(pp.comp.gpa, tokFromRaw(tok));
20822093 }
20832094}
20842095
2085fn bufCopyTokens(buf: *ExpandBuf, tokens: []const TokenWithExpansionLocs, src: []const Source.Location) !void {
2086 try buf.ensureUnusedCapacity(tokens.len);
2096fn bufCopyTokens(gpa: Allocator, buf: *ExpandBuf, tokens: []const TokenWithExpansionLocs, src: []const Source.Location) !void {
2097 try buf.ensureUnusedCapacity(gpa, tokens.len);
20872098 for (tokens) |tok| {
2088 var copy = try tok.dupe(buf.allocator);
2089 errdefer TokenWithExpansionLocs.free(copy.expansion_locs, buf.allocator);
2090 try copy.addExpansionLocation(buf.allocator, src);
2099 var copy = try tok.dupe(gpa);
2100 errdefer TokenWithExpansionLocs.free(copy.expansion_locs, gpa);
2101 try copy.addExpansionLocation(gpa, src);
20912102 buf.appendAssumeCapacity(copy);
20922103 }
20932104}
......@@ -2112,10 +2123,10 @@ fn nextBufToken(
21122123
21132124 const new_tok = tokFromRaw(raw_tok);
21142125 end_idx.* += 1;
2115 try buf.append(new_tok);
2126 try buf.append(pp.comp.gpa, new_tok);
21162127 return new_tok;
21172128 } else {
2118 return TokenWithExpansionLocs{ .id = .eof, .loc = .{ .id = .generated } };
2129 return .{ .id = .eof, .loc = .{ .id = .generated } };
21192130 }
21202131 } else {
21212132 return buf.items[start_idx.*];
......@@ -2132,6 +2143,7 @@ fn collectMacroFuncArguments(
21322143 is_builtin: bool,
21332144 r_paren: *TokenWithExpansionLocs,
21342145) !MacroArguments {
2146 const gpa = pp.comp.gpa;
21352147 const name_tok = buf.items[start_idx.*];
21362148 const saved_tokenizer = tokenizer.*;
21372149 const old_end = end_idx.*;
......@@ -2155,62 +2167,62 @@ fn collectMacroFuncArguments(
21552167
21562168 // collect the arguments.
21572169 var parens: u32 = 0;
2158 var args = MacroArguments.init(pp.gpa);
2159 errdefer deinitMacroArguments(pp.gpa, &args);
2160 var curArgument = std.array_list.Managed(TokenWithExpansionLocs).init(pp.gpa);
2161 defer curArgument.deinit();
2170 var args: MacroArguments = .empty;
2171 errdefer deinitMacroArguments(gpa, &args);
2172 var cur_argument: std.ArrayList(TokenWithExpansionLocs) = .empty;
2173 defer cur_argument.deinit(gpa);
21622174 while (true) {
21632175 var tok = try nextBufToken(pp, tokenizer, buf, start_idx, end_idx, extend_buf);
21642176 tok.flags.is_macro_arg = true;
21652177 switch (tok.id) {
21662178 .comma => {
21672179 if (parens == 0) {
2168 const owned = try curArgument.toOwnedSlice();
2169 errdefer pp.gpa.free(owned);
2170 try args.append(owned);
2180 const owned = try cur_argument.toOwnedSlice(gpa);
2181 errdefer gpa.free(owned);
2182 try args.append(gpa, owned);
21712183 } else {
2172 const duped = try tok.dupe(pp.gpa);
2173 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
2174 try curArgument.append(duped);
2184 const duped = try tok.dupe(gpa);
2185 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
2186 try cur_argument.append(gpa, duped);
21752187 }
21762188 },
21772189 .l_paren => {
2178 const duped = try tok.dupe(pp.gpa);
2179 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
2180 try curArgument.append(duped);
2190 const duped = try tok.dupe(gpa);
2191 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
2192 try cur_argument.append(gpa, duped);
21812193 parens += 1;
21822194 },
21832195 .r_paren => {
21842196 if (parens == 0) {
2185 const owned = try curArgument.toOwnedSlice();
2186 errdefer pp.gpa.free(owned);
2187 try args.append(owned);
2197 const owned = try cur_argument.toOwnedSlice(gpa);
2198 errdefer gpa.free(owned);
2199 try args.append(gpa, owned);
21882200 r_paren.* = tok;
21892201 break;
21902202 } else {
2191 const duped = try tok.dupe(pp.gpa);
2192 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
2193 try curArgument.append(duped);
2203 const duped = try tok.dupe(gpa);
2204 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
2205 try cur_argument.append(gpa, duped);
21942206 parens -= 1;
21952207 }
21962208 },
21972209 .eof => {
21982210 {
2199 const owned = try curArgument.toOwnedSlice();
2200 errdefer pp.gpa.free(owned);
2201 try args.append(owned);
2211 const owned = try cur_argument.toOwnedSlice(gpa);
2212 errdefer gpa.free(owned);
2213 try args.append(gpa, owned);
22022214 }
22032215 tokenizer.* = saved_tokenizer;
22042216 try pp.err(name_tok, .unterminated_macro_arg_list, .{});
22052217 return error.Unterminated;
22062218 },
22072219 .nl, .whitespace => {
2208 try curArgument.append(.{ .id = .macro_ws, .loc = tok.loc });
2220 try cur_argument.append(gpa, .{ .id = .macro_ws, .loc = tok.loc });
22092221 },
22102222 else => {
2211 const duped = try tok.dupe(pp.gpa);
2212 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
2213 try curArgument.append(duped);
2223 const duped = try tok.dupe(gpa);
2224 errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
2225 try cur_argument.append(gpa, duped);
22142226 },
22152227 }
22162228 }
......@@ -2219,8 +2231,9 @@ fn collectMacroFuncArguments(
22192231}
22202232
22212233fn removeExpandedTokens(pp: *Preprocessor, buf: *ExpandBuf, start: usize, len: usize, moving_end_idx: *usize) !void {
2222 for (buf.items[start .. start + len]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
2223 try buf.replaceRange(start, len, &.{});
2234 const gpa = pp.comp.gpa;
2235 for (buf.items[start .. start + len]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
2236 try buf.replaceRange(gpa, start, len, &.{});
22242237 moving_end_idx.* -|= len;
22252238}
22262239
......@@ -2263,6 +2276,7 @@ fn expandMacroExhaustive(
22632276 extend_buf: bool,
22642277 eval_ctx: EvalContext,
22652278) MacroError!void {
2279 const gpa = pp.comp.gpa;
22662280 var moving_end_idx = end_idx;
22672281 var advance_index: usize = 0;
22682282 // rescan loop
......@@ -2309,7 +2323,7 @@ fn expandMacroExhaustive(
23092323 var r_paren: TokenWithExpansionLocs = undefined;
23102324 var macro_scan_idx = idx;
23112325 // to be saved in case this doesn't turn out to be a call
2312 const args = pp.collectMacroFuncArguments(
2326 var args = pp.collectMacroFuncArguments(
23132327 tokenizer,
23142328 buf,
23152329 &macro_scan_idx,
......@@ -2334,10 +2348,10 @@ fn expandMacroExhaustive(
23342348 var free_arg_expansion_locs = false;
23352349 defer {
23362350 for (args.items) |item| {
2337 if (free_arg_expansion_locs) for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
2338 pp.gpa.free(item);
2351 if (free_arg_expansion_locs) for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
2352 gpa.free(item);
23392353 }
2340 args.deinit();
2354 args.deinit(gpa);
23412355 }
23422356 const r_paren_hidelist = pp.hideset.get(r_paren.loc);
23432357 var hs = try pp.hideset.intersection(macro_hidelist, r_paren_hidelist);
......@@ -2370,25 +2384,25 @@ fn expandMacroExhaustive(
23702384 try pp.removeExpandedTokens(buf, idx, macro_scan_idx - idx + 1, &moving_end_idx);
23712385 continue;
23722386 }
2373 var expanded_args = MacroArguments.init(pp.gpa);
2374 defer deinitMacroArguments(pp.gpa, &expanded_args);
2375 try expanded_args.ensureTotalCapacity(args.items.len);
2387 var expanded_args: MacroArguments = .empty;
2388 defer deinitMacroArguments(gpa, &expanded_args);
2389 try expanded_args.ensureTotalCapacity(gpa, args.items.len);
23762390 for (args.items) |arg| {
2377 var expand_buf = ExpandBuf.init(pp.gpa);
2378 errdefer expand_buf.deinit();
2379 try expand_buf.appendSlice(arg);
2391 var expand_buf: ExpandBuf = .empty;
2392 errdefer expand_buf.deinit(gpa);
2393 try expand_buf.appendSlice(gpa, arg);
23802394
23812395 try pp.expandMacroExhaustive(tokenizer, &expand_buf, 0, expand_buf.items.len, false, eval_ctx);
23822396
2383 expanded_args.appendAssumeCapacity(try expand_buf.toOwnedSlice());
2397 expanded_args.appendAssumeCapacity(try expand_buf.toOwnedSlice(gpa));
23842398 }
23852399
23862400 var res = try pp.expandFuncMacro(macro_tok, macro, &args, &expanded_args, hs);
2387 defer res.deinit();
2401 defer res.deinit(gpa);
23882402 const tokens_added = res.items.len;
23892403 const tokens_removed = macro_scan_idx - idx + 1;
2390 for (buf.items[idx .. idx + tokens_removed]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
2391 try buf.replaceRange(idx, tokens_removed, res.items);
2404 for (buf.items[idx .. idx + tokens_removed]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
2405 try buf.replaceRange(gpa, idx, tokens_removed, res.items);
23922406
23932407 moving_end_idx += tokens_added;
23942408 // Overflow here means that we encountered an unterminated argument list
......@@ -2397,8 +2411,8 @@ fn expandMacroExhaustive(
23972411 idx += tokens_added;
23982412 do_rescan = true;
23992413 } else {
2400 const res = try pp.expandObjMacro(macro);
2401 defer res.deinit();
2414 var res = try pp.expandObjMacro(macro);
2415 defer res.deinit(gpa);
24022416
24032417 const hs = try pp.hideset.prepend(macro_tok.loc, macro_hidelist);
24042418
......@@ -2406,8 +2420,8 @@ fn expandMacroExhaustive(
24062420 var increment_idx_by = res.items.len;
24072421 for (res.items, 0..) |*tok, i| {
24082422 tok.flags.is_macro_arg = macro_tok.flags.is_macro_arg;
2409 try tok.addExpansionLocation(pp.gpa, &.{macro_tok.loc});
2410 try tok.addExpansionLocation(pp.gpa, macro_expansion_locs);
2423 try tok.addExpansionLocation(gpa, &.{macro_tok.loc});
2424 try tok.addExpansionLocation(gpa, macro_expansion_locs);
24112425
24122426 const tok_hidelist = pp.hideset.get(tok.loc);
24132427 const new_hidelist = try pp.hideset.@"union"(tok_hidelist, hs);
......@@ -2426,8 +2440,8 @@ fn expandMacroExhaustive(
24262440 }
24272441 }
24282442
2429 TokenWithExpansionLocs.free(buf.items[idx].expansion_locs, pp.gpa);
2430 try buf.replaceRange(idx, 1, res.items);
2443 TokenWithExpansionLocs.free(buf.items[idx].expansion_locs, gpa);
2444 try buf.replaceRange(gpa, idx, 1, res.items);
24312445 idx += increment_idx_by;
24322446 moving_end_idx = moving_end_idx + res.items.len - 1;
24332447 do_rescan = true;
......@@ -2442,7 +2456,7 @@ fn expandMacroExhaustive(
24422456
24432457 // trim excess buffer
24442458 for (buf.items[moving_end_idx..]) |item| {
2445 TokenWithExpansionLocs.free(item.expansion_locs, pp.gpa);
2459 TokenWithExpansionLocs.free(item.expansion_locs, gpa);
24462460 }
24472461 buf.items.len = moving_end_idx;
24482462}
......@@ -2456,10 +2470,11 @@ fn unescapeUcn(pp: *Preprocessor, tok: TokenWithExpansionLocs) !TokenWithExpansi
24562470 .extended_identifier => {
24572471 @branchHint(.cold);
24582472 const identifier = pp.expandedSlice(tok);
2473 const gpa = pp.comp.gpa;
24592474 if (mem.indexOfScalar(u8, identifier, '\\') != null) {
24602475 @branchHint(.cold);
24612476 const start = pp.comp.generated_buf.items.len;
2462 try pp.comp.generated_buf.ensureUnusedCapacity(pp.gpa, identifier.len + 1);
2477 try pp.comp.generated_buf.ensureUnusedCapacity(gpa, identifier.len + 1);
24632478 var identifier_parser: text_literal.Parser = .{
24642479 .comp = pp.comp,
24652480 .literal = pp.expandedSlice(tok), // re-expand since previous line may have caused a reallocation, invalidating `identifier`
......@@ -2486,7 +2501,7 @@ fn unescapeUcn(pp: *Preprocessor, tok: TokenWithExpansionLocs) !TokenWithExpansi
24862501 }
24872502 }
24882503 pp.comp.generated_buf.appendAssumeCapacity('\n');
2489 defer TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
2504 defer TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
24902505 return pp.makeGeneratedToken(start, .extended_identifier, tok);
24912506 }
24922507 },
......@@ -2503,8 +2518,9 @@ fn expandMacro(pp: *Preprocessor, tokenizer: *Tokenizer, raw: RawToken) MacroErr
25032518 source_tok.id.simplifyMacroKeyword();
25042519 return pp.addToken(source_tok);
25052520 }
2521 const gpa = pp.comp.gpa;
25062522 pp.top_expansion_buf.items.len = 0;
2507 try pp.top_expansion_buf.append(source_tok);
2523 try pp.top_expansion_buf.append(gpa, source_tok);
25082524 pp.expansion_source_loc = source_tok.loc;
25092525
25102526 pp.hideset.clearRetainingCapacity();
......@@ -2512,15 +2528,15 @@ fn expandMacro(pp: *Preprocessor, tokenizer: *Tokenizer, raw: RawToken) MacroErr
25122528 try pp.ensureUnusedTokenCapacity(pp.top_expansion_buf.items.len);
25132529 for (pp.top_expansion_buf.items) |*tok| {
25142530 if (tok.id == .macro_ws and !pp.preserve_whitespace) {
2515 TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
2531 TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
25162532 continue;
25172533 }
25182534 if (tok.id == .comment and !pp.comp.langopts.preserve_comments_in_macros) {
2519 TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
2535 TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
25202536 continue;
25212537 }
25222538 if (tok.id == .placemarker) {
2523 TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
2539 TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
25242540 continue;
25252541 }
25262542 tok.id.simplifyMacroKeywordExtra(true);
......@@ -2564,14 +2580,15 @@ pub fn expandedSlice(pp: *const Preprocessor, tok: anytype) []const u8 {
25642580
25652581/// Concat two tokens and add the result to pp.generated
25662582fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenWithExpansionLocs) Error!void {
2583 const gpa = pp.comp.gpa;
25672584 const lhs = while (lhs_toks.pop()) |lhs| {
25682585 if ((pp.comp.langopts.preserve_comments_in_macros and lhs.id == .comment) or
25692586 (lhs.id != .macro_ws and lhs.id != .comment))
25702587 break lhs;
25712588
2572 TokenWithExpansionLocs.free(lhs.expansion_locs, pp.gpa);
2589 TokenWithExpansionLocs.free(lhs.expansion_locs, gpa);
25732590 } else {
2574 return bufCopyTokens(lhs_toks, rhs_toks, &.{});
2591 return bufCopyTokens(gpa, lhs_toks, rhs_toks, &.{});
25752592 };
25762593
25772594 var rhs_rest: u32 = 1;
......@@ -2584,11 +2601,11 @@ fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenW
25842601 } else {
25852602 return lhs_toks.appendAssumeCapacity(lhs);
25862603 };
2587 defer TokenWithExpansionLocs.free(lhs.expansion_locs, pp.gpa);
2604 defer TokenWithExpansionLocs.free(lhs.expansion_locs, gpa);
25882605
25892606 const start = pp.comp.generated_buf.items.len;
25902607 const end = start + pp.expandedSlice(lhs).len + pp.expandedSlice(rhs).len;
2591 try pp.comp.generated_buf.ensureTotalCapacity(pp.gpa, end + 1); // +1 for a newline
2608 try pp.comp.generated_buf.ensureTotalCapacity(gpa, end + 1); // +1 for a newline
25922609 // We cannot use the same slices here since they might be invalidated by `ensureCapacity`
25932610 pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(lhs));
25942611 pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(rhs));
......@@ -2607,32 +2624,33 @@ fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenW
26072624 .placemarker
26082625 else
26092626 pasted_token.id;
2610 try lhs_toks.append(try pp.makeGeneratedToken(start, pasted_id, lhs));
2627 try lhs_toks.append(gpa, try pp.makeGeneratedToken(start, pasted_id, lhs));
26112628
26122629 if (next.id != .nl and next.id != .eof) {
26132630 try pp.err(lhs, .pasting_formed_invalid, .{pp.comp.generated_buf.items[start..end]});
2614 try lhs_toks.append(tokFromRaw(next));
2631 try lhs_toks.append(gpa, tokFromRaw(next));
26152632 }
26162633
2617 try bufCopyTokens(lhs_toks, rhs_toks[rhs_rest..], &.{});
2634 try bufCopyTokens(gpa, lhs_toks, rhs_toks[rhs_rest..], &.{});
26182635}
26192636
26202637fn makeGeneratedToken(pp: *Preprocessor, start: usize, id: Token.Id, source: TokenWithExpansionLocs) !TokenWithExpansionLocs {
2638 const gpa = pp.comp.gpa;
26212639 var pasted_token = TokenWithExpansionLocs{ .id = id, .loc = .{
26222640 .id = .generated,
26232641 .byte_offset = @intCast(start),
26242642 .line = pp.generated_line,
26252643 } };
26262644 pp.generated_line += 1;
2627 try pasted_token.addExpansionLocation(pp.gpa, &.{source.loc});
2628 try pasted_token.addExpansionLocation(pp.gpa, source.expansionSlice());
2645 try pasted_token.addExpansionLocation(gpa, &.{source.loc});
2646 try pasted_token.addExpansionLocation(gpa, source.expansionSlice());
26292647 return pasted_token;
26302648}
26312649
26322650/// Defines a new macro and warns if it is a duplicate
26332651fn defineMacro(pp: *Preprocessor, define_tok: RawToken, name_tok: TokenWithExpansionLocs, macro: Macro) Error!void {
26342652 const name_str = pp.expandedSlice(name_tok);
2635 const gop = try pp.defines.getOrPut(pp.gpa, name_str);
2653 const gop = try pp.defines.getOrPut(pp.comp.gpa, name_str);
26362654 if (gop.found_existing and !gop.value_ptr.eql(macro, pp)) {
26372655 const loc = name_tok.loc;
26382656 const prev_total = pp.diagnostics.total;
......@@ -2668,8 +2686,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
26682686 try pp.err(escaped_macro_name, .macro_name_must_be_identifier, .{});
26692687 return skipToNl(tokenizer);
26702688 }
2689 const gpa = pp.comp.gpa;
26712690 const macro_name = try pp.unescapeUcn(tokFromRaw(escaped_macro_name));
2672 defer TokenWithExpansionLocs.free(macro_name.expansion_locs, pp.gpa);
2691 defer TokenWithExpansionLocs.free(macro_name.expansion_locs, gpa);
26732692
26742693 var macro_name_token_id = macro_name.id;
26752694 macro_name_token_id.simplifyMacroKeyword();
......@@ -2724,21 +2743,21 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
27242743 },
27252744 else => {},
27262745 }
2727 try pp.token_buf.append(tok);
2728 try pp.token_buf.append(next);
2746 try pp.token_buf.append(gpa, tok);
2747 try pp.token_buf.append(gpa, next);
27292748 },
27302749 .nl, .eof => break,
27312750 .comment => if (pp.comp.langopts.preserve_comments_in_macros) {
27322751 if (need_ws) {
27332752 need_ws = false;
2734 try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
2753 try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
27352754 }
2736 try pp.token_buf.append(tok);
2755 try pp.token_buf.append(gpa, tok);
27372756 },
27382757 .whitespace => need_ws = true,
27392758 .unterminated_string_literal, .unterminated_char_literal, .empty_char_literal => |tag| {
27402759 try pp.err(tok, invalidTokenDiagnostic(tag), .{});
2741 try pp.token_buf.append(tok);
2760 try pp.token_buf.append(gpa, tok);
27422761 },
27432762 .unterminated_comment => try pp.err(tok, .unterminated_comment, .{}),
27442763 else => {
......@@ -2748,9 +2767,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
27482767 }
27492768 if (tok.id != .whitespace and need_ws) {
27502769 need_ws = false;
2751 try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
2770 try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
27522771 }
2753 try pp.token_buf.append(tok);
2772 try pp.token_buf.append(gpa, tok);
27542773 },
27552774 }
27562775 tok = tokenizer.next();
......@@ -2769,8 +2788,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
27692788/// Handle a function like #define directive.
27702789fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macro_name: TokenWithExpansionLocs, l_paren: RawToken) Error!void {
27712790 assert(macro_name.id.isMacroIdentifier());
2772 var params = std.array_list.Managed([]const u8).init(pp.gpa);
2773 defer params.deinit();
2791 const gpa = pp.comp.gpa;
2792 var params: std.ArrayList([]const u8) = .empty;
2793 defer params.deinit(gpa);
27742794
27752795 // Parse the parameter list.
27762796 var gnu_var_args: []const u8 = "";
......@@ -2794,7 +2814,7 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
27942814 return skipToNl(tokenizer);
27952815 }
27962816
2797 try params.append(pp.tokSlice(tok));
2817 try params.append(gpa, pp.tokSlice(tok));
27982818
27992819 tok = tokenizer.nextNoWS();
28002820 if (tok.id == .ellipsis) {
......@@ -2826,34 +2846,34 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
28262846 .comment => if (!pp.comp.langopts.preserve_comments_in_macros) continue else {
28272847 if (need_ws) {
28282848 need_ws = false;
2829 try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
2849 try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
28302850 }
2831 try pp.token_buf.append(tok);
2851 try pp.token_buf.append(gpa, tok);
28322852 },
28332853 .hash => {
28342854 if (tok.id != .whitespace and need_ws) {
28352855 need_ws = false;
2836 try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
2856 try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
28372857 }
28382858 const param = tokenizer.nextNoWS();
28392859 blk: {
28402860 if (var_args and param.id == .keyword_va_args) {
28412861 tok.id = .stringify_va_args;
2842 try pp.token_buf.append(tok);
2862 try pp.token_buf.append(gpa, tok);
28432863 continue :tok_loop;
28442864 }
28452865 if (!param.id.isMacroIdentifier()) break :blk;
28462866 const s = pp.tokSlice(param);
28472867 if (mem.eql(u8, s, gnu_var_args)) {
28482868 tok.id = .stringify_va_args;
2849 try pp.token_buf.append(tok);
2869 try pp.token_buf.append(gpa, tok);
28502870 continue :tok_loop;
28512871 }
28522872 for (params.items, 0..) |p, i| {
28532873 if (mem.eql(u8, p, s)) {
28542874 tok.id = .stringify_param;
28552875 tok.end = @intCast(i);
2856 try pp.token_buf.append(tok);
2876 try pp.token_buf.append(gpa, tok);
28572877 continue :tok_loop;
28582878 }
28592879 }
......@@ -2880,17 +2900,17 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
28802900 if (pp.token_buf.items[pp.token_buf.items.len - 1].id == .macro_param) {
28812901 pp.token_buf.items[pp.token_buf.items.len - 1].id = .macro_param_no_expand;
28822902 }
2883 try pp.token_buf.append(tok);
2903 try pp.token_buf.append(gpa, tok);
28842904 },
28852905 .unterminated_string_literal, .unterminated_char_literal, .empty_char_literal => |tag| {
28862906 try pp.err(tok, invalidTokenDiagnostic(tag), .{});
2887 try pp.token_buf.append(tok);
2907 try pp.token_buf.append(gpa, tok);
28882908 },
28892909 .unterminated_comment => try pp.err(tok, .unterminated_comment, .{}),
28902910 else => {
28912911 if (tok.id != .whitespace and need_ws) {
28922912 need_ws = false;
2893 try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
2913 try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
28942914 }
28952915 if (var_args and tok.id == .keyword_va_args) {
28962916 // do nothing
......@@ -2937,7 +2957,7 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
29372957 }
29382958 }
29392959 }
2940 try pp.token_buf.append(tok);
2960 try pp.token_buf.append(gpa, tok);
29412961 },
29422962 }
29432963 }
......@@ -2957,12 +2977,13 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
29572977/// embedDirective : ("FILENAME" | <FILENAME>) embedParam*
29582978/// embedParam : IDENTIFIER (:: IDENTIFIER)? '(' <tokens> ')'
29592979fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
2980 const gpa = pp.comp.gpa;
29602981 const first = tokenizer.nextNoWS();
29612982 const filename_tok = pp.findIncludeFilenameToken(first, tokenizer, .ignore_trailing_tokens) catch |er| switch (er) {
29622983 error.InvalidInclude => return,
29632984 else => |e| return e,
29642985 };
2965 defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, pp.gpa);
2986 defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, gpa);
29662987
29672988 // Check for empty filename.
29682989 const tok_slice = pp.expandedSliceExtra(filename_tok, .single_macro_ws);
......@@ -3024,9 +3045,12 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
30243045 try pp.err(l_paren, .malformed_embed_param, .{});
30253046 continue;
30263047 }
3027 try pp.char_buf.appendSlice(Attribute.normalize(pp.tokSlice(param_first)));
3028 try pp.char_buf.appendSlice("::");
3029 try pp.char_buf.appendSlice(Attribute.normalize(pp.tokSlice(param)));
3048 const vendor = Attribute.normalize(pp.tokSlice(param_first));
3049 const param_name = Attribute.normalize(pp.tokSlice(param));
3050 try pp.char_buf.ensureUnusedCapacity(gpa, vendor.len + 2 + param_name.len);
3051 pp.char_buf.appendSliceAssumeCapacity(vendor);
3052 pp.char_buf.appendSliceAssumeCapacity("::");
3053 pp.char_buf.appendSliceAssumeCapacity(param_name);
30303054 break :blk pp.char_buf.items;
30313055 },
30323056 .l_paren => Attribute.normalize(pp.tokSlice(param_first)),
......@@ -3044,7 +3068,7 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
30443068 try pp.err(maybe_colon, .malformed_embed_param, .{});
30453069 break;
30463070 }
3047 try pp.token_buf.append(next);
3071 try pp.token_buf.append(gpa, next);
30483072 }
30493073 const end: u32 = @intCast(pp.token_buf.items.len);
30503074
......@@ -3093,7 +3117,7 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
30933117
30943118 const embed_bytes = (try pp.comp.findEmbed(filename, first.source, include_type, limit orelse .unlimited, pp.dep_file)) orelse
30953119 return pp.fatalNotFound(filename_tok, filename);
3096 defer pp.comp.gpa.free(embed_bytes);
3120 defer gpa.free(embed_bytes);
30973121
30983122 try Range.expand(prefix, pp, tokenizer);
30993123
......@@ -3111,17 +3135,17 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
31113135 {
31123136 const byte = embed_bytes[0];
31133137 const start = pp.comp.generated_buf.items.len;
3114 try pp.comp.generated_buf.print(pp.gpa, "{d}", .{byte});
3138 try pp.comp.generated_buf.print(gpa, "{d}", .{byte});
31153139 pp.addTokenAssumeCapacity(try pp.makeGeneratedToken(start, .embed_byte, filename_tok));
31163140 }
31173141
31183142 for (embed_bytes[1..]) |byte| {
31193143 const start = pp.comp.generated_buf.items.len;
3120 try pp.comp.generated_buf.print(pp.gpa, ",{d}", .{byte});
3144 try pp.comp.generated_buf.print(gpa, ",{d}", .{byte});
31213145 pp.addTokenAssumeCapacity(.{ .id = .comma, .loc = .{ .id = .generated, .byte_offset = @intCast(start) } });
31223146 pp.addTokenAssumeCapacity(try pp.makeGeneratedToken(start + 1, .embed_byte, filename_tok));
31233147 }
3124 try pp.comp.generated_buf.append(pp.gpa, '\n');
3148 try pp.comp.generated_buf.append(gpa, '\n');
31253149
31263150 try Range.expand(suffix, pp, tokenizer);
31273151}
......@@ -3133,6 +3157,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
31333157 error.InvalidInclude => return,
31343158 else => |e| return e,
31353159 };
3160 const gpa = pp.comp.gpa;
31363161
31373162 // Prevent stack overflow
31383163 pp.include_depth += 1;
......@@ -3147,7 +3172,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
31473172 if (pp.defines.contains(guard)) return;
31483173 }
31493174
3150 if (pp.dep_file) |dep| try dep.addDependency(pp.gpa, new_source.path);
3175 if (pp.dep_file) |dep| try dep.addDependency(gpa, new_source.path);
31513176 if (pp.verbose) {
31523177 pp.verboseLog(first, "include file {s}", .{new_source.path});
31533178 }
......@@ -3156,7 +3181,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
31563181 try pp.addIncludeStart(new_source);
31573182 const eof = pp.preprocessExtra(new_source) catch |er| switch (er) {
31583183 error.StopPreprocessing => {
3159 for (pp.expansion_entries.items(.locs)[token_state.expansion_entries_len..]) |loc| TokenWithExpansionLocs.free(loc, pp.gpa);
3184 for (pp.expansion_entries.items(.locs)[token_state.expansion_entries_len..]) |loc| TokenWithExpansionLocs.free(loc, gpa);
31603185 pp.restoreTokenState(token_state);
31613186 return;
31623187 },
......@@ -3187,20 +3212,22 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
31873212/// operator_loc: Location of `_Pragma`; null if this is from #pragma
31883213/// arg_locs: expansion locations of the argument to _Pragma. empty if #pragma or a raw string literal was used
31893214fn makePragmaToken(pp: *Preprocessor, raw: RawToken, operator_loc: ?Source.Location, arg_locs: []const Source.Location) !TokenWithExpansionLocs {
3215 const gpa = pp.comp.gpa;
31903216 var tok = tokFromRaw(raw);
31913217 if (operator_loc) |loc| {
3192 try tok.addExpansionLocation(pp.gpa, &.{loc});
3218 try tok.addExpansionLocation(gpa, &.{loc});
31933219 }
3194 try tok.addExpansionLocation(pp.gpa, arg_locs);
3220 try tok.addExpansionLocation(gpa, arg_locs);
31953221 return tok;
31963222}
31973223
31983224pub fn addToken(pp: *Preprocessor, tok_arg: TokenWithExpansionLocs) !void {
3225 const gpa = pp.comp.gpa;
31993226 const tok = try pp.unescapeUcn(tok_arg);
32003227 if (tok.expansion_locs) |expansion_locs| {
3201 try pp.expansion_entries.append(pp.gpa, .{ .idx = @intCast(pp.tokens.len), .locs = expansion_locs });
3228 try pp.expansion_entries.append(gpa, .{ .idx = @intCast(pp.tokens.len), .locs = expansion_locs });
32023229 }
3203 try pp.tokens.append(pp.gpa, .{ .id = tok.id, .loc = tok.loc });
3230 try pp.tokens.append(gpa, .{ .id = tok.id, .loc = tok.loc });
32043231}
32053232
32063233pub fn addTokenAssumeCapacity(pp: *Preprocessor, tok: TokenWithExpansionLocs) void {
......@@ -3211,13 +3238,15 @@ pub fn addTokenAssumeCapacity(pp: *Preprocessor, tok: TokenWithExpansionLocs) vo
32113238}
32123239
32133240pub fn ensureTotalTokenCapacity(pp: *Preprocessor, capacity: usize) !void {
3214 try pp.tokens.ensureTotalCapacity(pp.gpa, capacity);
3215 try pp.expansion_entries.ensureTotalCapacity(pp.gpa, capacity);
3241 const gpa = pp.comp.gpa;
3242 try pp.tokens.ensureTotalCapacity(gpa, capacity);
3243 try pp.expansion_entries.ensureTotalCapacity(gpa, capacity);
32163244}
32173245
32183246pub fn ensureUnusedTokenCapacity(pp: *Preprocessor, capacity: usize) !void {
3219 try pp.tokens.ensureUnusedCapacity(pp.gpa, capacity);
3220 try pp.expansion_entries.ensureUnusedCapacity(pp.gpa, capacity);
3247 const gpa = pp.comp.gpa;
3248 try pp.tokens.ensureUnusedCapacity(gpa, capacity);
3249 try pp.expansion_entries.ensureUnusedCapacity(gpa, capacity);
32213250}
32223251
32233252/// Handle a pragma directive
......@@ -3285,10 +3314,11 @@ fn findIncludeFilenameToken(
32853314 const filename_tok, const expanded_trailing = switch (source_tok.id) {
32863315 .string_literal, .macro_string => .{ source_tok, false },
32873316 else => expanded: {
3317 const gpa = pp.comp.gpa;
32883318 // Try to expand if the argument is a macro.
32893319 pp.top_expansion_buf.items.len = 0;
3290 defer for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
3291 try pp.top_expansion_buf.append(source_tok);
3320 defer for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
3321 try pp.top_expansion_buf.append(gpa, source_tok);
32923322 pp.expansion_source_loc = source_tok.loc;
32933323
32943324 try pp.expandMacroExhaustive(tokenizer, &pp.top_expansion_buf, 0, 1, true, .non_expr);
......@@ -3298,7 +3328,7 @@ fn findIncludeFilenameToken(
32983328 return error.InvalidInclude;
32993329 };
33003330 const start = pp.comp.generated_buf.items.len;
3301 try pp.comp.generated_buf.appendSlice(pp.gpa, include_str);
3331 try pp.comp.generated_buf.appendSlice(gpa, include_str);
33023332
33033333 break :expanded .{ try pp.makeGeneratedToken(start, switch (include_str[0]) {
33043334 '"' => .string_literal,
......@@ -3326,7 +3356,7 @@ fn findIncludeFilenameToken(
33263356
33273357fn findIncludeSource(pp: *Preprocessor, tokenizer: *Tokenizer, first: RawToken, which: Compilation.WhichInclude) !Source {
33283358 const filename_tok = try pp.findIncludeFilenameToken(first, tokenizer, .expect_nl_eof);
3329 defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, pp.gpa);
3359 defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, pp.comp.gpa);
33303360
33313361 // Check for empty filename.
33323362 const tok_slice = pp.expandedSliceExtra(filename_tok, .single_macro_ws);
......@@ -3650,7 +3680,7 @@ test "destringify" {
36503680 const Test = struct {
36513681 fn testDestringify(pp: *Preprocessor, stringified: []const u8, destringified: []const u8) !void {
36523682 pp.char_buf.clearRetainingCapacity();
3653 try pp.char_buf.ensureUnusedCapacity(stringified.len);
3683 try pp.char_buf.ensureUnusedCapacity(gpa, stringified.len);
36543684 pp.destringify(stringified);
36553685 try std.testing.expectEqualStrings(destringified, pp.char_buf.items);
36563686 }
......@@ -3730,18 +3760,18 @@ test "Include guards" {
37303760
37313761 _ = try comp.addSourceFromBuffer(path, "int bar = 5;\n");
37323762
3733 var buf = std.array_list.Managed(u8).init(gpa);
3734 defer buf.deinit();
3763 var buf: std.ArrayList(u8) = .empty;
3764 defer buf.deinit(gpa);
37353765
37363766 switch (tok_id) {
3737 .keyword_include, .keyword_include_next => try buf.print(template, .{ tok_id.lexeme().?, " \"bar.h\"" }),
3738 .keyword_define, .keyword_undef => try buf.print(template, .{ tok_id.lexeme().?, " BAR" }),
3767 .keyword_include, .keyword_include_next => try buf.print(gpa, template, .{ tok_id.lexeme().?, " \"bar.h\"" }),
3768 .keyword_define, .keyword_undef => try buf.print(gpa, template, .{ tok_id.lexeme().?, " BAR" }),
37393769 .keyword_ifndef,
37403770 .keyword_ifdef,
37413771 .keyword_elifdef,
37423772 .keyword_elifndef,
3743 => try buf.print(template, .{ tok_id.lexeme().?, " BAR\n#endif" }),
3744 else => try buf.print(template, .{ tok_id.lexeme().?, "" }),
3773 => try buf.print(gpa, template, .{ tok_id.lexeme().?, " BAR\n#endif" }),
3774 else => try buf.print(gpa, template, .{ tok_id.lexeme().?, "" }),
37453775 }
37463776 const source = try comp.addSourceFromBuffer("test.h", buf.items);
37473777 _ = try pp.preprocess(source);
lib/compiler/aro/aro/Preprocessor/Diagnostic.zig+9
......@@ -10,6 +10,7 @@ fmt: []const u8,
1010kind: Diagnostics.Message.Kind,
1111opt: ?Diagnostics.Option = null,
1212extension: bool = false,
13show_in_system_headers: bool = false,
1314
1415pub const elif_without_if: Diagnostic = .{
1516 .fmt = "#elif without #if",
......@@ -91,6 +92,7 @@ pub const warning_directive: Diagnostic = .{
9192 .fmt = "{s}",
9293 .opt = .@"#warnings",
9394 .kind = .warning,
95 .show_in_system_headers = true,
9496};
9597
9698pub const macro_name_missing: Diagnostic = .{
......@@ -440,3 +442,10 @@ pub const invalid_source_epoch: Diagnostic = .{
440442 .fmt = "environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799",
441443 .kind = .@"error",
442444};
445
446pub const date_time: Diagnostic = .{
447 .fmt = "expansion of date or time macro is not reproducible",
448 .kind = .off,
449 .opt = .@"date-time",
450 .show_in_system_headers = true,
451};
lib/compiler/aro/aro/Source.zig+2
......@@ -38,6 +38,7 @@ pub const ExpandedLocation = struct {
3838 col: u32,
3939 width: u32,
4040 end_with_splice: bool,
41 kind: Kind,
4142};
4243
4344const Source = @This();
......@@ -120,6 +121,7 @@ pub fn lineCol(source: Source, loc: Location) ExpandedLocation {
120121 .col = col,
121122 .width = width,
122123 .end_with_splice = end_with_splice,
124 .kind = source.kind,
123125 };
124126}
125127
lib/compiler/aro/aro/SymbolStack.zig+10-10
......@@ -35,14 +35,14 @@ pub const Kind = enum {
3535 constexpr,
3636};
3737
38scopes: std.ArrayListUnmanaged(Scope) = .{},
38scopes: std.ArrayList(Scope) = .empty,
3939/// allocations from nested scopes are retained after popping; `active_len` is the number
4040/// of currently-active items in `scopes`.
4141active_len: usize = 0,
4242
4343const Scope = struct {
44 vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
45 tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
44 vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
45 tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
4646
4747 fn deinit(self: *Scope, allocator: Allocator) void {
4848 self.vars.deinit(allocator);
......@@ -66,7 +66,7 @@ pub fn deinit(s: *SymbolStack, gpa: Allocator) void {
6666
6767pub fn pushScope(s: *SymbolStack, p: *Parser) !void {
6868 if (s.active_len + 1 > s.scopes.items.len) {
69 try s.scopes.append(p.gpa, .{});
69 try s.scopes.append(p.comp.gpa, .{});
7070 s.active_len = s.scopes.items.len;
7171 } else {
7272 s.scopes.items[s.active_len].clearRetainingCapacity();
......@@ -195,7 +195,7 @@ pub fn defineTypedef(
195195 else => unreachable,
196196 }
197197 }
198 try s.define(p.gpa, .{
198 try s.define(p.comp.gpa, .{
199199 .kind = .typedef,
200200 .name = name,
201201 .tok = tok,
......@@ -245,7 +245,7 @@ pub fn defineSymbol(
245245 }
246246 }
247247
248 try s.define(p.gpa, .{
248 try s.define(p.comp.gpa, .{
249249 .kind = if (constexpr) .constexpr else .def,
250250 .name = name,
251251 .tok = tok,
......@@ -306,7 +306,7 @@ pub fn declareSymbol(
306306 else => unreachable,
307307 }
308308 }
309 try s.define(p.gpa, .{
309 try s.define(p.comp.gpa, .{
310310 .kind = .decl,
311311 .name = name,
312312 .tok = tok,
......@@ -317,7 +317,7 @@ pub fn declareSymbol(
317317
318318 // Declare out of scope symbol for functions declared in functions.
319319 if (s.active_len > 1 and !p.comp.langopts.standard.atLeast(.c23) and qt.is(p.comp, .func)) {
320 try s.scopes.items[0].vars.put(p.gpa, name, .{
320 try s.scopes.items[0].vars.put(p.comp.gpa, name, .{
321321 .kind = .decl,
322322 .name = name,
323323 .tok = tok,
......@@ -352,7 +352,7 @@ pub fn defineParam(
352352 else => unreachable,
353353 }
354354 }
355 try s.define(p.gpa, .{
355 try s.define(p.comp.gpa, .{
356356 .kind = .def,
357357 .name = name,
358358 .tok = tok,
......@@ -424,7 +424,7 @@ pub fn defineEnumeration(
424424 else => unreachable,
425425 }
426426 }
427 try s.define(p.gpa, .{
427 try s.define(p.comp.gpa, .{
428428 .kind = .enumeration,
429429 .name = name,
430430 .tok = tok,
lib/compiler/aro/aro/Toolchain.zig+40-38
......@@ -9,7 +9,7 @@ const Filesystem = @import("Driver/Filesystem.zig").Filesystem;
99const Multilib = @import("Driver/Multilib.zig");
1010const target_util = @import("target.zig");
1111
12pub const PathList = std.ArrayListUnmanaged([]const u8);
12pub const PathList = std.ArrayList([]const u8);
1313
1414pub const RuntimeLibKind = enum {
1515 compiler_rt,
......@@ -64,7 +64,6 @@ pub fn getTarget(tc: *const Toolchain) std.Target {
6464fn getDefaultLinker(tc: *const Toolchain) []const u8 {
6565 return switch (tc.inner) {
6666 .uninitialized => unreachable,
67 .linux => |linux| linux.getDefaultLinker(tc.getTarget()),
6867 .unknown => "ld",
6968 };
7069}
......@@ -72,6 +71,7 @@ fn getDefaultLinker(tc: *const Toolchain) []const u8 {
7271/// Call this after driver has finished parsing command line arguments to find the toolchain
7372pub fn discover(tc: *Toolchain) !void {
7473 if (tc.inner != .uninitialized) return;
74
7575 tc.inner = .unknown;
7676 return switch (tc.inner) {
7777 .uninitialized => unreachable,
......@@ -143,8 +143,11 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 {
143143 return use_linker;
144144 }
145145 } else {
146 var linker_name = try std.array_list.Managed(u8).initCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker
147 defer linker_name.deinit();
146 const gpa = tc.driver.comp.gpa;
147 var linker_name: std.ArrayList(u8) = .empty;
148 defer linker_name.deinit(gpa);
149 try linker_name.ensureUnusedCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker
150
148151 if (tc.getTarget().os.tag.isDarwin()) {
149152 linker_name.appendSliceAssumeCapacity("ld64.");
150153 } else {
......@@ -171,20 +174,27 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 {
171174/// TODO: this isn't exactly right since our target names don't necessarily match up
172175/// with GCC's.
173176/// For example the Zig target `arm-freestanding-eabi` would need the `arm-none-eabi` tools
174fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8, possible_names: *std.ArrayListUnmanaged([]const u8)) void {
177fn possibleProgramNames(
178 raw_triple: ?[]const u8,
179 name: []const u8,
180 buf: *[64]u8,
181 possible_name_buf: *[2][]const u8,
182) []const []const u8 {
183 var i: u32 = 0;
175184 if (raw_triple) |triple| {
176185 if (std.fmt.bufPrint(buf, "{s}-{s}", .{ triple, name })) |res| {
177 possible_names.appendAssumeCapacity(res);
186 possible_name_buf[i] = res;
187 i += 1;
178188 } else |_| {}
179189 }
180 possible_names.appendAssumeCapacity(name);
190 possible_name_buf[i] = name;
181191
182 return possible_names;
192 return possible_name_buf[0..i];
183193}
184194
185195/// Add toolchain `file_paths` to argv as `-L` arguments
186pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
187 try argv.ensureUnusedCapacity(tc.file_paths.items.len);
196pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
197 try argv.ensureUnusedCapacity(tc.driver.comp.gpa, tc.file_paths.items.len);
188198
189199 var bytes_needed: usize = 0;
190200 for (tc.file_paths.items) |path| {
......@@ -208,11 +218,10 @@ fn getProgramPath(tc: *const Toolchain, name: []const u8, buf: []u8) []const u8
208218 var fib = std.heap.FixedBufferAllocator.init(&path_buf);
209219
210220 var tool_specific_buf: [64]u8 = undefined;
211 var possible_names_buffer: [2][]const u8 = undefined;
212 var possible_names = std.ArrayListUnmanaged.initBuffer(&possible_names_buffer);
213 possibleProgramNames(tc.driver.raw_target_triple, name, &tool_specific_buf, &possible_names);
221 var possible_name_buf: [2][]const u8 = undefined;
222 const possible_names = possibleProgramNames(tc.driver.raw_target_triple, name, &tool_specific_buf, &possible_name_buf);
214223
215 for (possible_names.items) |tool_name| {
224 for (possible_names) |tool_name| {
216225 for (tc.program_paths.items) |program_path| {
217226 defer fib.reset();
218227
......@@ -318,16 +327,6 @@ pub fn addPathFromComponents(tc: *Toolchain, components: []const []const u8, des
318327 try dest.append(tc.driver.comp.gpa, full_path);
319328}
320329
321/// Add linker args to `argv`. Does not add path to linker executable as first item; that must be handled separately
322/// Items added to `argv` will be string literals or owned by `tc.driver.comp.arena` so they must not be individually freed
323pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
324 return switch (tc.inner) {
325 .uninitialized => unreachable,
326 .linux => |*linux| linux.buildLinkerArgs(tc, argv),
327 .unknown => @panic("This toolchain does not support linking yet"),
328 };
329}
330
331330fn getDefaultRuntimeLibKind(tc: *const Toolchain) RuntimeLibKind {
332331 if (tc.getTarget().abi.isAndroid()) {
333332 return .compiler_rt;
......@@ -400,7 +399,7 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 {
400399 }
401400}
402401
403fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
402fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
404403 const unw = try tc.getUnwindLibKind();
405404 const target = tc.getTarget();
406405 if ((target.abi.isAndroid() and unw == .libgcc) or
......@@ -410,46 +409,49 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const
410409
411410 const lgk = tc.getLibGCCKind();
412411 const as_needed = lgk == .unspecified and !target.abi.isAndroid() and !target_util.isCygwinMinGW(target) and target.os.tag != .aix;
412
413 try argv.ensureUnusedCapacity(tc.driver.comp.gpa, 3);
413414 if (as_needed) {
414 try argv.append(getAsNeededOption(target.os.tag == .solaris, true));
415 argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, true));
415416 }
416417 switch (unw) {
417418 .none => return,
418 .libgcc => if (lgk == .static) try argv.append("-lgcc_eh") else try argv.append("-lgcc_s"),
419 .libgcc => argv.appendAssumeCapacity(if (lgk == .static) "-lgcc_eh" else "-lgcc_s"),
419420 .compiler_rt => if (target.os.tag == .aix) {
420421 if (lgk != .static) {
421 try argv.append("-lunwind");
422 argv.appendAssumeCapacity("-lunwind");
422423 }
423424 } else if (lgk == .static) {
424 try argv.append("-l:libunwind.a");
425 argv.appendAssumeCapacity("-l:libunwind.a");
425426 } else if (lgk == .shared) {
426427 if (target_util.isCygwinMinGW(target)) {
427 try argv.append("-l:libunwind.dll.a");
428 argv.appendAssumeCapacity("-l:libunwind.dll.a");
428429 } else {
429 try argv.append("-l:libunwind.so");
430 argv.appendAssumeCapacity("-l:libunwind.so");
430431 }
431432 } else {
432 try argv.append("-lunwind");
433 argv.appendAssumeCapacity("-lunwind");
433434 },
434435 }
435436
436437 if (as_needed) {
437 try argv.append(getAsNeededOption(target.os.tag == .solaris, false));
438 argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, false));
438439 }
439440}
440441
441fn addLibGCC(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
442fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
443 const gpa = tc.driver.comp.gpa;
442444 const libgcc_kind = tc.getLibGCCKind();
443445 if (libgcc_kind == .static or libgcc_kind == .unspecified) {
444 try argv.append("-lgcc");
446 try argv.append(gpa, "-lgcc");
445447 }
446448 try tc.addUnwindLibrary(argv);
447449 if (libgcc_kind == .shared) {
448 try argv.append("-lgcc");
450 try argv.append(gpa, "-lgcc");
449451 }
450452}
451453
452pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
454pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
453455 const target = tc.getTarget();
454456 const rlt = tc.getRuntimeLibKind();
455457 switch (rlt) {
......@@ -469,7 +471,7 @@ pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]cons
469471 }
470472
471473 if (target.abi.isAndroid() and !tc.driver.static and !tc.driver.static_pie) {
472 try argv.append("-ldl");
474 try argv.append(tc.driver.comp.gpa, "-ldl");
473475 }
474476}
475477
lib/compiler/aro/aro/Tree.zig+4-4
......@@ -42,7 +42,7 @@ pub const TokenWithExpansionLocs = struct {
4242
4343 pub fn addExpansionLocation(tok: *TokenWithExpansionLocs, gpa: std.mem.Allocator, new: []const Source.Location) !void {
4444 if (new.len == 0 or tok.id == .whitespace or tok.id == .macro_ws or tok.id == .placemarker) return;
45 var list = std.array_list.Managed(Source.Location).init(gpa);
45 var list: std.ArrayList(Source.Location) = .empty;
4646 defer {
4747 @memset(list.items.ptr[list.items.len..list.capacity], .{});
4848 // Add a sentinel to indicate the end of the list since
......@@ -65,7 +65,7 @@ pub const TokenWithExpansionLocs = struct {
6565 const min_len = @max(list.items.len + new.len + 1, 4);
6666 const wanted_len = std.math.ceilPowerOfTwo(usize, min_len) catch
6767 return error.OutOfMemory;
68 try list.ensureTotalCapacity(wanted_len);
68 try list.ensureTotalCapacity(gpa, wanted_len);
6969
7070 for (new) |new_loc| {
7171 if (new_loc.id == .generated) continue;
......@@ -119,8 +119,8 @@ tokens: Token.List.Slice,
119119
120120// Values owned by this Tree
121121nodes: std.MultiArrayList(Node.Repr) = .empty,
122extra: std.ArrayListUnmanaged(u32) = .empty,
123root_decls: std.ArrayListUnmanaged(Node.Index) = .empty,
122extra: std.ArrayList(u32) = .empty,
123root_decls: std.ArrayList(Node.Index) = .empty,
124124value_map: ValueMap = .empty,
125125
126126pub const genIr = CodeGen.genIr;
lib/compiler/aro/aro/TypeStore.zig+13-13
......@@ -1216,6 +1216,13 @@ pub const QualType = packed struct(u32) {
12161216 return false;
12171217 },
12181218 .array => |array| {
1219 if (qt.@"const") {
1220 try w.writeAll("const ");
1221 }
1222 if (qt.@"volatile") {
1223 try w.writeAll("volatile");
1224 }
1225
12191226 const simple = try array.elem.printPrologue(comp, desugar, w);
12201227 if (simple) try w.writeByte(' ');
12211228 return false;
......@@ -1341,14 +1348,6 @@ pub const QualType = packed struct(u32) {
13411348
13421349 const static = array.len == .static;
13431350 if (static) try w.writeAll("static");
1344 if (qt.@"const") {
1345 if (static) try w.writeByte(' ');
1346 try w.writeAll("const");
1347 }
1348 if (qt.@"volatile") {
1349 if (static or qt.@"const") try w.writeByte(' ');
1350 try w.writeAll("volatile");
1351 }
13521351 if (qt.restrict) {
13531352 if (static or qt.@"const" or qt.@"volatile") try w.writeByte(' ');
13541353 try w.writeAll("restrict");
......@@ -1694,8 +1693,8 @@ pub const Type = union(enum) {
16941693};
16951694
16961695types: std.MultiArrayList(Repr) = .empty,
1697extra: std.ArrayListUnmanaged(u32) = .empty,
1698attributes: std.ArrayListUnmanaged(Attribute) = .empty,
1696extra: std.ArrayList(u32) = .empty,
1697attributes: std.ArrayList(Attribute) = .empty,
16991698anon_name_arena: std.heap.ArenaAllocator.State = .{},
17001699
17011700wchar: QualType = .invalid,
......@@ -2435,7 +2434,7 @@ pub const Builder = struct {
24352434 }
24362435 if (b.complex_tok) |tok| try b.parser.err(tok, .complex_int, .{});
24372436
2438 const qt = try b.parser.comp.type_store.put(b.parser.gpa, .{ .bit_int = .{
2437 const qt = try b.parser.comp.type_store.put(b.parser.comp.gpa, .{ .bit_int = .{
24392438 .signedness = if (unsigned) .unsigned else .signed,
24402439 .bits = @intCast(bits),
24412440 } });
......@@ -2476,6 +2475,7 @@ pub const Builder = struct {
24762475
24772476 pub fn finishQuals(b: Builder, qt: QualType) !QualType {
24782477 if (qt.isInvalid()) return .invalid;
2478 const gpa = b.parser.comp.gpa;
24792479 var result_qt = qt;
24802480 if (b.atomic_type orelse b.atomic) |atomic_tok| {
24812481 if (result_qt.isAutoType()) return b.parser.todo("_Atomic __auto_type");
......@@ -2505,7 +2505,7 @@ pub const Builder = struct {
25052505 return .invalid;
25062506 },
25072507 else => {
2508 result_qt = try b.parser.comp.type_store.put(b.parser.gpa, .{ .atomic = result_qt });
2508 result_qt = try b.parser.comp.type_store.put(gpa, .{ .atomic = result_qt });
25092509 },
25102510 }
25112511 }
......@@ -2514,7 +2514,7 @@ pub const Builder = struct {
25142514 const is_pointer = qt.isAutoType() or qt.isC23Auto() or qt.base(b.parser.comp).type == .pointer;
25152515
25162516 if (b.unaligned != null and !is_pointer) {
2517 result_qt = (try b.parser.comp.type_store.put(b.parser.gpa, .{ .attributed = .{
2517 result_qt = (try b.parser.comp.type_store.put(gpa, .{ .attributed = .{
25182518 .base = result_qt,
25192519 .attributes = &.{.{ .tag = .unaligned, .args = .{ .unaligned = .{} }, .syntax = .keyword }},
25202520 } })).withQualifiers(result_qt);
lib/compiler/aro/aro/pragmas/gcc.zig+2-2
......@@ -20,7 +20,7 @@ pragma: Pragma = .{
2020 .preserveTokens = preserveTokens,
2121},
2222original_state: Diagnostics.State = .{},
23state_stack: std.ArrayListUnmanaged(Diagnostics.State) = .{},
23state_stack: std.ArrayList(Diagnostics.State) = .empty,
2424
2525const Directive = enum {
2626 warning,
......@@ -138,7 +138,7 @@ fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex
138138 if (pp.defines.get(str) != null) {
139139 try Pragma.err(pp, start_idx + i, .pragma_poison_macro, .{});
140140 }
141 try pp.poisoned_identifiers.put(str, {});
141 try pp.poisoned_identifiers.put(pp.comp.gpa, str, {});
142142 }
143143 return;
144144 },
lib/compiler/aro/aro/pragmas/message.zig+1-1
......@@ -44,7 +44,7 @@ fn preprocessorHandler(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pra
4444
4545 const diagnostic: Pragma.Diagnostic = .pragma_message;
4646
47 var sf = std.heap.stackFallback(1024, pp.gpa);
47 var sf = std.heap.stackFallback(1024, pp.comp.gpa);
4848 var allocating: std.Io.Writer.Allocating = .init(sf.get());
4949 defer allocating.deinit();
5050
lib/compiler/aro/aro/pragmas/once.zig+5-6
......@@ -17,14 +17,12 @@ pragma: Pragma = .{
1717 .preprocessorHandler = preprocessorHandler,
1818 .preserveTokens = preserveTokens,
1919},
20pragma_once: std.AutoHashMap(Source.Id, void),
20pragma_once: std.AutoHashMapUnmanaged(Source.Id, void) = .empty,
2121preprocess_count: u32 = 0,
2222
2323pub fn init(allocator: mem.Allocator) !*Pragma {
2424 var once = try allocator.create(Once);
25 once.* = .{
26 .pragma_once = std.AutoHashMap(Source.Id, void).init(allocator),
27 };
25 once.* = .{};
2826 return &once.pragma;
2927}
3028
......@@ -35,8 +33,9 @@ fn afterParse(pragma: *Pragma, _: *Compilation) void {
3533
3634fn deinit(pragma: *Pragma, comp: *Compilation) void {
3735 var self: *Once = @fieldParentPtr("pragma", pragma);
38 self.pragma_once.deinit();
36 self.pragma_once.deinit(comp.gpa);
3937 comp.gpa.destroy(self);
38 pragma.* = undefined;
4039}
4140
4241fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void {
......@@ -53,7 +52,7 @@ fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex
5352 }, pp.expansionSlice(start_idx + 1), true);
5453 }
5554 const seen = self.preprocess_count == pp.preprocess_count;
56 const prev = try self.pragma_once.fetchPut(name_tok.loc.id, {});
55 const prev = try self.pragma_once.fetchPut(pp.comp.gpa, name_tok.loc.id, {});
5756 if (prev != null and !seen) {
5857 return error.StopPreprocessing;
5958 }
lib/compiler/aro/aro/pragmas/pack.zig+2-2
......@@ -15,7 +15,7 @@ pragma: Pragma = .{
1515 .deinit = deinit,
1616 .parserHandler = parserHandler,
1717},
18stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{},
18stack: std.ArrayList(struct { label: []const u8, val: u8 }) = .empty,
1919
2020pub fn init(allocator: mem.Allocator) !*Pragma {
2121 var pack = try allocator.create(Pack);
......@@ -82,7 +82,7 @@ fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation
8282 }
8383 }
8484 if (action == .push) {
85 try pack.stack.append(p.gpa, .{ .label = label orelse "", .val = p.pragma_pack orelse 8 });
85 try pack.stack.append(p.comp.gpa, .{ .label = label orelse "", .val = p.pragma_pack orelse 8 });
8686 } else {
8787 pack.pop(p, label);
8888 if (new_val != null) {
lib/compiler/aro/assembly_backend/x86_64.zig+5-4
......@@ -70,10 +70,11 @@ pub fn todo(c: *AsmCodeGen, msg: []const u8, tok: Tree.TokenIndex) Error {
7070 const loc: Source.Location = c.tree.tokens.items(.loc)[tok];
7171
7272 var sf = std.heap.stackFallback(1024, c.comp.gpa);
73 var buf = std.ArrayList(u8).init(sf.get());
74 defer buf.deinit();
73 const allocator = sf.get();
74 var buf: std.ArrayList(u8) = .empty;
75 defer buf.deinit(allocator);
7576
76 try buf.print("TODO: {s}", .{msg});
77 try buf.print(allocator, "TODO: {s}", .{msg});
7778 try c.comp.diagnostics.add(.{
7879 .text = buf.items,
7980 .kind = .@"error",
......@@ -163,7 +164,7 @@ pub fn genAsm(tree: *const Tree) Error!Assembly {
163164}
164165
165166fn genDecls(c: *AsmCodeGen) !void {
166 if (c.tree.comp.code_gen_options.debug) {
167 if (c.tree.comp.code_gen_options.debug != .strip) {
167168 const sources = c.tree.comp.sources.values();
168169 for (sources) |source| {
169170 try c.data.print(" .file {d} \"{s}\"\n", .{ @intFromEnum(source.id) - 1, source.path });
lib/compiler/aro/backend/CodeGenOptions.zig+14
......@@ -66,6 +66,20 @@ pub const OptimizationLevel = enum {
6666 pub fn fromString(str: []const u8) ?OptimizationLevel {
6767 return level_map.get(str);
6868 }
69
70 pub fn isSizeOptimized(self: OptimizationLevel) bool {
71 return switch (self) {
72 .s, .z => true,
73 .@"0", .@"1", .@"2", .@"3", .fast, .g => false,
74 };
75 }
76
77 pub fn hasAnyOptimizations(self: OptimizationLevel) bool {
78 return switch (self) {
79 .@"0" => false,
80 .@"1", .@"2", .@"3", .s, .fast, .g, .z => true,
81 };
82 }
6983};
7084
7185pub const default: @This() = .{
lib/compiler/aro/backend/Interner.zig+5-5
......@@ -8,14 +8,14 @@ const Limb = std.math.big.Limb;
88
99const Interner = @This();
1010
11map: std.AutoArrayHashMapUnmanaged(void, void) = .{},
11map: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
1212items: std.MultiArrayList(struct {
1313 tag: Tag,
1414 data: u32,
15}) = .{},
16extra: std.ArrayListUnmanaged(u32) = .{},
17limbs: std.ArrayListUnmanaged(Limb) = .{},
18strings: std.ArrayListUnmanaged(u8) = .{},
15}) = .empty,
16extra: std.ArrayList(u32) = .empty,
17limbs: std.ArrayList(Limb) = .empty,
18strings: std.ArrayList(u8) = .empty,
1919
2020const KeyAdapter = struct {
2121 interner: *const Interner,
lib/compiler/aro/backend/Ir.zig+20-20
......@@ -11,7 +11,7 @@ decls: std.StringArrayHashMapUnmanaged(Decl),
1111
1212pub const Decl = struct {
1313 instructions: std.MultiArrayList(Inst),
14 body: std.ArrayListUnmanaged(Ref),
14 body: std.ArrayList(Ref),
1515 arena: std.heap.ArenaAllocator.State,
1616
1717 pub fn deinit(decl: *Decl, gpa: Allocator) void {
......@@ -26,9 +26,9 @@ pub const Builder = struct {
2626 arena: std.heap.ArenaAllocator,
2727 interner: *Interner,
2828
29 decls: std.StringArrayHashMapUnmanaged(Decl) = .{},
30 instructions: std.MultiArrayList(Ir.Inst) = .{},
31 body: std.ArrayListUnmanaged(Ref) = .{},
29 decls: std.StringArrayHashMapUnmanaged(Decl) = .empty,
30 instructions: std.MultiArrayList(Ir.Inst) = .empty,
31 body: std.ArrayList(Ref) = .empty,
3232 alloc_count: u32 = 0,
3333 arg_count: u32 = 0,
3434 current_label: Ref = undefined,
......@@ -380,7 +380,7 @@ const REF = std.Io.tty.Color.bright_blue;
380380const LITERAL = std.Io.tty.Color.bright_green;
381381const ATTRIBUTE = std.Io.tty.Color.bright_yellow;
382382
383const RefMap = std.AutoArrayHashMap(Ref, void);
383const RefMap = std.AutoArrayHashMapUnmanaged(Ref, void);
384384
385385pub fn dump(ir: *const Ir, gpa: Allocator, config: std.Io.tty.Config, w: *std.Io.Writer) !void {
386386 for (ir.decls.keys(), ir.decls.values()) |name, *decl| {
......@@ -393,11 +393,11 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
393393 const tags = decl.instructions.items(.tag);
394394 const data = decl.instructions.items(.data);
395395
396 var ref_map = RefMap.init(gpa);
397 defer ref_map.deinit();
396 var ref_map: RefMap = .empty;
397 defer ref_map.deinit(gpa);
398398
399 var label_map = RefMap.init(gpa);
400 defer label_map.deinit();
399 var label_map: RefMap = .empty;
400 defer label_map.deinit(gpa);
401401
402402 const ret_inst = decl.body.items[decl.body.items.len - 1];
403403 const ret_operand = data[@intFromEnum(ret_inst)].un;
......@@ -413,14 +413,14 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
413413 const ref = decl.body.items[arg_count];
414414 if (tags[@intFromEnum(ref)] != .arg) break;
415415 if (arg_count != 0) try w.writeAll(", ");
416 try ref_map.put(ref, {});
416 try ref_map.put(gpa, ref, {});
417417 try ir.writeRef(decl, &ref_map, ref, config, w);
418418 try config.setColor(w, .reset);
419419 }
420420 try w.writeAll(") {\n");
421421 for (decl.body.items[arg_count..]) |ref| {
422422 switch (tags[@intFromEnum(ref)]) {
423 .label => try label_map.put(ref, {}),
423 .label => try label_map.put(gpa, ref, {}),
424424 else => {},
425425 }
426426 }
......@@ -461,7 +461,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
461461 },
462462 .select => {
463463 const br = data[i].branch;
464 try ir.writeNewRef(decl, &ref_map, ref, config, w);
464 try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
465465 try w.writeAll("select ");
466466 try ir.writeRef(decl, &ref_map, br.cond, config, w);
467467 try config.setColor(w, .reset);
......@@ -501,7 +501,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
501501 },
502502 .call => {
503503 const call = data[i].call;
504 try ir.writeNewRef(decl, &ref_map, ref, config, w);
504 try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
505505 try w.writeAll("call ");
506506 try ir.writeRef(decl, &ref_map, call.func, config, w);
507507 try config.setColor(w, .reset);
......@@ -515,7 +515,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
515515 },
516516 .alloc => {
517517 const alloc = data[i].alloc;
518 try ir.writeNewRef(decl, &ref_map, ref, config, w);
518 try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
519519 try w.writeAll("alloc ");
520520 try config.setColor(w, ATTRIBUTE);
521521 try w.writeAll("size ");
......@@ -528,7 +528,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
528528 try w.writeByte('\n');
529529 },
530530 .phi => {
531 try ir.writeNewRef(decl, &ref_map, ref, config, w);
531 try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
532532 try w.writeAll("phi");
533533 try config.setColor(w, .reset);
534534 try w.writeAll(" {");
......@@ -560,7 +560,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
560560 try w.writeByte('\n');
561561 },
562562 .load => {
563 try ir.writeNewRef(decl, &ref_map, ref, config, w);
563 try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
564564 try w.writeAll("load ");
565565 try ir.writeRef(decl, &ref_map, data[i].un, config, w);
566566 try w.writeByte('\n');
......@@ -583,7 +583,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
583583 .mod,
584584 => {
585585 const bin = data[i].bin;
586 try ir.writeNewRef(decl, &ref_map, ref, config, w);
586 try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
587587 try w.print("{s} ", .{@tagName(tag)});
588588 try ir.writeRef(decl, &ref_map, bin.lhs, config, w);
589589 try config.setColor(w, .reset);
......@@ -598,7 +598,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
598598 .sext,
599599 => {
600600 const un = data[i].un;
601 try ir.writeNewRef(decl, &ref_map, ref, config, w);
601 try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
602602 try w.print("{s} ", .{@tagName(tag)});
603603 try ir.writeRef(decl, &ref_map, un, config, w);
604604 try w.writeByte('\n');
......@@ -679,8 +679,8 @@ fn writeRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, config: std.I
679679 try w.print(" %{d}", .{ref_index});
680680}
681681
682fn writeNewRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, config: std.Io.tty.Config, w: *std.Io.Writer) !void {
683 try ref_map.put(ref, {});
682fn writeNewRef(ir: Ir, gpa: Allocator, decl: *const Decl, ref_map: *RefMap, ref: Ref, config: std.Io.tty.Config, w: *std.Io.Writer) !void {
683 try ref_map.put(gpa, ref, {});
684684 try w.writeAll(" ");
685685 try ir.writeRef(decl, ref_map, ref, config, w);
686686 try config.setColor(w, .reset);
lib/compiler/aro/backend/Object.zig+1-1
......@@ -30,7 +30,7 @@ pub const Section = union(enum) {
3030 custom: []const u8,
3131};
3232
33pub fn getSection(obj: *Object, section: Section) !*std.array_list.Managed(u8) {
33pub fn getSection(obj: *Object, section: Section) !*std.ArrayList(u8) {
3434 switch (obj.format) {
3535 .elf => return @as(*Elf, @alignCast(@fieldParentPtr("obj", obj))).getSection(section),
3636 else => unreachable,
lib/compiler/aro/backend/Object/Elf.zig+8-8
......@@ -4,8 +4,8 @@ const Target = std.Target;
44const Object = @import("../Object.zig");
55
66const Section = struct {
7 data: std.array_list.Managed(u8),
8 relocations: std.ArrayListUnmanaged(Relocation) = .{},
7 data: std.ArrayList(u8) = .empty,
8 relocations: std.ArrayList(Relocation) = .empty,
99 flags: u64,
1010 type: u32,
1111 index: u16 = undefined,
......@@ -37,9 +37,9 @@ const Elf = @This();
3737
3838obj: Object,
3939/// The keys are owned by the Codegen.tree
40sections: std.StringHashMapUnmanaged(*Section) = .{},
41local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
42global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
40sections: std.StringHashMapUnmanaged(*Section) = .empty,
41local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
42global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
4343unnamed_symbol_mangle: u32 = 0,
4444strtab_len: u64 = strtab_default.len,
4545arena: std.heap.ArenaAllocator,
......@@ -58,7 +58,7 @@ pub fn deinit(elf: *Elf) void {
5858 {
5959 var it = elf.sections.valueIterator();
6060 while (it.next()) |sect| {
61 sect.*.data.deinit();
61 sect.*.data.deinit(gpa);
6262 sect.*.relocations.deinit(gpa);
6363 }
6464 }
......@@ -80,12 +80,12 @@ fn sectionString(sec: Object.Section) []const u8 {
8080 };
8181}
8282
83pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.array_list.Managed(u8) {
83pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.ArrayList(u8) {
8484 const section_name = sectionString(section_kind);
8585 const section = elf.sections.get(section_name) orelse blk: {
8686 const section = try elf.arena.allocator().create(Section);
8787 section.* = .{
88 .data = std.array_list.Managed(u8).init(elf.arena.child_allocator),
88 .data = std.ArrayList(u8).init(elf.arena.child_allocator),
8989 .type = std.elf.SHT_PROGBITS,
9090 .flags = switch (section_kind) {
9191 .func, .custom => std.elf.SHF_ALLOC + std.elf.SHF_EXECINSTR,
lib/compiler/translate-c/main.zig+1-1
......@@ -150,7 +150,7 @@ fn translate(d: *aro.Driver, tc: *aro.Toolchain, args: [][:0]u8) !void {
150150 // be written to a tmp file then renamed into place, meaning the path will be
151151 // wrong as soon as the work is done.
152152 var opt_dep_file = try d.initDepFile(source, &name_buf, true);
153 defer if (opt_dep_file) |*dep_file| dep_file.deinit(pp.gpa);
153 defer if (opt_dep_file) |*dep_file| dep_file.deinit(gpa);
154154
155155 if (opt_dep_file) |*dep_file| pp.dep_file = dep_file;
156156