| author | |
| committer | |
| log | 8cba6b1df813279735bf831018489a9e03788413 |
| tree | 4e1e9d16bc6216dbfbd65b2d393f308157b93635 |
| parent | 01132e0cf87a4e9ee5639b4b6b4b39606feab6a9 |
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( |
| 345 | 345 | |
| 346 | 346 | pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, arg_start: TokenIndex, node: Tree.Node, p: *Parser) !bool { |
| 347 | 347 | switch (attr) { |
| 348 | .nonnull => return false, | |
| 348 | 349 | inline else => |tag| { |
| 349 | 350 | const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)]; |
| 350 | 351 | const max_arg_count = comptime maxArgCount(tag); |
| ... | ... | @@ -532,10 +533,7 @@ const attributes = struct { |
| 532 | 533 | pub const @"noinline" = struct {}; |
| 533 | 534 | pub const noipa = struct {}; |
| 534 | 535 | // TODO: arbitrary number of arguments |
| 535 | // const nonnull = struct { | |
| 536 | // // arg_index: []const u32, | |
| 537 | // }; | |
| 538 | // }; | |
| 536 | pub const nonnull = struct {}; | |
| 539 | 537 | pub const nonstring = struct {}; |
| 540 | 538 | pub const noplt = struct {}; |
| 541 | 539 | pub const @"noreturn" = struct {}; |
| ... | ... | @@ -802,8 +800,16 @@ fn ignoredAttrErr(p: *Parser, tok: TokenIndex, attr: Attribute.Tag, context: []c |
| 802 | 800 | try p.errStr(.ignored_attribute, tok, str); |
| 803 | 801 | } |
| 804 | 802 | |
| 805 | pub const applyParameterAttributes = applyVariableAttributes; | |
| 803 | pub 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 | ||
| 806 | 807 | pub 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 | ||
| 811 | fn applyVariableOrParameterAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic, context: enum { parameter, variable }) !QualType { | |
| 812 | const gpa = p.comp.gpa; | |
| 807 | 813 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; |
| 808 | 814 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; |
| 809 | 815 | p.attr_application_buf.items.len = 0; |
| ... | ... | @@ -814,27 +820,33 @@ pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, |
| 814 | 820 | // zig fmt: off |
| 815 | 821 | .alias, .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .weak, .used, |
| 816 | 822 | .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), | |
| 818 | 824 | // zig fmt: on |
| 819 | 825 | .common => if (nocommon) { |
| 820 | 826 | try p.err(tok, .ignore_common, .{}); |
| 821 | 827 | } else { |
| 822 | try p.attr_application_buf.append(p.gpa, attr); | |
| 828 | try p.attr_application_buf.append(gpa, attr); | |
| 823 | 829 | common = true; |
| 824 | 830 | }, |
| 825 | 831 | .nocommon => if (common) { |
| 826 | 832 | try p.err(tok, .ignore_nocommon, .{}); |
| 827 | 833 | } else { |
| 828 | try p.attr_application_buf.append(p.gpa, attr); | |
| 834 | try p.attr_application_buf.append(gpa, attr); | |
| 829 | 835 | nocommon = true; |
| 830 | 836 | }, |
| 831 | 837 | .vector_size => try attr.applyVectorSize(p, tok, &base_qt), |
| 832 | 838 | .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 | }, | |
| 833 | 845 | .nonstring => { |
| 834 | 846 | if (base_qt.get(p.comp, .array)) |array_ty| { |
| 835 | 847 | if (array_ty.elem.get(p.comp, .int)) |int_ty| switch (int_ty) { |
| 836 | 848 | .char, .uchar, .schar => { |
| 837 | try p.attr_application_buf.append(p.gpa, attr); | |
| 849 | try p.attr_application_buf.append(gpa, attr); | |
| 838 | 850 | continue; |
| 839 | 851 | }, |
| 840 | 852 | else => {}, |
| ... | ... | @@ -845,12 +857,12 @@ pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, |
| 845 | 857 | .uninitialized => if (p.func.qt == null) { |
| 846 | 858 | try p.err(tok, .local_variable_attribute, .{"uninitialized"}); |
| 847 | 859 | } else { |
| 848 | try p.attr_application_buf.append(p.gpa, attr); | |
| 860 | try p.attr_application_buf.append(gpa, attr); | |
| 849 | 861 | }, |
| 850 | 862 | .cleanup => if (p.func.qt == null) { |
| 851 | 863 | try p.err(tok, .local_variable_attribute, .{"cleanup"}); |
| 852 | 864 | } else { |
| 853 | try p.attr_application_buf.append(p.gpa, attr); | |
| 865 | try p.attr_application_buf.append(gpa, attr); | |
| 854 | 866 | }, |
| 855 | 867 | .calling_convention => try applyCallingConvention(attr, p, tok, base_qt), |
| 856 | 868 | .alloc_size, |
| ... | ... | @@ -873,7 +885,7 @@ pub fn applyFieldAttributes(p: *Parser, field_qt: *QualType, attr_buf_start: usi |
| 873 | 885 | // zig fmt: off |
| 874 | 886 | .@"packed", .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, |
| 875 | 887 | .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), | |
| 877 | 889 | // zig fmt: on |
| 878 | 890 | .vector_size => try attr.applyVectorSize(p, tok, field_qt), |
| 879 | 891 | .aligned => try attr.applyAligned(p, field_qt.*, null), |
| ... | ... | @@ -884,6 +896,7 @@ pub fn applyFieldAttributes(p: *Parser, field_qt: *QualType, attr_buf_start: usi |
| 884 | 896 | } |
| 885 | 897 | |
| 886 | 898 | pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic) !QualType { |
| 899 | const gpa = p.comp.gpa; | |
| 887 | 900 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; |
| 888 | 901 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; |
| 889 | 902 | p.attr_application_buf.items.len = 0; |
| ... | ... | @@ -891,13 +904,13 @@ pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diag |
| 891 | 904 | for (attrs, toks) |attr, tok| switch (attr.tag) { |
| 892 | 905 | // zig fmt: off |
| 893 | 906 | .@"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), | |
| 895 | 908 | // zig fmt: on |
| 896 | 909 | .transparent_union => try attr.applyTransparentUnion(p, tok, base_qt), |
| 897 | 910 | .vector_size => try attr.applyVectorSize(p, tok, &base_qt), |
| 898 | 911 | .aligned => try attr.applyAligned(p, base_qt, diagnostic), |
| 899 | 912 | .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); | |
| 901 | 914 | } else { |
| 902 | 915 | try p.err(tok, .designated_init_invalid, .{}); |
| 903 | 916 | }, |
| ... | ... | @@ -913,6 +926,7 @@ pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diag |
| 913 | 926 | } |
| 914 | 927 | |
| 915 | 928 | pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) !QualType { |
| 929 | const gpa = p.comp.gpa; | |
| 916 | 930 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; |
| 917 | 931 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; |
| 918 | 932 | p.attr_application_buf.items.len = 0; |
| ... | ... | @@ -927,37 +941,37 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 927 | 941 | .@"const", .warn_unused_result, .section, .returns_nonnull, .returns_twice, .@"error", |
| 928 | 942 | .externally_visible, .retain, .flatten, .gnu_inline, .alias, .asm_label, .nodiscard, |
| 929 | 943 | .reproducible, .unsequenced, .nothrow, .nullability, .unaligned, |
| 930 | => try p.attr_application_buf.append(p.gpa, attr), | |
| 944 | => try p.attr_application_buf.append(gpa, attr), | |
| 931 | 945 | // zig fmt: on |
| 932 | 946 | .hot => if (cold) { |
| 933 | 947 | try p.err(tok, .ignore_hot, .{}); |
| 934 | 948 | } else { |
| 935 | try p.attr_application_buf.append(p.gpa, attr); | |
| 949 | try p.attr_application_buf.append(gpa, attr); | |
| 936 | 950 | hot = true; |
| 937 | 951 | }, |
| 938 | 952 | .cold => if (hot) { |
| 939 | 953 | try p.err(tok, .ignore_cold, .{}); |
| 940 | 954 | } else { |
| 941 | try p.attr_application_buf.append(p.gpa, attr); | |
| 955 | try p.attr_application_buf.append(gpa, attr); | |
| 942 | 956 | cold = true; |
| 943 | 957 | }, |
| 944 | 958 | .always_inline => if (@"noinline") { |
| 945 | 959 | try p.err(tok, .ignore_always_inline, .{}); |
| 946 | 960 | } else { |
| 947 | try p.attr_application_buf.append(p.gpa, attr); | |
| 961 | try p.attr_application_buf.append(gpa, attr); | |
| 948 | 962 | always_inline = true; |
| 949 | 963 | }, |
| 950 | 964 | .@"noinline" => if (always_inline) { |
| 951 | 965 | try p.err(tok, .ignore_noinline, .{}); |
| 952 | 966 | } else { |
| 953 | try p.attr_application_buf.append(p.gpa, attr); | |
| 967 | try p.attr_application_buf.append(gpa, attr); | |
| 954 | 968 | @"noinline" = true; |
| 955 | 969 | }, |
| 956 | 970 | .aligned => try attr.applyAligned(p, base_qt, null), |
| 957 | 971 | .format => try attr.applyFormat(p, base_qt), |
| 958 | 972 | .calling_convention => try applyCallingConvention(attr, p, tok, base_qt), |
| 959 | 973 | .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, .{ | |
| 961 | 975 | .tag = .calling_convention, |
| 962 | 976 | .args = .{ .calling_convention = .{ .cc = .fastcall } }, |
| 963 | 977 | .syntax = attr.syntax, |
| ... | ... | @@ -966,7 +980,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 966 | 980 | try p.err(tok, .callconv_not_supported, .{"fastcall"}); |
| 967 | 981 | }, |
| 968 | 982 | .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, .{ | |
| 970 | 984 | .tag = .calling_convention, |
| 971 | 985 | .args = .{ .calling_convention = .{ .cc = .stdcall } }, |
| 972 | 986 | .syntax = attr.syntax, |
| ... | ... | @@ -975,7 +989,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 975 | 989 | try p.err(tok, .callconv_not_supported, .{"stdcall"}); |
| 976 | 990 | }, |
| 977 | 991 | .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, .{ | |
| 979 | 993 | .tag = .calling_convention, |
| 980 | 994 | .args = .{ .calling_convention = .{ .cc = .thiscall } }, |
| 981 | 995 | .syntax = attr.syntax, |
| ... | ... | @@ -984,7 +998,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 984 | 998 | try p.err(tok, .callconv_not_supported, .{"thiscall"}); |
| 985 | 999 | }, |
| 986 | 1000 | .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, .{ | |
| 988 | 1002 | .tag = .calling_convention, |
| 989 | 1003 | .args = .{ .calling_convention = .{ .cc = .vectorcall } }, |
| 990 | 1004 | .syntax = attr.syntax, |
| ... | ... | @@ -994,7 +1008,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 994 | 1008 | }, |
| 995 | 1009 | .cdecl => {}, |
| 996 | 1010 | .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, .{ | |
| 998 | 1012 | .tag = .calling_convention, |
| 999 | 1013 | .args = .{ .calling_convention = .{ .cc = switch (attr.args.pcs.kind) { |
| 1000 | 1014 | .aapcs => .arm_aapcs, |
| ... | ... | @@ -1006,7 +1020,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1006 | 1020 | try p.err(tok, .callconv_not_supported, .{"pcs"}); |
| 1007 | 1021 | }, |
| 1008 | 1022 | .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, .{ | |
| 1010 | 1024 | .tag = .calling_convention, |
| 1011 | 1025 | .args = .{ .calling_convention = .{ .cc = .riscv_vector } }, |
| 1012 | 1026 | .syntax = attr.syntax, |
| ... | ... | @@ -1015,7 +1029,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1015 | 1029 | try p.err(tok, .callconv_not_supported, .{"pcs"}); |
| 1016 | 1030 | }, |
| 1017 | 1031 | .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, .{ | |
| 1019 | 1033 | .tag = .calling_convention, |
| 1020 | 1034 | .args = .{ .calling_convention = .{ .cc = .aarch64_sve_pcs } }, |
| 1021 | 1035 | .syntax = attr.syntax, |
| ... | ... | @@ -1024,7 +1038,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1024 | 1038 | try p.err(tok, .callconv_not_supported, .{"pcs"}); |
| 1025 | 1039 | }, |
| 1026 | 1040 | .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, .{ | |
| 1028 | 1042 | .tag = .calling_convention, |
| 1029 | 1043 | .args = .{ .calling_convention = .{ .cc = .aarch64_vector_pcs } }, |
| 1030 | 1044 | .syntax = attr.syntax, |
| ... | ... | @@ -1033,14 +1047,14 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1033 | 1047 | try p.err(tok, .callconv_not_supported, .{"pcs"}); |
| 1034 | 1048 | }, |
| 1035 | 1049 | .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, .{ | |
| 1037 | 1051 | .tag = .calling_convention, |
| 1038 | 1052 | .args = .{ .calling_convention = .{ .cc = .x86_64_sysv } }, |
| 1039 | 1053 | .syntax = attr.syntax, |
| 1040 | 1054 | }); |
| 1041 | 1055 | }, |
| 1042 | 1056 | .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, .{ | |
| 1044 | 1058 | .tag = .calling_convention, |
| 1045 | 1059 | .args = .{ .calling_convention = .{ .cc = .x86_64_win } }, |
| 1046 | 1060 | .syntax = attr.syntax, |
| ... | ... | @@ -1048,7 +1062,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1048 | 1062 | }, |
| 1049 | 1063 | .malloc => { |
| 1050 | 1064 | 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); | |
| 1052 | 1066 | } else { |
| 1053 | 1067 | try ignoredAttrErr(p, tok, attr.tag, "functions that do not return pointers"); |
| 1054 | 1068 | } |
| ... | ... | @@ -1065,7 +1079,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1065 | 1079 | if (!arg_sk.isInt() or !arg_sk.isReal()) { |
| 1066 | 1080 | try p.err(tok, .alloc_align_required_int_param, .{}); |
| 1067 | 1081 | } else { |
| 1068 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1082 | try p.attr_application_buf.append(gpa, attr); | |
| 1069 | 1083 | } |
| 1070 | 1084 | } |
| 1071 | 1085 | } else { |
| ... | ... | @@ -1098,7 +1112,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1098 | 1112 | .no_stack_protector, |
| 1099 | 1113 | .noclone, |
| 1100 | 1114 | .noipa, |
| 1101 | // .nonnull, | |
| 1115 | .nonnull, | |
| 1102 | 1116 | .noplt, |
| 1103 | 1117 | // .optimize, |
| 1104 | 1118 | .patchable_function_entry, |
| ... | ... | @@ -1118,23 +1132,24 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) |
| 1118 | 1132 | } |
| 1119 | 1133 | |
| 1120 | 1134 | pub fn applyLabelAttributes(p: *Parser, attr_buf_start: usize) !QualType { |
| 1135 | const gpa = p.comp.gpa; | |
| 1121 | 1136 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; |
| 1122 | 1137 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; |
| 1123 | 1138 | p.attr_application_buf.items.len = 0; |
| 1124 | 1139 | var hot = false; |
| 1125 | 1140 | var cold = false; |
| 1126 | 1141 | 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), | |
| 1128 | 1143 | .hot => if (cold) { |
| 1129 | 1144 | try p.err(tok, .ignore_hot, .{}); |
| 1130 | 1145 | } else { |
| 1131 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1146 | try p.attr_application_buf.append(gpa, attr); | |
| 1132 | 1147 | hot = true; |
| 1133 | 1148 | }, |
| 1134 | 1149 | .cold => if (hot) { |
| 1135 | 1150 | try p.err(tok, .ignore_cold, .{}); |
| 1136 | 1151 | } else { |
| 1137 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1152 | try p.attr_application_buf.append(gpa, attr); | |
| 1138 | 1153 | cold = true; |
| 1139 | 1154 | }, |
| 1140 | 1155 | else => try ignoredAttrErr(p, tok, attr.tag, "labels"), |
| ... | ... | @@ -1151,7 +1166,7 @@ pub fn applyStatementAttributes(p: *Parser, expr_start: TokenIndex, attr_buf_sta |
| 1151 | 1166 | for (p.tok_ids[p.tok_i..]) |tok_id| { |
| 1152 | 1167 | switch (tok_id) { |
| 1153 | 1168 | .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); | |
| 1155 | 1170 | break; |
| 1156 | 1171 | }, |
| 1157 | 1172 | .r_brace => {}, |
| ... | ... | @@ -1172,7 +1187,7 @@ pub fn applyEnumeratorAttributes(p: *Parser, qt: QualType, attr_buf_start: usize |
| 1172 | 1187 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; |
| 1173 | 1188 | p.attr_application_buf.items.len = 0; |
| 1174 | 1189 | 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), | |
| 1176 | 1191 | else => try ignoredAttrErr(p, tok, attr.tag, "enums"), |
| 1177 | 1192 | }; |
| 1178 | 1193 | return applySelected(qt, p); |
| ... | ... | @@ -1193,7 +1208,7 @@ fn applyAligned(attr: Attribute, p: *Parser, qt: QualType, diagnostic: ?Parser.D |
| 1193 | 1208 | try p.err(align_tok, .minimum_alignment, .{default_align}); |
| 1194 | 1209 | } |
| 1195 | 1210 | } |
| 1196 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1211 | try p.attr_application_buf.append(p.comp.gpa, attr); | |
| 1197 | 1212 | } |
| 1198 | 1213 | |
| 1199 | 1214 | fn applyTransparentUnion(attr: Attribute, p: *Parser, tok: TokenIndex, qt: QualType) !void { |
| ... | ... | @@ -1214,7 +1229,7 @@ fn applyTransparentUnion(attr: Attribute, p: *Parser, tok: TokenIndex, qt: QualT |
| 1214 | 1229 | return p.err(union_ty.fields[0].name_tok, .transparent_union_size_note, .{first_field_size}); |
| 1215 | 1230 | } |
| 1216 | 1231 | |
| 1217 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1232 | try p.attr_application_buf.append(p.comp.gpa, attr); | |
| 1218 | 1233 | } |
| 1219 | 1234 | |
| 1220 | 1235 | fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, qt: *QualType) !void { |
| ... | ... | @@ -1245,7 +1260,7 @@ fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, qt: *QualType) |
| 1245 | 1260 | return p.err(tok, .vec_size_not_multiple, .{}); |
| 1246 | 1261 | } |
| 1247 | 1262 | |
| 1248 | qt.* = try p.comp.type_store.put(p.gpa, .{ .vector = .{ | |
| 1263 | qt.* = try p.comp.type_store.put(p.comp.gpa, .{ .vector = .{ | |
| 1249 | 1264 | .elem = qt.*, |
| 1250 | 1265 | .len = @intCast(vec_bytes / elem_size), |
| 1251 | 1266 | } }); |
| ... | ... | @@ -1254,7 +1269,7 @@ fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, qt: *QualType) |
| 1254 | 1269 | fn applyFormat(attr: Attribute, p: *Parser, qt: QualType) !void { |
| 1255 | 1270 | // TODO validate |
| 1256 | 1271 | _ = qt; |
| 1257 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1272 | try p.attr_application_buf.append(p.comp.gpa, attr); | |
| 1258 | 1273 | } |
| 1259 | 1274 | |
| 1260 | 1275 | fn applyCallingConvention(attr: Attribute, p: *Parser, tok: TokenIndex, qt: QualType) !void { |
| ... | ... | @@ -1264,11 +1279,11 @@ fn applyCallingConvention(attr: Attribute, p: *Parser, tok: TokenIndex, qt: Qual |
| 1264 | 1279 | switch (attr.args.calling_convention.cc) { |
| 1265 | 1280 | .c => {}, |
| 1266 | 1281 | .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), | |
| 1268 | 1283 | else => try p.err(tok, .callconv_not_supported, .{p.tok_ids[tok].symbol()}), |
| 1269 | 1284 | }, |
| 1270 | 1285 | .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), | |
| 1272 | 1287 | else => try p.err(tok, .callconv_not_supported, .{p.tok_ids[tok].symbol()}), |
| 1273 | 1288 | }, |
| 1274 | 1289 | .riscv_vector, |
| ... | ... | @@ -1285,7 +1300,7 @@ fn applyCallingConvention(attr: Attribute, p: *Parser, tok: TokenIndex, qt: Qual |
| 1285 | 1300 | fn applySelected(qt: QualType, p: *Parser) !QualType { |
| 1286 | 1301 | if (p.attr_application_buf.items.len == 0) return qt; |
| 1287 | 1302 | 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 = .{ | |
| 1289 | 1304 | .base = qt, |
| 1290 | 1305 | .attributes = p.attr_application_buf.items, |
| 1291 | 1306 | } })).withQualifiers(qt); |
lib/compiler/aro/aro/Attribute/names.zig+498-495| ... | ... | @@ -78,6 +78,7 @@ pub const Tag = enum(u16) { aarch64_sve_pcs, |
| 78 | 78 | noinit, |
| 79 | 79 | @"noinline", |
| 80 | 80 | noipa, |
| 81 | nonnull, | |
| 81 | 82 | nonstring, |
| 82 | 83 | noplt, |
| 83 | 84 | @"noreturn", |
| ... | ... | @@ -184,7 +185,7 @@ pub const longest_name = 30; |
| 184 | 185 | /// If found, returns the index of the node within the `dafsa` array. |
| 185 | 186 | /// Otherwise, returns `null`. |
| 186 | 187 | pub fn findInList(first_child_index: u16, char: u8) ?u16 { |
| 187 | @setEvalBranchQuota(230); | |
| 188 | @setEvalBranchQuota(232); | |
| 188 | 189 | var index = first_child_index; |
| 189 | 190 | while (true) { |
| 190 | 191 | if (dafsa[index].char == char) return index; |
| ... | ... | @@ -290,7 +291,7 @@ const dafsa = [_]Node{ |
| 290 | 291 | .{ .char = 'j', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 41 }, |
| 291 | 292 | .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 42 }, |
| 292 | 293 | .{ .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 }, | |
| 294 | 295 | .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 6, .child_index = 48 }, |
| 295 | 296 | .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 6, .child_index = 53 }, |
| 296 | 297 | .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 11, .child_index = 55 }, |
| ... | ... | @@ -325,7 +326,7 @@ const dafsa = [_]Node{ |
| 325 | 326 | .{ .char = 'o', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 106 }, |
| 326 | 327 | .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 107 }, |
| 327 | 328 | .{ .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 }, | |
| 329 | 330 | .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 118 }, |
| 330 | 331 | .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 120 }, |
| 331 | 332 | .{ .char = 'e', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 121 }, |
| ... | ... | @@ -392,574 +393,575 @@ const dafsa = [_]Node{ |
| 392 | 393 | .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 198 }, |
| 393 | 394 | .{ .char = 'd', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 200 }, |
| 394 | 395 | .{ .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 }, | |
| 400 | 399 | .{ .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 }, | |
| 401 | 402 | .{ .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 }, | |
| 403 | 404 | .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 75 }, |
| 404 | 405 | .{ .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 }, | |
| 414 | 415 | .{ .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 }, | |
| 429 | 430 | .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 }, |
| 430 | 431 | .{ .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 }, | |
| 438 | 439 | .{ .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 }, | |
| 448 | 449 | .{ .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 }, | |
| 451 | 452 | .{ .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 }, | |
| 467 | 468 | .{ .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 }, | |
| 471 | 472 | .{ .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 }, | |
| 485 | 487 | .{ .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 }, | |
| 499 | 499 | .{ .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 }, | |
| 502 | 502 | .{ .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 }, | |
| 504 | 506 | .{ .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 }, | |
| 511 | 511 | .{ .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 }, | |
| 513 | 515 | .{ .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 }, | |
| 520 | 522 | .{ .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 }, | |
| 527 | 529 | .{ .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 }, | |
| 538 | 536 | .{ .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 }, | |
| 543 | 545 | .{ .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 }, | |
| 547 | 549 | .{ .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 }, | |
| 551 | 553 | .{ .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 }, | |
| 560 | 562 | .{ .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 }, | |
| 562 | 564 | .{ .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 }, | |
| 564 | 566 | .{ .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 }, | |
| 580 | 583 | .{ .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 }, | |
| 585 | 588 | .{ .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 }, | |
| 598 | 601 | .{ .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 }, | |
| 601 | 604 | .{ .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 }, | |
| 607 | 610 | .{ .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 }, | |
| 621 | 624 | .{ .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 }, | |
| 629 | 632 | .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 }, |
| 630 | 633 | .{ .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 }, | |
| 659 | 662 | .{ .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 }, | |
| 668 | 671 | .{ .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 }, | |
| 681 | 682 | .{ .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 }, | |
| 691 | 694 | .{ .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 }, | |
| 695 | 698 | .{ .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 }, | |
| 714 | 717 | .{ .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 }, | |
| 719 | 722 | .{ .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 }, | |
| 723 | 726 | .{ .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 }, | |
| 725 | 728 | .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 176 }, |
| 726 | 729 | .{ .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 }, | |
| 740 | 743 | .{ .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 }, | |
| 748 | 751 | .{ .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 }, | |
| 751 | 752 | .{ .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 }, | |
| 763 | 766 | .{ .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 }, | |
| 767 | 768 | .{ .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 }, | |
| 780 | 783 | .{ .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 }, | |
| 792 | 795 | .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 }, |
| 793 | 796 | .{ .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 }, | |
| 819 | 819 | .{ .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 }, | |
| 820 | 821 | .{ .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 }, | |
| 822 | 825 | .{ .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 }, | |
| 827 | 828 | .{ .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 }, | |
| 835 | 834 | .{ .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 }, | |
| 837 | 838 | .{ .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 }, | |
| 850 | 853 | .{ .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 }, | |
| 856 | 859 | .{ .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 }, | |
| 869 | 872 | .{ .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 }, | |
| 872 | 875 | .{ .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 }, | |
| 874 | 876 | .{ .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 }, | |
| 889 | 892 | .{ .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 }, | |
| 898 | 900 | .{ .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 }, | |
| 908 | 910 | .{ .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 }, | |
| 914 | 914 | .{ .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 }, | |
| 929 | 931 | .{ .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 }, | |
| 931 | 932 | .{ .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 }, | |
| 946 | 948 | .{ .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 }, | |
| 948 | 950 | .{ .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 }, | |
| 957 | 959 | .{ .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 }, | |
| 959 | 961 | .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 }, |
| 960 | 962 | }; |
| 961 | 963 | pub const data = blk: { |
| 962 | @setEvalBranchQuota(805); | |
| 964 | @setEvalBranchQuota(812); | |
| 963 | 965 | break :blk [_]@This(){ |
| 964 | 966 | .{ .tag = .aarch64_sve_pcs, .properties = .{ .tag = .aarch64_sve_pcs, .gnu = true } }, |
| 965 | 967 | .{ .tag = .aarch64_vector_pcs, .properties = .{ .tag = .aarch64_vector_pcs, .gnu = true } }, |
| ... | ... | @@ -1028,6 +1030,7 @@ pub const data = blk: { |
| 1028 | 1030 | .{ .tag = .noinit, .properties = .{ .tag = .noinit, .gnu = true } }, |
| 1029 | 1031 | .{ .tag = .@"noinline", .properties = .{ .tag = .@"noinline", .gnu = true, .declspec = true } }, |
| 1030 | 1032 | .{ .tag = .noipa, .properties = .{ .tag = .noipa, .gnu = true } }, |
| 1033 | .{ .tag = .nonnull, .properties = .{ .tag = .nonnull, .gnu = true } }, | |
| 1031 | 1034 | .{ .tag = .nonstring, .properties = .{ .tag = .nonstring, .gnu = true } }, |
| 1032 | 1035 | .{ .tag = .noplt, .properties = .{ .tag = .noplt, .gnu = true } }, |
| 1033 | 1036 | .{ .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 { |
| 312 | 312 | }; |
| 313 | 313 | |
| 314 | 314 | test Iterator { |
| 315 | const gpa = std.testing.allocator; | |
| 315 | 316 | var it = Iterator{}; |
| 316 | 317 | |
| 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); | |
| 319 | 320 | |
| 320 | var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); | |
| 321 | var arena_state = std.heap.ArenaAllocator.init(gpa); | |
| 321 | 322 | defer arena_state.deinit(); |
| 322 | 323 | const arena = arena_state.allocator(); |
| 323 | 324 | |
| ... | ... | @@ -333,7 +334,7 @@ test Iterator { |
| 333 | 334 | std.debug.print("previous data: {}\n", .{seen.get(entry.name).?}); |
| 334 | 335 | return error.TestExpectedUniqueEntries; |
| 335 | 336 | } |
| 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); | |
| 337 | 338 | } |
| 338 | 339 | try std.testing.expectEqual(@as(usize, Builtin.data.len), seen.count()); |
| 339 | 340 | } |
lib/compiler/aro/aro/CodeGen.zig+9-8| ... | ... | @@ -40,11 +40,11 @@ tree: *const Tree, |
| 40 | 40 | comp: *Compilation, |
| 41 | 41 | builder: Builder, |
| 42 | 42 | wip_switch: *WipSwitch = undefined, |
| 43 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | |
| 44 | ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, | |
| 45 | phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, | |
| 46 | record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{}, | |
| 47 | record_cache: std.AutoHashMapUnmanaged(QualType, Interner.Ref) = .{}, | |
| 43 | symbols: std.ArrayList(Symbol) = .empty, | |
| 44 | ret_nodes: std.ArrayList(Ir.Inst.Phi.Input) = .empty, | |
| 45 | phi_nodes: std.ArrayList(Ir.Inst.Phi.Input) = .empty, | |
| 46 | record_elem_buf: std.ArrayList(Interner.Ref) = .empty, | |
| 47 | record_cache: std.AutoHashMapUnmanaged(QualType, Interner.Ref) = .empty, | |
| 48 | 48 | cond_dummy_ty: ?Interner.Ref = null, |
| 49 | 49 | bool_invert: bool = false, |
| 50 | 50 | bool_end_label: Ir.Ref = .none, |
| ... | ... | @@ -56,10 +56,11 @@ compound_assign_dummy: ?Ir.Ref = null, |
| 56 | 56 | |
| 57 | 57 | fn fail(c: *CodeGen, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } { |
| 58 | 58 | 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); | |
| 61 | 62 | |
| 62 | try buf.print(fmt, args); | |
| 63 | try buf.print(allocator, fmt, args); | |
| 63 | 64 | try c.comp.diagnostics.add(.{ .text = buf.items, .kind = .@"fatal error", .location = null }); |
| 64 | 65 | return error.FatalError; |
| 65 | 66 | } |
lib/compiler/aro/aro/Compilation.zig+68-47| ... | ... | @@ -4,8 +4,9 @@ const EpochSeconds = std.time.epoch.EpochSeconds; |
| 4 | 4 | const mem = std.mem; |
| 5 | 5 | const Allocator = mem.Allocator; |
| 6 | 6 | |
| 7 | const Interner = @import("../backend.zig").Interner; | |
| 8 | const CodeGenOptions = @import("../backend.zig").CodeGenOptions; | |
| 7 | const backend = @import("../backend.zig"); | |
| 8 | const Interner = backend.Interner; | |
| 9 | const CodeGenOptions = backend.CodeGenOptions; | |
| 9 | 10 | |
| 10 | 11 | const Builtins = @import("Builtins.zig"); |
| 11 | 12 | const Builtin = Builtins.Builtin; |
| ... | ... | @@ -127,24 +128,24 @@ diagnostics: *Diagnostics, |
| 127 | 128 | |
| 128 | 129 | code_gen_options: CodeGenOptions = .default, |
| 129 | 130 | environment: Environment = .{}, |
| 130 | sources: std.StringArrayHashMapUnmanaged(Source) = .{}, | |
| 131 | sources: std.StringArrayHashMapUnmanaged(Source) = .empty, | |
| 131 | 132 | /// Allocated into `gpa`, but keys are externally managed. |
| 132 | include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, | |
| 133 | include_dirs: std.ArrayList([]const u8) = .empty, | |
| 133 | 134 | /// Allocated into `gpa`, but keys are externally managed. |
| 134 | system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, | |
| 135 | system_include_dirs: std.ArrayList([]const u8) = .empty, | |
| 135 | 136 | /// Allocated into `gpa`, but keys are externally managed. |
| 136 | after_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, | |
| 137 | after_include_dirs: std.ArrayList([]const u8) = .empty, | |
| 137 | 138 | /// Allocated into `gpa`, but keys are externally managed. |
| 138 | framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty, | |
| 139 | framework_dirs: std.ArrayList([]const u8) = .empty, | |
| 139 | 140 | /// Allocated into `gpa`, but keys are externally managed. |
| 140 | system_framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty, | |
| 141 | system_framework_dirs: std.ArrayList([]const u8) = .empty, | |
| 141 | 142 | /// Allocated into `gpa`, but keys are externally managed. |
| 142 | embed_dirs: std.ArrayListUnmanaged([]const u8) = .empty, | |
| 143 | embed_dirs: std.ArrayList([]const u8) = .empty, | |
| 143 | 144 | target: std.Target = @import("builtin").target, |
| 144 | 145 | cmodel: std.builtin.CodeModel = .default, |
| 145 | pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{}, | |
| 146 | pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty, | |
| 146 | 147 | langopts: LangOpts = .{}, |
| 147 | generated_buf: std.ArrayListUnmanaged(u8) = .{}, | |
| 148 | generated_buf: std.ArrayList(u8) = .empty, | |
| 148 | 149 | builtins: Builtins = .{}, |
| 149 | 150 | string_interner: StringInterner = .{}, |
| 150 | 151 | interner: Interner = .{}, |
| ... | ... | @@ -245,6 +246,13 @@ fn generateSystemDefines(comp: *Compilation, w: *std.Io.Writer) !void { |
| 245 | 246 | try w.print("#define __GNUC_PATCHLEVEL__ {d}\n", .{comp.langopts.gnuc_version % 100}); |
| 246 | 247 | } |
| 247 | 248 | |
| 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 | ||
| 248 | 256 | // os macros |
| 249 | 257 | switch (comp.target.os.tag) { |
| 250 | 258 | .linux => try defineStd(w, "linux", is_gnu), |
| ... | ... | @@ -1379,8 +1387,8 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8, |
| 1379 | 1387 | const duped_path = try comp.gpa.dupe(u8, path); |
| 1380 | 1388 | errdefer comp.gpa.free(duped_path); |
| 1381 | 1389 | |
| 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); | |
| 1384 | 1392 | |
| 1385 | 1393 | const source_id: Source.Id = @enumFromInt(comp.sources.count() + 2); |
| 1386 | 1394 | |
| ... | ... | @@ -1413,9 +1421,9 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8, |
| 1413 | 1421 | }, |
| 1414 | 1422 | .back_slash, .trailing_ws, .back_slash_cr => { |
| 1415 | 1423 | i = backslash_loc; |
| 1416 | try splice_list.append(i); | |
| 1424 | try splice_list.append(comp.gpa, i); | |
| 1417 | 1425 | 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); | |
| 1419 | 1427 | } |
| 1420 | 1428 | state = if (state == .back_slash_cr) .cr else .back_slash_cr; |
| 1421 | 1429 | }, |
| ... | ... | @@ -1433,10 +1441,10 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8, |
| 1433 | 1441 | .back_slash, .trailing_ws => { |
| 1434 | 1442 | i = backslash_loc; |
| 1435 | 1443 | if (state == .back_slash or state == .trailing_ws) { |
| 1436 | try splice_list.append(i); | |
| 1444 | try splice_list.append(comp.gpa, i); | |
| 1437 | 1445 | } |
| 1438 | 1446 | 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); | |
| 1440 | 1448 | } |
| 1441 | 1449 | }, |
| 1442 | 1450 | .bom1, .bom2 => break, |
| ... | ... | @@ -1486,11 +1494,11 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8, |
| 1486 | 1494 | } |
| 1487 | 1495 | } |
| 1488 | 1496 | |
| 1489 | const splice_locs = try splice_list.toOwnedSlice(); | |
| 1497 | const splice_locs = try splice_list.toOwnedSlice(comp.gpa); | |
| 1490 | 1498 | errdefer comp.gpa.free(splice_locs); |
| 1491 | 1499 | |
| 1492 | 1500 | if (i != contents.len) { |
| 1493 | var list: std.ArrayListUnmanaged(u8) = .{ | |
| 1501 | var list: std.ArrayList(u8) = .{ | |
| 1494 | 1502 | .items = contents[0..i], |
| 1495 | 1503 | .capacity = contents.len, |
| 1496 | 1504 | }; |
| ... | ... | @@ -1510,13 +1518,21 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8, |
| 1510 | 1518 | return source; |
| 1511 | 1519 | } |
| 1512 | 1520 | |
| 1513 | fn addNewlineEscapeError(comp: *Compilation, path: []const u8, buf: []const u8, splice_locs: []const u32, byte_offset: u32, line: u32) !void { | |
| 1521 | fn 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 { | |
| 1514 | 1530 | // Temporary source for getting the location for errors. |
| 1515 | 1531 | var tmp_source: Source = .{ |
| 1516 | 1532 | .path = path, |
| 1517 | 1533 | .buf = buf, |
| 1518 | 1534 | .id = undefined, |
| 1519 | .kind = undefined, | |
| 1535 | .kind = kind, | |
| 1520 | 1536 | .splice_locs = splice_locs, |
| 1521 | 1537 | }; |
| 1522 | 1538 | |
| ... | ... | @@ -1566,17 +1582,7 @@ fn addSourceFromPathExtra(comp: *Compilation, path: []const u8, kind: Source.Kin |
| 1566 | 1582 | } |
| 1567 | 1583 | |
| 1568 | 1584 | pub 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); | |
| 1580 | 1586 | errdefer comp.gpa.free(contents); |
| 1581 | 1587 | return comp.addSourceFromOwnedBuffer(path, contents, kind); |
| 1582 | 1588 | } |
| ... | ... | @@ -1671,7 +1677,7 @@ const FindInclude = struct { |
| 1671 | 1677 | if (try find.checkFrameworkDir(dir, .system)) |res| return res; |
| 1672 | 1678 | } |
| 1673 | 1679 | 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; | |
| 1675 | 1681 | } |
| 1676 | 1682 | if (comp.ms_cwd_source_id) |source_id| { |
| 1677 | 1683 | if (try find.checkMsCwdIncludeDir(source_id)) |res| return res; |
| ... | ... | @@ -1766,26 +1772,38 @@ pub const IncludeType = enum { |
| 1766 | 1772 | angle_brackets, |
| 1767 | 1773 | }; |
| 1768 | 1774 | |
| 1769 | fn getFileContents(comp: *Compilation, path: []const u8, limit: std.Io.Limit) ![]const u8 { | |
| 1775 | fn getPathContents(comp: *Compilation, path: []const u8, limit: std.Io.Limit) ![]u8 { | |
| 1770 | 1776 | if (mem.indexOfScalar(u8, path, 0) != null) { |
| 1771 | 1777 | return error.FileNotFound; |
| 1772 | 1778 | } |
| 1773 | 1779 | |
| 1774 | 1780 | const file = try comp.cwd.openFile(path, .{}); |
| 1775 | 1781 | defer file.close(); |
| 1782 | return comp.getFileContents(file, limit); | |
| 1783 | } | |
| 1776 | 1784 | |
| 1777 | var allocating: std.Io.Writer.Allocating = .init(comp.gpa); | |
| 1778 | defer allocating.deinit(); | |
| 1779 | ||
| 1785 | fn getFileContents(comp: *Compilation, file: std.fs.File, limit: std.Io.Limit) ![]u8 { | |
| 1780 | 1786 | var file_buf: [4096]u8 = undefined; |
| 1781 | 1787 | 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 | }; | |
| 1788 | 1788 | |
| 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; | |
| 1789 | 1807 | return allocating.toOwnedSlice(); |
| 1790 | 1808 | } |
| 1791 | 1809 | |
| ... | ... | @@ -1797,9 +1815,10 @@ pub fn findEmbed( |
| 1797 | 1815 | include_type: IncludeType, |
| 1798 | 1816 | limit: std.Io.Limit, |
| 1799 | 1817 | opt_dep_file: ?*DepFile, |
| 1800 | ) !?[]const u8 { | |
| 1818 | ) !?[]u8 { | |
| 1801 | 1819 | 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); | |
| 1803 | 1822 | if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename); |
| 1804 | 1823 | return some; |
| 1805 | 1824 | } else |err| switch (err) { |
| ... | ... | @@ -1819,7 +1838,8 @@ pub fn findEmbed( |
| 1819 | 1838 | if (comp.langopts.ms_extensions) { |
| 1820 | 1839 | std.mem.replaceScalar(u8, path, '\\', '/'); |
| 1821 | 1840 | } |
| 1822 | if (comp.getFileContents(path, limit)) |some| { | |
| 1841 | if (comp.getPathContents(path, limit)) |some| { | |
| 1842 | errdefer comp.gpa.free(some); | |
| 1823 | 1843 | if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename); |
| 1824 | 1844 | return some; |
| 1825 | 1845 | } else |err| switch (err) { |
| ... | ... | @@ -1835,7 +1855,8 @@ pub fn findEmbed( |
| 1835 | 1855 | if (comp.langopts.ms_extensions) { |
| 1836 | 1856 | std.mem.replaceScalar(u8, path, '\\', '/'); |
| 1837 | 1857 | } |
| 1838 | if (comp.getFileContents(path, limit)) |some| { | |
| 1858 | if (comp.getPathContents(path, limit)) |some| { | |
| 1859 | errdefer comp.gpa.free(some); | |
| 1839 | 1860 | if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename); |
| 1840 | 1861 | return some; |
| 1841 | 1862 | } 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 { |
| 28 | 28 | const max_columns = 75; |
| 29 | 29 | var columns: usize = 0; |
| 30 | 30 | |
| 31 | try w.writeAll(d.target); | |
| 31 | try writeTarget(d.target, w); | |
| 32 | 32 | columns += d.target.len; |
| 33 | 33 | try w.writeByte(':'); |
| 34 | 34 | columns += 1; |
| ... | ... | @@ -48,6 +48,26 @@ pub fn write(d: *const DepFile, w: *std.Io.Writer) std.Io.Writer.Error!void { |
| 48 | 48 | try w.flush(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | fn 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 | ||
| 51 | 71 | fn writePath(d: *const DepFile, path: []const u8, w: *std.Io.Writer) !void { |
| 52 | 72 | switch (d.format) { |
| 53 | 73 | .nmake => { |
| ... | ... | @@ -58,18 +78,19 @@ fn writePath(d: *const DepFile, path: []const u8, w: *std.Io.Writer) !void { |
| 58 | 78 | }, |
| 59 | 79 | .make => { |
| 60 | 80 | 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 | ' ' => { | |
| 71 | 83 | 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 => {}, | |
| 73 | 94 | } |
| 74 | 95 | try w.writeByte(c); |
| 75 | 96 | } |
lib/compiler/aro/aro/Diagnostics.zig+17-3| ... | ... | @@ -193,6 +193,8 @@ pub const Option = enum { |
| 193 | 193 | @"microsoft-flexible-array", |
| 194 | 194 | @"microsoft-anon-tag", |
| 195 | 195 | @"out-of-scope-function", |
| 196 | @"date-time", | |
| 197 | @"attribute-todo", | |
| 196 | 198 | |
| 197 | 199 | /// GNU extensions |
| 198 | 200 | pub const gnu = [_]Option{ |
| ... | ... | @@ -278,6 +280,8 @@ pub const State = struct { |
| 278 | 280 | extensions: Message.Kind = .off, |
| 279 | 281 | /// How to treat individual options, set by -W<name> |
| 280 | 282 | options: std.EnumMap(Option, Message.Kind) = .{}, |
| 283 | /// Should warnings be suppressed in system headers, set by -Wsystem-headers | |
| 284 | suppress_system_headers: bool = true, | |
| 281 | 285 | }; |
| 282 | 286 | |
| 283 | 287 | const Diagnostics = @This(); |
| ... | ... | @@ -288,7 +292,7 @@ output: union(enum) { |
| 288 | 292 | color: std.Io.tty.Config, |
| 289 | 293 | }, |
| 290 | 294 | to_list: struct { |
| 291 | messages: std.ArrayListUnmanaged(Message) = .empty, | |
| 295 | messages: std.ArrayList(Message) = .empty, | |
| 292 | 296 | arena: std.heap.ArenaAllocator, |
| 293 | 297 | }, |
| 294 | 298 | ignore, |
| ... | ... | @@ -373,6 +377,16 @@ pub fn effectiveKind(d: *Diagnostics, message: anytype) Message.Kind { |
| 373 | 377 | return .off; |
| 374 | 378 | } |
| 375 | 379 | |
| 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 | ||
| 376 | 390 | var kind = message.kind; |
| 377 | 391 | |
| 378 | 392 | // Get explicit kind set by -W<name>= |
| ... | ... | @@ -418,9 +432,9 @@ pub fn addWithLocation( |
| 418 | 432 | note_msg_loc: bool, |
| 419 | 433 | ) Compilation.Error!void { |
| 420 | 434 | var copy = msg; |
| 421 | copy.effective_kind = d.effectiveKind(msg); | |
| 422 | if (copy.effective_kind == .off) return; | |
| 423 | 435 | 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; | |
| 424 | 438 | try d.addMessage(copy); |
| 425 | 439 | |
| 426 | 440 | if (expansion_locs.len != 0) { |
lib/compiler/aro/aro/Driver.zig+19-25| ... | ... | @@ -45,8 +45,8 @@ const Driver = @This(); |
| 45 | 45 | comp: *Compilation, |
| 46 | 46 | diagnostics: *Diagnostics, |
| 47 | 47 | |
| 48 | inputs: std.ArrayListUnmanaged(Source) = .{}, | |
| 49 | link_objects: std.ArrayListUnmanaged([]const u8) = .{}, | |
| 48 | inputs: std.ArrayList(Source) = .empty, | |
| 49 | link_objects: std.ArrayList([]const u8) = .empty, | |
| 50 | 50 | output_name: ?[]const u8 = null, |
| 51 | 51 | sysroot: ?[]const u8 = null, |
| 52 | 52 | resource_dir: ?[]const u8 = null, |
| ... | ... | @@ -107,7 +107,6 @@ raw_cpu: ?[]const u8 = null, |
| 107 | 107 | use_assembly_backend: bool = false, |
| 108 | 108 | |
| 109 | 109 | // linker options |
| 110 | use_linker: ?[]const u8 = null, | |
| 111 | 110 | linker_path: ?[]const u8 = null, |
| 112 | 111 | nodefaultlibs: bool = false, |
| 113 | 112 | nolibc: bool = false, |
| ... | ... | @@ -270,7 +269,7 @@ pub const usage = |
| 270 | 269 | pub fn parseArgs( |
| 271 | 270 | d: *Driver, |
| 272 | 271 | stdout: *std.Io.Writer, |
| 273 | macro_buf: *std.ArrayListUnmanaged(u8), | |
| 272 | macro_buf: *std.ArrayList(u8), | |
| 274 | 273 | args: []const []const u8, |
| 275 | 274 | ) (Compilation.Error || std.Io.Writer.Error)!bool { |
| 276 | 275 | var i: usize = 1; |
| ... | ... | @@ -322,7 +321,7 @@ pub fn parseArgs( |
| 322 | 321 | } |
| 323 | 322 | try macro_buf.print(d.comp.gpa, "#undef {s}\n", .{macro}); |
| 324 | 323 | } 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"; | |
| 326 | 325 | } else if (mem.startsWith(u8, arg, "-O")) { |
| 327 | 326 | d.comp.code_gen_options.optimization_level = backend.CodeGenOptions.OptimizationLevel.fromString(arg["-O".len..]) orelse { |
| 328 | 327 | try d.err("invalid optimization level '{s}'", .{arg}); |
| ... | ... | @@ -600,6 +599,10 @@ pub fn parseArgs( |
| 600 | 599 | d.diagnostics.state.enable_all_warnings = false; |
| 601 | 600 | } else if (mem.eql(u8, arg, "-Weverything")) { |
| 602 | 601 | 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; | |
| 603 | 606 | } else if (mem.eql(u8, arg, "-Werror")) { |
| 604 | 607 | d.diagnostics.state.error_warnings = true; |
| 605 | 608 | } else if (mem.eql(u8, arg, "-Wno-error")) { |
| ... | ... | @@ -644,10 +647,6 @@ pub fn parseArgs( |
| 644 | 647 | d.comp.langopts.preserve_comments = true; |
| 645 | 648 | d.comp.langopts.preserve_comments_in_macros = true; |
| 646 | 649 | 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; | |
| 651 | 650 | } else if (option(arg, "--ld-path=")) |linker_path| { |
| 652 | 651 | d.linker_path = linker_path; |
| 653 | 652 | } else if (mem.eql(u8, arg, "-r")) { |
| ... | ... | @@ -917,13 +916,11 @@ pub fn errorDescription(e: anyerror) []const u8 { |
| 917 | 916 | }; |
| 918 | 917 | } |
| 919 | 918 | |
| 920 | var stdout_buffer: [4096]u8 = undefined; | |
| 921 | ||
| 922 | 919 | /// The entry point of the Aro compiler. |
| 923 | 920 | /// **MAY call `exit` if `fast_exit` is set.** |
| 924 | 921 | pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8, comptime fast_exit: bool, asm_gen_fn: ?AsmCodeGenFn) Compilation.Error!void { |
| 925 | 922 | const user_macros = macros: { |
| 926 | var macro_buf: std.ArrayListUnmanaged(u8) = .empty; | |
| 923 | var macro_buf: std.ArrayList(u8) = .empty; | |
| 927 | 924 | defer macro_buf.deinit(d.comp.gpa); |
| 928 | 925 | |
| 929 | 926 | var stdout_buf: [256]u8 = undefined; |
| ... | ... | @@ -1107,7 +1104,7 @@ fn processSource( |
| 1107 | 1104 | |
| 1108 | 1105 | var name_buf: [std.fs.max_name_bytes]u8 = undefined; |
| 1109 | 1106 | 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); | |
| 1111 | 1108 | |
| 1112 | 1109 | if (opt_dep_file) |*dep_file| pp.dep_file = dep_file; |
| 1113 | 1110 | |
| ... | ... | @@ -1164,14 +1161,11 @@ fn processSource( |
| 1164 | 1161 | else |
| 1165 | 1162 | std.fs.File.stdout(); |
| 1166 | 1163 | defer if (d.output_name != null) file.close(); |
| 1167 | var file_buffer: [1024]u8 = undefined; | |
| 1168 | var file_writer = file.writer(&file_buffer); | |
| 1169 | 1164 | |
| 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.?)}); | |
| 1172 | 1168 | |
| 1173 | file_writer.interface.flush() catch |er| | |
| 1174 | return d.fatal("unable to write result: {s}", .{errorDescription(er)}); | |
| 1175 | 1169 | if (fast_exit) std.process.exit(0); // Not linking, no need for cleanup. |
| 1176 | 1170 | return; |
| 1177 | 1171 | } |
| ... | ... | @@ -1180,9 +1174,8 @@ fn processSource( |
| 1180 | 1174 | defer tree.deinit(); |
| 1181 | 1175 | |
| 1182 | 1176 | 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 {}; | |
| 1186 | 1179 | } |
| 1187 | 1180 | |
| 1188 | 1181 | d.printDiagnosticsStats(); |
| ... | ... | @@ -1299,12 +1292,13 @@ fn dumpLinkerArgs(w: *std.Io.Writer, items: []const []const u8) !void { |
| 1299 | 1292 | /// The entry point of the Aro compiler. |
| 1300 | 1293 | /// **MAY call `exit` if `fast_exit` is set.** |
| 1301 | 1294 | pub 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); | |
| 1304 | 1298 | |
| 1305 | 1299 | var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined; |
| 1306 | 1300 | const linker_path = try tc.getLinkerPath(&linker_path_buf); |
| 1307 | try argv.append(linker_path); | |
| 1301 | try argv.append(gpa, linker_path); | |
| 1308 | 1302 | |
| 1309 | 1303 | try tc.buildLinkerArgs(&argv); |
| 1310 | 1304 |
lib/compiler/aro/aro/Driver/Multilib.zig+32-23| ... | ... | @@ -1,47 +1,50 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const Filesystem = @import("Filesystem.zig").Filesystem; |
| 3 | 3 | |
| 4 | pub const Flags = std.ArrayListUnmanaged([]const u8); | |
| 5 | ||
| 6 | 4 | /// Large enough for GCCDetector for Linux; may need to be increased to support other toolchains. |
| 7 | 5 | const max_multilibs = 4; |
| 8 | 6 | |
| 9 | const MultilibArray = std.ArrayListUnmanaged(Multilib); | |
| 10 | ||
| 11 | 7 | pub const Detected = struct { |
| 12 | multilibs: MultilibArray = .{}, | |
| 8 | multilib_buf: [max_multilibs]Multilib = undefined, | |
| 9 | multilib_count: u8 = 0, | |
| 13 | 10 | selected: Multilib = .{}, |
| 14 | 11 | biarch_sibling: ?Multilib = null, |
| 15 | 12 | |
| 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| { | |
| 19 | 16 | if (multilib_filter.exists(multilib, fs)) { |
| 20 | self.multilibs.items[found_count] = multilib; | |
| 17 | d.multilib_buf[found_count] = multilib; | |
| 21 | 18 | found_count += 1; |
| 22 | 19 | } |
| 23 | 20 | } |
| 24 | self.multilibs.resize(found_count) catch unreachable; | |
| 21 | d.multilib_count = found_count; | |
| 25 | 22 | } |
| 26 | 23 | |
| 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| { | |
| 32 | 30 | if (std.mem.eql(u8, arg_flag[1..], multilib_flag[1..])) break arg_flag; |
| 33 | 31 | } else multilib_flag; |
| 34 | 32 | if (matched[0] != multilib_flag[0]) break; |
| 33 | } else if (selected != null) { | |
| 34 | return error.TooManyMultilibs; | |
| 35 | 35 | } else { |
| 36 | filtered.appendAssumeCapacity(multilib); | |
| 36 | selected = multilib; | |
| 37 | 37 | } |
| 38 | 38 | } |
| 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; | |
| 42 | 41 | return true; |
| 43 | 42 | } |
| 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]; | |
| 45 | 48 | } |
| 46 | 49 | }; |
| 47 | 50 | |
| ... | ... | @@ -58,14 +61,20 @@ const Multilib = @This(); |
| 58 | 61 | gcc_suffix: []const u8 = "", |
| 59 | 62 | os_suffix: []const u8 = "", |
| 60 | 63 | include_suffix: []const u8 = "", |
| 61 | flags: Flags = .{}, | |
| 64 | flag_buf: [6][]const u8 = undefined, | |
| 65 | flag_count: u8 = 0, | |
| 62 | 66 | priority: u32 = 0, |
| 63 | 67 | |
| 64 | pub fn init(gcc_suffix: []const u8, os_suffix: []const u8, flags: []const []const u8) Multilib { | |
| 68 | pub fn init(gcc_suffix: []const u8, os_suffix: []const u8, init_flags: []const []const u8) Multilib { | |
| 65 | 69 | var self: Multilib = .{ |
| 66 | 70 | .gcc_suffix = gcc_suffix, |
| 67 | 71 | .os_suffix = os_suffix, |
| 72 | .flag_count = @intCast(init_flags.len), | |
| 68 | 73 | }; |
| 69 | self.flags.appendSliceAssumeCapacity(flags); | |
| 74 | @memcpy(self.flag_buf[0..init_flags.len], init_flags); | |
| 70 | 75 | return self; |
| 71 | 76 | } |
| 77 | ||
| 78 | pub 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 { |
| 22 | 22 | |
| 23 | 23 | const InitList = @This(); |
| 24 | 24 | |
| 25 | list: std.ArrayListUnmanaged(Item) = .empty, | |
| 25 | list: std.ArrayList(Item) = .empty, | |
| 26 | 26 | node: Node.OptIndex = .null, |
| 27 | 27 | tok: TokenIndex = 0, |
| 28 | 28 |
lib/compiler/aro/aro/Parser.zig+296-216| ... | ... | @@ -32,12 +32,12 @@ const Type = TypeStore.Type; |
| 32 | 32 | const QualType = TypeStore.QualType; |
| 33 | 33 | const Value = @import("Value.zig"); |
| 34 | 34 | |
| 35 | const NodeList = std.array_list.Managed(Node.Index); | |
| 35 | const NodeList = std.ArrayList(Node.Index); | |
| 36 | 36 | const Switch = struct { |
| 37 | 37 | default: ?TokenIndex = null, |
| 38 | ranges: std.array_list.Managed(Range), | |
| 38 | ranges: std.ArrayList(Range) = .empty, | |
| 39 | 39 | qt: QualType, |
| 40 | comp: *Compilation, | |
| 40 | comp: *const Compilation, | |
| 41 | 41 | |
| 42 | 42 | const Range = struct { |
| 43 | 43 | first: Value, |
| ... | ... | @@ -45,13 +45,13 @@ const Switch = struct { |
| 45 | 45 | tok: TokenIndex, |
| 46 | 46 | }; |
| 47 | 47 | |
| 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)) { | |
| 51 | 51 | return range; // They overlap. |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | try self.ranges.append(.{ | |
| 54 | try s.ranges.append(s.comp.gpa, .{ | |
| 55 | 55 | .first = first, |
| 56 | 56 | .last = last, |
| 57 | 57 | .tok = tok, |
| ... | ... | @@ -101,7 +101,6 @@ const Parser = @This(); |
| 101 | 101 | pp: *Preprocessor, |
| 102 | 102 | comp: *Compilation, |
| 103 | 103 | diagnostics: *Diagnostics, |
| 104 | gpa: mem.Allocator, | |
| 105 | 104 | tok_ids: []const Token.Id, |
| 106 | 105 | tok_i: TokenIndex = 0, |
| 107 | 106 | |
| ... | ... | @@ -110,21 +109,21 @@ tree: Tree, |
| 110 | 109 | |
| 111 | 110 | // buffers used during compilation |
| 112 | 111 | syms: SymbolStack = .{}, |
| 113 | strings: std.array_list.Managed(u8), | |
| 114 | labels: std.array_list.Managed(Label), | |
| 115 | list_buf: NodeList, | |
| 116 | decl_buf: NodeList, | |
| 112 | strings: std.array_list.Aligned(u8, .@"4") = .empty, | |
| 113 | labels: std.ArrayList(Label) = .empty, | |
| 114 | list_buf: NodeList = .empty, | |
| 115 | decl_buf: NodeList = .empty, | |
| 117 | 116 | /// Function type parameters, also used for generic selection association |
| 118 | 117 | /// duplicate checking. |
| 119 | param_buf: std.array_list.Managed(Type.Func.Param), | |
| 118 | param_buf: std.ArrayList(Type.Func.Param) = .empty, | |
| 120 | 119 | /// Enum type fields. |
| 121 | enum_buf: std.array_list.Managed(Type.Enum.Field), | |
| 120 | enum_buf: std.ArrayList(Type.Enum.Field) = .empty, | |
| 122 | 121 | /// Record type fields. |
| 123 | record_buf: std.array_list.Managed(Type.Record.Field), | |
| 122 | record_buf: std.ArrayList(Type.Record.Field) = .empty, | |
| 124 | 123 | /// Attributes that have been parsed but not yet validated or applied. |
| 125 | 124 | attr_buf: std.MultiArrayList(TentativeAttribute) = .empty, |
| 126 | 125 | /// Used to store validated attributes before they are applied to types. |
| 127 | attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty, | |
| 126 | attr_application_buf: std.ArrayList(Attribute) = .empty, | |
| 128 | 127 | /// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types) |
| 129 | 128 | /// e.g. `struct Foo bar;` where `struct Foo` is not defined yet. |
| 130 | 129 | /// The key is the StringId of `Foo` and the value is the TokenIndex of `bar` |
| ... | ... | @@ -177,7 +176,7 @@ record: struct { |
| 177 | 176 | break; |
| 178 | 177 | } |
| 179 | 178 | } |
| 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 }); | |
| 181 | 180 | } |
| 182 | 181 | |
| 183 | 182 | fn addFieldsFromAnonymous(r: @This(), p: *Parser, record_ty: Type.Record) Error!void { |
| ... | ... | @@ -192,7 +191,7 @@ record: struct { |
| 192 | 191 | } |
| 193 | 192 | } |
| 194 | 193 | } = .{}, |
| 195 | record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{}, | |
| 194 | record_members: std.ArrayList(struct { tok: TokenIndex, name: StringId }) = .empty, | |
| 196 | 195 | |
| 197 | 196 | @"switch": ?*Switch = null, |
| 198 | 197 | in_loop: bool = false, |
| ... | ... | @@ -212,7 +211,7 @@ fn checkIdentifierCodepointWarnings(p: *Parser, codepoint: u21, loc: Source.Loca |
| 212 | 211 | assert(codepoint >= 0x80); |
| 213 | 212 | |
| 214 | 213 | 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); | |
| 216 | 215 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 217 | 216 | defer allocating.deinit(); |
| 218 | 217 | |
| ... | ... | @@ -425,7 +424,7 @@ pub fn err(p: *Parser, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) |
| 425 | 424 | if (diagnostic.suppress_unless_version) |some| if (!p.comp.langopts.standard.atLeast(some)) return; |
| 426 | 425 | if (p.diagnostics.effectiveKind(diagnostic) == .off) return; |
| 427 | 426 | |
| 428 | var sf = std.heap.stackFallback(1024, p.gpa); | |
| 427 | var sf = std.heap.stackFallback(1024, p.comp.gpa); | |
| 429 | 428 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 430 | 429 | defer allocating.deinit(); |
| 431 | 430 | |
| ... | ... | @@ -604,7 +603,7 @@ pub fn removeNull(p: *Parser, str: Value) !Value { |
| 604 | 603 | defer p.strings.items.len = strings_top; |
| 605 | 604 | { |
| 606 | 605 | 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]); | |
| 608 | 607 | } |
| 609 | 608 | return Value.intern(p.comp, .{ .bytes = p.strings.items[strings_top..] }); |
| 610 | 609 | } |
| ... | ... | @@ -799,30 +798,23 @@ fn diagnoseIncompleteDefinitions(p: *Parser) !void { |
| 799 | 798 | } |
| 800 | 799 | |
| 801 | 800 | /// root : (decl | assembly ';' | staticAssert)* |
| 802 | pub fn parse(pp: *Preprocessor) Error!Tree { | |
| 801 | pub fn parse(pp: *Preprocessor) Compilation.Error!Tree { | |
| 802 | const gpa = pp.comp.gpa; | |
| 803 | 803 | assert(pp.linemarkers == .none); |
| 804 | 804 | pp.comp.pragmaEvent(.before_parse); |
| 805 | 805 | |
| 806 | 806 | 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); | |
| 808 | 808 | |
| 809 | 809 | var p: Parser = .{ |
| 810 | 810 | .pp = pp, |
| 811 | 811 | .comp = pp.comp, |
| 812 | 812 | .diagnostics = pp.diagnostics, |
| 813 | .gpa = pp.comp.gpa, | |
| 814 | 813 | .tree = .{ |
| 815 | 814 | .comp = pp.comp, |
| 816 | 815 | .tokens = undefined, // Set after implicit typedefs |
| 817 | 816 | }, |
| 818 | 817 | .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), | |
| 826 | 818 | .string_ids = .{ |
| 827 | 819 | .declspec_id = try pp.comp.internString("__declspec"), |
| 828 | 820 | .main_id = try pp.comp.internString("main"), |
| ... | ... | @@ -834,18 +826,18 @@ pub fn parse(pp: *Preprocessor) Error!Tree { |
| 834 | 826 | }; |
| 835 | 827 | errdefer p.tree.deinit(); |
| 836 | 828 | 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); | |
| 849 | 841 | } |
| 850 | 842 | |
| 851 | 843 | try p.syms.pushScope(&p); |
| ... | ... | @@ -907,7 +899,7 @@ pub fn parse(pp: *Preprocessor) Error!Tree { |
| 907 | 899 | }, |
| 908 | 900 | else => |e| return e, |
| 909 | 901 | }) |node| { |
| 910 | try p.decl_buf.append(node); | |
| 902 | try p.decl_buf.append(gpa, node); | |
| 911 | 903 | continue; |
| 912 | 904 | } |
| 913 | 905 | if (p.eatToken(.semicolon)) |tok| { |
| ... | ... | @@ -915,7 +907,7 @@ pub fn parse(pp: *Preprocessor) Error!Tree { |
| 915 | 907 | const empty = try p.tree.addNode(.{ .empty_decl = .{ |
| 916 | 908 | .semicolon = tok, |
| 917 | 909 | } }); |
| 918 | try p.decl_buf.append(empty); | |
| 910 | try p.decl_buf.append(gpa, empty); | |
| 919 | 911 | continue; |
| 920 | 912 | } |
| 921 | 913 | try p.err(p.tok_i, .expected_external_decl, .{}); |
| ... | ... | @@ -925,7 +917,9 @@ pub fn parse(pp: *Preprocessor) Error!Tree { |
| 925 | 917 | try p.diagnoseIncompleteDefinitions(); |
| 926 | 918 | } |
| 927 | 919 | |
| 928 | p.tree.root_decls = p.decl_buf.moveToUnmanaged(); | |
| 920 | p.tree.root_decls = p.decl_buf; | |
| 921 | p.decl_buf = .empty; | |
| 922 | ||
| 929 | 923 | if (p.tree.root_decls.items.len == implicit_typedef_count) { |
| 930 | 924 | try p.err(p.tok_i - 1, .empty_translation_unit, .{}); |
| 931 | 925 | } |
| ... | ... | @@ -937,9 +931,11 @@ pub fn parse(pp: *Preprocessor) Error!Tree { |
| 937 | 931 | } |
| 938 | 932 | |
| 939 | 933 | fn addImplicitTypedef(p: *Parser, name: []const u8, qt: QualType) !void { |
| 934 | const gpa = p.comp.gpa; | |
| 940 | 935 | 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'); | |
| 943 | 939 | |
| 944 | 940 | const name_tok: u32 = @intCast(p.pp.tokens.len); |
| 945 | 941 | p.pp.tokens.appendAssumeCapacity(.{ .id = .identifier, .loc = .{ |
| ... | ... | @@ -958,13 +954,13 @@ fn addImplicitTypedef(p: *Parser, name: []const u8, qt: QualType) !void { |
| 958 | 954 | }); |
| 959 | 955 | |
| 960 | 956 | 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 = .{ | |
| 962 | 958 | .base = qt, |
| 963 | 959 | .name = interned_name, |
| 964 | 960 | .decl_node = node, |
| 965 | 961 | } })).withQualifiers(qt); |
| 966 | 962 | 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); | |
| 968 | 964 | } |
| 969 | 965 | |
| 970 | 966 | fn skipToPragmaSentinel(p: *Parser) void { |
| ... | ... | @@ -1082,6 +1078,7 @@ fn typedefDefined(p: *Parser, name: StringId, ty: QualType) void { |
| 1082 | 1078 | /// : declSpec (initDeclarator ( ',' initDeclarator)*)? ';' |
| 1083 | 1079 | /// | declSpec declarator decl* compoundStmt |
| 1084 | 1080 | fn decl(p: *Parser) Error!bool { |
| 1081 | const gpa = p.comp.gpa; | |
| 1085 | 1082 | _ = try p.pragma(); |
| 1086 | 1083 | const first_tok = p.tok_i; |
| 1087 | 1084 | const attr_buf_top = p.attr_buf.len; |
| ... | ... | @@ -1116,7 +1113,7 @@ fn decl(p: *Parser) Error!bool { |
| 1116 | 1113 | }; |
| 1117 | 1114 | if (decl_spec.noreturn) |tok| { |
| 1118 | 1115 | 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 }); | |
| 1120 | 1117 | } |
| 1121 | 1118 | |
| 1122 | 1119 | var decl_node = try p.tree.addNode(.{ .empty_decl = .{ |
| ... | ... | @@ -1194,7 +1191,7 @@ fn decl(p: *Parser) Error!bool { |
| 1194 | 1191 | const func_qt = init_d.d.qt.base(p.comp).qt; |
| 1195 | 1192 | const params_len = func_qt.get(p.comp, .func).?.params.len; |
| 1196 | 1193 | |
| 1197 | const new_params = try p.param_buf.addManyAsSlice(params_len); | |
| 1194 | const new_params = try p.param_buf.addManyAsSlice(gpa, params_len); | |
| 1198 | 1195 | for (new_params) |*new_param| { |
| 1199 | 1196 | new_param.name = .empty; |
| 1200 | 1197 | } |
| ... | ... | @@ -1280,7 +1277,7 @@ fn decl(p: *Parser) Error!bool { |
| 1280 | 1277 | } |
| 1281 | 1278 | } |
| 1282 | 1279 | // 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 = .{ | |
| 1284 | 1281 | .kind = .normal, |
| 1285 | 1282 | .params = new_params, |
| 1286 | 1283 | .return_type = func_ty.return_type, |
| ... | ... | @@ -1293,7 +1290,7 @@ fn decl(p: *Parser) Error!bool { |
| 1293 | 1290 | } |
| 1294 | 1291 | |
| 1295 | 1292 | // bypass redefinition check to avoid duplicate errors |
| 1296 | try p.syms.define(p.gpa, .{ | |
| 1293 | try p.syms.define(gpa, .{ | |
| 1297 | 1294 | .kind = .def, |
| 1298 | 1295 | .name = param.name, |
| 1299 | 1296 | .tok = param.name_tok, |
| ... | ... | @@ -1334,7 +1331,7 @@ fn decl(p: *Parser) Error!bool { |
| 1334 | 1331 | .definition = null, |
| 1335 | 1332 | } }, @intFromEnum(decl_node)); |
| 1336 | 1333 | |
| 1337 | try p.decl_buf.append(decl_node); | |
| 1334 | try p.decl_buf.append(gpa, decl_node); | |
| 1338 | 1335 | |
| 1339 | 1336 | // check gotos |
| 1340 | 1337 | if (func.qt == null) { |
| ... | ... | @@ -1382,7 +1379,7 @@ fn decl(p: *Parser) Error!bool { |
| 1382 | 1379 | if (node_qt.get(p.comp, .array)) |array_ty| { |
| 1383 | 1380 | if (array_ty.len == .incomplete) { |
| 1384 | 1381 | // 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 = .{ | |
| 1386 | 1383 | .elem = array_ty.elem, |
| 1387 | 1384 | .len = .{ .fixed = 1 }, |
| 1388 | 1385 | } }); |
| ... | ... | @@ -1408,14 +1405,14 @@ fn decl(p: *Parser) Error!bool { |
| 1408 | 1405 | }, |
| 1409 | 1406 | }, @intFromEnum(decl_node)); |
| 1410 | 1407 | } |
| 1411 | try p.decl_buf.append(decl_node); | |
| 1408 | try p.decl_buf.append(gpa, decl_node); | |
| 1412 | 1409 | |
| 1413 | 1410 | const interned_name = try p.comp.internString(p.tokSlice(init_d.d.name)); |
| 1414 | 1411 | if (decl_spec.storage_class == .typedef) { |
| 1415 | 1412 | const typedef_qt = if (init_d.d.qt.isInvalid()) |
| 1416 | 1413 | init_d.d.qt |
| 1417 | 1414 | else |
| 1418 | (try p.comp.type_store.put(p.gpa, .{ .typedef = .{ | |
| 1415 | (try p.comp.type_store.put(gpa, .{ .typedef = .{ | |
| 1419 | 1416 | .base = init_d.d.qt, |
| 1420 | 1417 | .name = interned_name, |
| 1421 | 1418 | .decl_node = decl_node, |
| ... | ... | @@ -1500,6 +1497,7 @@ fn staticAssertMessage(p: *Parser, cond_node: Node.Index, maybe_message: ?Result |
| 1500 | 1497 | /// : keyword_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';' |
| 1501 | 1498 | /// | keyword_c23_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';' |
| 1502 | 1499 | fn staticAssert(p: *Parser) Error!bool { |
| 1500 | const gpa = p.comp.gpa; | |
| 1503 | 1501 | const static_assert = p.eatToken(.keyword_static_assert) orelse p.eatToken(.keyword_c23_static_assert) orelse return false; |
| 1504 | 1502 | const l_paren = try p.expectToken(.l_paren); |
| 1505 | 1503 | const res_token = p.tok_i; |
| ... | ... | @@ -1539,7 +1537,7 @@ fn staticAssert(p: *Parser) Error!bool { |
| 1539 | 1537 | } |
| 1540 | 1538 | } else { |
| 1541 | 1539 | if (!res.val.toBool(p.comp)) { |
| 1542 | var sf = std.heap.stackFallback(1024, p.gpa); | |
| 1540 | var sf = std.heap.stackFallback(1024, gpa); | |
| 1543 | 1541 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 1544 | 1542 | defer allocating.deinit(); |
| 1545 | 1543 | |
| ... | ... | @@ -1558,7 +1556,7 @@ fn staticAssert(p: *Parser) Error!bool { |
| 1558 | 1556 | .message = if (str) |some| some.node else null, |
| 1559 | 1557 | }, |
| 1560 | 1558 | }); |
| 1561 | try p.decl_buf.append(node); | |
| 1559 | try p.decl_buf.append(gpa, node); | |
| 1562 | 1560 | return true; |
| 1563 | 1561 | } |
| 1564 | 1562 | |
| ... | ... | @@ -1632,6 +1630,7 @@ pub const DeclSpec = struct { |
| 1632 | 1630 | /// : keyword_typeof '(' typeName ')' |
| 1633 | 1631 | /// | keyword_typeof '(' expr ')' |
| 1634 | 1632 | fn typeof(p: *Parser) Error!?QualType { |
| 1633 | const gpa = p.comp.gpa; | |
| 1635 | 1634 | var unqual = false; |
| 1636 | 1635 | switch (p.tok_ids[p.tok_i]) { |
| 1637 | 1636 | .keyword_typeof, .keyword_typeof1, .keyword_typeof2 => p.tok_i += 1, |
| ... | ... | @@ -1646,7 +1645,7 @@ fn typeof(p: *Parser) Error!?QualType { |
| 1646 | 1645 | try p.expectClosing(l_paren, .r_paren); |
| 1647 | 1646 | if (qt.isInvalid()) return null; |
| 1648 | 1647 | |
| 1649 | return (try p.comp.type_store.put(p.gpa, .{ .typeof = .{ | |
| 1648 | return (try p.comp.type_store.put(gpa, .{ .typeof = .{ | |
| 1650 | 1649 | .base = qt, |
| 1651 | 1650 | .expr = null, |
| 1652 | 1651 | } })).withQualifiers(qt); |
| ... | ... | @@ -1655,7 +1654,7 @@ fn typeof(p: *Parser) Error!?QualType { |
| 1655 | 1654 | try p.expectClosing(l_paren, .r_paren); |
| 1656 | 1655 | if (typeof_expr.qt.isInvalid()) return null; |
| 1657 | 1656 | |
| 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 = .{ | |
| 1659 | 1658 | .base = typeof_expr.qt, |
| 1660 | 1659 | .expr = typeof_expr.node, |
| 1661 | 1660 | } }); |
| ... | ... | @@ -1704,7 +1703,7 @@ fn declSpec(p: *Parser) Error!?DeclSpec { |
| 1704 | 1703 | continue; |
| 1705 | 1704 | }, |
| 1706 | 1705 | .keyword_forceinline, .keyword_forceinline2 => { |
| 1707 | try p.attr_buf.append(p.gpa, .{ | |
| 1706 | try p.attr_buf.append(p.comp.gpa, .{ | |
| 1708 | 1707 | .attr = .{ .tag = .always_inline, .args = .{ .always_inline = .{} }, .syntax = .keyword }, |
| 1709 | 1708 | .tok = p.tok_i, |
| 1710 | 1709 | }); |
| ... | ... | @@ -1883,11 +1882,12 @@ fn diagnose(p: *Parser, attr: Attribute.Tag, arguments: *Attribute.Arguments, ar |
| 1883 | 1882 | /// attributeList : (attribute (',' attribute)*)? |
| 1884 | 1883 | fn gnuAttributeList(p: *Parser) Error!void { |
| 1885 | 1884 | if (p.tok_ids[p.tok_i] == .r_paren) return; |
| 1885 | const gpa = p.comp.gpa; | |
| 1886 | 1886 | |
| 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); | |
| 1888 | 1888 | while (p.tok_ids[p.tok_i] != .r_paren) { |
| 1889 | 1889 | _ = 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); | |
| 1891 | 1891 | } |
| 1892 | 1892 | } |
| 1893 | 1893 | |
| ... | ... | @@ -1900,14 +1900,14 @@ fn c23AttributeList(p: *Parser) Error!void { |
| 1900 | 1900 | } else { |
| 1901 | 1901 | p.tok_i -= 1; |
| 1902 | 1902 | } |
| 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); | |
| 1904 | 1904 | _ = p.eatToken(.comma); |
| 1905 | 1905 | } |
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | 1908 | fn msvcAttributeList(p: *Parser) Error!void { |
| 1909 | 1909 | 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); | |
| 1911 | 1911 | _ = p.eatToken(.comma); |
| 1912 | 1912 | } |
| 1913 | 1913 | } |
| ... | ... | @@ -1979,6 +1979,7 @@ fn attributeSpecifierExtra(p: *Parser, declarator_name: ?TokenIndex) Error!void |
| 1979 | 1979 | fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize, decl_node: Node.Index) Error!?InitDeclarator { |
| 1980 | 1980 | const this_attr_buf_top = p.attr_buf.len; |
| 1981 | 1981 | defer p.attr_buf.len = this_attr_buf_top; |
| 1982 | const gpa = p.comp.gpa; | |
| 1982 | 1983 | |
| 1983 | 1984 | var init_d = InitDeclarator{ |
| 1984 | 1985 | .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 |
| 2081 | 2082 | if (base_array_ty.len == .incomplete) if (init_list_expr.qt.get(p.comp, .array)) |init_array_ty| { |
| 2082 | 2083 | switch (init_array_ty.len) { |
| 2083 | 2084 | .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 = .{ | |
| 2085 | 2086 | .elem = base_array_ty.elem, |
| 2086 | 2087 | .len = .{ .fixed = len }, |
| 2087 | 2088 | } })).withQualifiers(init_d.d.qt); |
| ... | ... | @@ -2132,11 +2133,11 @@ fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize, decl_no |
| 2132 | 2133 | break :incomplete; |
| 2133 | 2134 | }, |
| 2134 | 2135 | .@"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); | |
| 2136 | 2137 | break :incomplete; |
| 2137 | 2138 | }, |
| 2138 | 2139 | .@"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); | |
| 2140 | 2141 | break :incomplete; |
| 2141 | 2142 | }, |
| 2142 | 2143 | else => {}, |
| ... | ... | @@ -2234,6 +2235,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool { |
| 2234 | 2235 | => { |
| 2235 | 2236 | const align_tok = p.tok_i; |
| 2236 | 2237 | p.tok_i += 1; |
| 2238 | const gpa = p.comp.gpa; | |
| 2237 | 2239 | const l_paren = try p.expectToken(.l_paren); |
| 2238 | 2240 | const typename_start = p.tok_i; |
| 2239 | 2241 | if (try p.typeName()) |inner_qt| { |
| ... | ... | @@ -2241,7 +2243,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool { |
| 2241 | 2243 | try p.err(typename_start, .invalid_alignof, .{inner_qt}); |
| 2242 | 2244 | } |
| 2243 | 2245 | 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, .{ | |
| 2245 | 2247 | .attr = .{ .tag = .aligned, .args = .{ |
| 2246 | 2248 | .aligned = .{ .alignment = alignment, .__name_tok = align_tok }, |
| 2247 | 2249 | }, .syntax = .keyword }, |
| ... | ... | @@ -2257,7 +2259,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool { |
| 2257 | 2259 | return error.ParsingFailed; |
| 2258 | 2260 | } |
| 2259 | 2261 | args.aligned.alignment.?.node = .pack(res.node); |
| 2260 | try p.attr_buf.append(p.gpa, .{ | |
| 2262 | try p.attr_buf.append(gpa, .{ | |
| 2261 | 2263 | .attr = .{ .tag = .aligned, .args = args, .syntax = .keyword }, |
| 2262 | 2264 | .tok = align_tok, |
| 2263 | 2265 | }); |
| ... | ... | @@ -2336,7 +2338,7 @@ fn getAnonymousName(p: *Parser, kind_tok: TokenIndex) !StringId { |
| 2336 | 2338 | else => "record field", |
| 2337 | 2339 | }; |
| 2338 | 2340 | |
| 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); | |
| 2340 | 2342 | defer p.comp.type_store.anon_name_arena = arena.state; |
| 2341 | 2343 | const str = try std.fmt.allocPrint( |
| 2342 | 2344 | arena.allocator(), |
| ... | ... | @@ -2350,6 +2352,7 @@ fn getAnonymousName(p: *Parser, kind_tok: TokenIndex) !StringId { |
| 2350 | 2352 | /// : (keyword_struct | keyword_union) IDENTIFIER? { recordDecls } |
| 2351 | 2353 | /// | (keyword_struct | keyword_union) IDENTIFIER |
| 2352 | 2354 | fn recordSpec(p: *Parser) Error!QualType { |
| 2355 | const gpa = p.comp.gpa; | |
| 2353 | 2356 | const starting_pragma_pack = p.pragma_pack; |
| 2354 | 2357 | const kind_tok = p.tok_i; |
| 2355 | 2358 | const is_struct = p.tok_ids[kind_tok] == .keyword_struct; |
| ... | ... | @@ -2358,7 +2361,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2358 | 2361 | defer p.attr_buf.len = attr_buf_top; |
| 2359 | 2362 | try p.attributeSpecifier(); |
| 2360 | 2363 | |
| 2361 | const reserved_index = try p.tree.nodes.addOne(p.gpa); | |
| 2364 | const reserved_index = try p.tree.nodes.addOne(gpa); | |
| 2362 | 2365 | |
| 2363 | 2366 | const maybe_ident = try p.eatIdentifier(); |
| 2364 | 2367 | const l_brace = p.eatToken(.l_brace) orelse { |
| ... | ... | @@ -2378,13 +2381,13 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2378 | 2381 | .decl_node = @enumFromInt(reserved_index), |
| 2379 | 2382 | .fields = &.{}, |
| 2380 | 2383 | }; |
| 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) | |
| 2382 | 2385 | .{ .@"struct" = record_ty } |
| 2383 | 2386 | else |
| 2384 | 2387 | .{ .@"union" = record_ty }); |
| 2385 | 2388 | |
| 2386 | 2389 | 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, .{ | |
| 2388 | 2391 | .kind = if (is_struct) .@"struct" else .@"union", |
| 2389 | 2392 | .name = interned_name, |
| 2390 | 2393 | .tok = ident, |
| ... | ... | @@ -2401,7 +2404,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2401 | 2404 | .{ .struct_forward_decl = fw } |
| 2402 | 2405 | else |
| 2403 | 2406 | .{ .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)); | |
| 2405 | 2408 | return attributed_qt; |
| 2406 | 2409 | } |
| 2407 | 2410 | }; |
| ... | ... | @@ -2435,7 +2438,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2435 | 2438 | .layout = null, |
| 2436 | 2439 | .fields = &.{}, |
| 2437 | 2440 | }; |
| 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) | |
| 2439 | 2442 | .{ .@"struct" = record_ty } |
| 2440 | 2443 | else |
| 2441 | 2444 | .{ .@"union" = record_ty }); |
| ... | ... | @@ -2443,7 +2446,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2443 | 2446 | // declare a symbol for the type |
| 2444 | 2447 | // We need to replace the symbol's type if it has attributes |
| 2445 | 2448 | if (maybe_ident != null) { |
| 2446 | try p.syms.define(p.gpa, .{ | |
| 2449 | try p.syms.define(gpa, .{ | |
| 2447 | 2450 | .kind = if (is_struct) .@"struct" else .@"union", |
| 2448 | 2451 | .name = record_ty.name, |
| 2449 | 2452 | .tok = maybe_ident.?, |
| ... | ... | @@ -2455,7 +2458,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2455 | 2458 | break :blk .{ record_ty, record_qt }; |
| 2456 | 2459 | }; |
| 2457 | 2460 | |
| 2458 | try p.decl_buf.append(@enumFromInt(reserved_index)); | |
| 2461 | try p.decl_buf.append(gpa, @enumFromInt(reserved_index)); | |
| 2459 | 2462 | const decl_buf_top = p.decl_buf.items.len; |
| 2460 | 2463 | const record_buf_top = p.record_buf.items.len; |
| 2461 | 2464 | errdefer p.decl_buf.items.len = decl_buf_top - 1; |
| ... | ... | @@ -2512,10 +2515,10 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2512 | 2515 | const base_type = qt.base(p.comp); |
| 2513 | 2516 | if (is_struct) { |
| 2514 | 2517 | 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)); | |
| 2516 | 2519 | } else { |
| 2517 | 2520 | 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)); | |
| 2519 | 2522 | } |
| 2520 | 2523 | break :blk false; |
| 2521 | 2524 | }; |
| ... | ... | @@ -2603,6 +2606,7 @@ fn recordDecls(p: *Parser) Error!void { |
| 2603 | 2606 | /// recordDecl : typeSpec+ (recordDeclarator (',' recordDeclarator)*)? |
| 2604 | 2607 | /// recordDeclarator : declarator (':' integerConstExpr)? |
| 2605 | 2608 | fn recordDecl(p: *Parser) Error!bool { |
| 2609 | const gpa = p.comp.gpa; | |
| 2606 | 2610 | const attr_buf_top = p.attr_buf.len; |
| 2607 | 2611 | defer p.attr_buf.len = attr_buf_top; |
| 2608 | 2612 | |
| ... | ... | @@ -2698,7 +2702,7 @@ fn recordDecl(p: *Parser) Error!bool { |
| 2698 | 2702 | |
| 2699 | 2703 | const attr_index: u32 = @intCast(p.comp.type_store.attributes.items.len); |
| 2700 | 2704 | 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); | |
| 2702 | 2706 | |
| 2703 | 2707 | if (name_tok == 0 and bits == null) unnamed: { |
| 2704 | 2708 | var is_typedef = false; |
| ... | ... | @@ -2717,7 +2721,7 @@ fn recordDecl(p: *Parser) Error!bool { |
| 2717 | 2721 | try p.err(first_tok, .anonymous_struct, .{}); |
| 2718 | 2722 | } |
| 2719 | 2723 | // An anonymous record appears as indirect fields on the parent |
| 2720 | try p.record_buf.append(.{ | |
| 2724 | try p.record_buf.append(gpa, .{ | |
| 2721 | 2725 | .name = try p.getAnonymousName(first_tok), |
| 2722 | 2726 | .qt = qt, |
| 2723 | 2727 | ._attr_index = attr_index, |
| ... | ... | @@ -2731,7 +2735,7 @@ fn recordDecl(p: *Parser) Error!bool { |
| 2731 | 2735 | .bit_width = null, |
| 2732 | 2736 | }, |
| 2733 | 2737 | }); |
| 2734 | try p.decl_buf.append(node); | |
| 2738 | try p.decl_buf.append(gpa, node); | |
| 2735 | 2739 | try p.record.addFieldsFromAnonymous(p, record_ty); |
| 2736 | 2740 | break; // must be followed by a semicolon |
| 2737 | 2741 | }, |
| ... | ... | @@ -2746,7 +2750,7 @@ fn recordDecl(p: *Parser) Error!bool { |
| 2746 | 2750 | continue; |
| 2747 | 2751 | } else { |
| 2748 | 2752 | 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, .{ | |
| 2750 | 2754 | .name = interned_name, |
| 2751 | 2755 | .qt = qt, |
| 2752 | 2756 | .name_tok = name_tok, |
| ... | ... | @@ -2762,7 +2766,7 @@ fn recordDecl(p: *Parser) Error!bool { |
| 2762 | 2766 | .bit_width = bits_node, |
| 2763 | 2767 | }, |
| 2764 | 2768 | }); |
| 2765 | try p.decl_buf.append(node); | |
| 2769 | try p.decl_buf.append(gpa, node); | |
| 2766 | 2770 | } |
| 2767 | 2771 | |
| 2768 | 2772 | if (!qt.isInvalid()) { |
| ... | ... | @@ -2834,6 +2838,7 @@ fn specQual(p: *Parser) Error!?QualType { |
| 2834 | 2838 | /// : keyword_enum IDENTIFIER? (: typeName)? { enumerator (',' enumerator)? ',') } |
| 2835 | 2839 | /// | keyword_enum IDENTIFIER (: typeName)? |
| 2836 | 2840 | fn enumSpec(p: *Parser) Error!QualType { |
| 2841 | const gpa = p.comp.gpa; | |
| 2837 | 2842 | const enum_tok = p.tok_i; |
| 2838 | 2843 | p.tok_i += 1; |
| 2839 | 2844 | const attr_buf_top = p.attr_buf.len; |
| ... | ... | @@ -2864,7 +2869,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2864 | 2869 | break :fixed fixed; |
| 2865 | 2870 | } else null; |
| 2866 | 2871 | |
| 2867 | const reserved_index = try p.tree.nodes.addOne(p.gpa); | |
| 2872 | const reserved_index = try p.tree.nodes.addOne(gpa); | |
| 2868 | 2873 | |
| 2869 | 2874 | const l_brace = p.eatToken(.l_brace) orelse { |
| 2870 | 2875 | const ident = maybe_ident orelse { |
| ... | ... | @@ -2879,7 +2884,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2879 | 2884 | try p.checkEnumFixedTy(fixed_qt, ident, prev); |
| 2880 | 2885 | return prev.qt; |
| 2881 | 2886 | } 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" = .{ | |
| 2883 | 2888 | .name = interned_name, |
| 2884 | 2889 | .tag = fixed_qt, |
| 2885 | 2890 | .fixed = fixed_qt != null, |
| ... | ... | @@ -2889,7 +2894,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2889 | 2894 | } }); |
| 2890 | 2895 | |
| 2891 | 2896 | 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, .{ | |
| 2893 | 2898 | .kind = .@"enum", |
| 2894 | 2899 | .name = interned_name, |
| 2895 | 2900 | .tok = ident, |
| ... | ... | @@ -2897,7 +2902,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2897 | 2902 | .val = .{}, |
| 2898 | 2903 | }); |
| 2899 | 2904 | |
| 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 = .{ | |
| 2901 | 2906 | .name_or_kind_tok = ident, |
| 2902 | 2907 | .container_qt = attributed_qt, |
| 2903 | 2908 | .definition = null, |
| ... | ... | @@ -2940,12 +2945,12 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2940 | 2945 | .fixed = fixed_qt != null, |
| 2941 | 2946 | .fields = &.{}, |
| 2942 | 2947 | }; |
| 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 }); | |
| 2944 | 2949 | break :blk .{ enum_ty, enum_qt }; |
| 2945 | 2950 | }; |
| 2946 | 2951 | |
| 2947 | 2952 | // reserve space for this enum |
| 2948 | try p.decl_buf.append(@enumFromInt(reserved_index)); | |
| 2953 | try p.decl_buf.append(gpa, @enumFromInt(reserved_index)); | |
| 2949 | 2954 | const decl_buf_top = p.decl_buf.items.len; |
| 2950 | 2955 | const list_buf_top = p.list_buf.items.len; |
| 2951 | 2956 | const enum_buf_top = p.enum_buf.items.len; |
| ... | ... | @@ -2958,8 +2963,8 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2958 | 2963 | |
| 2959 | 2964 | var e = Enumerator.init(fixed_qt); |
| 2960 | 2965 | 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); | |
| 2963 | 2968 | if (p.eatToken(.comma) == null) break; |
| 2964 | 2969 | } |
| 2965 | 2970 | |
| ... | ... | @@ -2996,7 +3001,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2996 | 3001 | |
| 2997 | 3002 | const symbol = p.syms.getPtr(field.name, .vars); |
| 2998 | 3003 | _ = 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); | |
| 3000 | 3005 | |
| 3001 | 3006 | symbol.qt = dest_ty; |
| 3002 | 3007 | field.qt = dest_ty; |
| ... | ... | @@ -3022,12 +3027,12 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 3022 | 3027 | enum_ty.decl_node = @enumFromInt(reserved_index); |
| 3023 | 3028 | const base_type = attributed_qt.base(p.comp); |
| 3024 | 3029 | 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)); | |
| 3026 | 3031 | } |
| 3027 | 3032 | |
| 3028 | 3033 | // declare a symbol for the type |
| 3029 | 3034 | if (maybe_ident != null and !defined) { |
| 3030 | try p.syms.define(p.gpa, .{ | |
| 3035 | try p.syms.define(gpa, .{ | |
| 3031 | 3036 | .kind = .@"enum", |
| 3032 | 3037 | .name = enum_ty.name, |
| 3033 | 3038 | .qt = attributed_qt, |
| ... | ... | @@ -3231,7 +3236,7 @@ fn enumerator(p: *Parser, e: *Enumerator) Error!?EnumFieldAndNode { |
| 3231 | 3236 | .init = field_init, |
| 3232 | 3237 | }, |
| 3233 | 3238 | }); |
| 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); | |
| 3235 | 3240 | |
| 3236 | 3241 | const interned_name = try p.comp.internString(p.tokSlice(name_tok)); |
| 3237 | 3242 | 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 { |
| 3297 | 3302 | } else switch (b.nullability) { |
| 3298 | 3303 | .none => { |
| 3299 | 3304 | b.nullability = new; |
| 3300 | try p.attr_buf.append(p.gpa, .{ | |
| 3305 | try p.attr_buf.append(p.comp.gpa, .{ | |
| 3301 | 3306 | .attr = .{ .tag = .nullability, .args = .{ |
| 3302 | 3307 | .nullability = .{ .kind = switch (tok_id) { |
| 3303 | 3308 | .keyword_nonnull => .nonnull, |
| ... | ... | @@ -3341,7 +3346,7 @@ fn msTypeAttribute(p: *Parser) !bool { |
| 3341 | 3346 | .keyword_cdecl, |
| 3342 | 3347 | .keyword_cdecl2, |
| 3343 | 3348 | => { |
| 3344 | try p.attr_buf.append(p.gpa, .{ | |
| 3349 | try p.attr_buf.append(p.comp.gpa, .{ | |
| 3345 | 3350 | .attr = .{ .tag = .calling_convention, .args = .{ |
| 3346 | 3351 | .calling_convention = .{ .cc = switch (p.tok_ids[p.tok_i]) { |
| 3347 | 3352 | .keyword_stdcall, |
| ... | ... | @@ -3496,7 +3501,7 @@ fn declarator( |
| 3496 | 3501 | var builder: TypeStore.Builder = .{ .parser = p }; |
| 3497 | 3502 | _ = try p.typeQual(&builder, true); |
| 3498 | 3503 | |
| 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 = .{ | |
| 3500 | 3505 | .child = d.qt, |
| 3501 | 3506 | .decayed = null, |
| 3502 | 3507 | } }); |
| ... | ... | @@ -3611,6 +3616,7 @@ fn directDeclarator( |
| 3611 | 3616 | base_declarator: *Declarator, |
| 3612 | 3617 | kind: Declarator.Kind, |
| 3613 | 3618 | ) Error!QualType { |
| 3619 | const gpa = p.comp.gpa; | |
| 3614 | 3620 | if (p.eatToken(.l_bracket)) |l_bracket| { |
| 3615 | 3621 | // Check for C23 attribute |
| 3616 | 3622 | if (p.tok_ids[p.tok_i] == .l_bracket) { |
| ... | ... | @@ -3674,7 +3680,7 @@ fn directDeclarator( |
| 3674 | 3680 | try p.err(base_declarator.name, .variable_len_array_file_scope, .{}); |
| 3675 | 3681 | } |
| 3676 | 3682 | |
| 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 = .{ | |
| 3678 | 3684 | .elem = outer, |
| 3679 | 3685 | .len = .{ .variable = size.node }, |
| 3680 | 3686 | } }); |
| ... | ... | @@ -3690,7 +3696,7 @@ fn directDeclarator( |
| 3690 | 3696 | } |
| 3691 | 3697 | |
| 3692 | 3698 | 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 = .{ | |
| 3694 | 3700 | .elem = outer, |
| 3695 | 3701 | .len = if (static != null) |
| 3696 | 3702 | .{ .static = len } |
| ... | ... | @@ -3700,13 +3706,13 @@ fn directDeclarator( |
| 3700 | 3706 | return builder.finishQuals(array_qt); |
| 3701 | 3707 | } |
| 3702 | 3708 | } 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 = .{ | |
| 3704 | 3710 | .elem = outer, |
| 3705 | 3711 | .len = .unspecified_variable, |
| 3706 | 3712 | } }); |
| 3707 | 3713 | return builder.finishQuals(array_qt); |
| 3708 | 3714 | } 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 = .{ | |
| 3710 | 3716 | .elem = outer, |
| 3711 | 3717 | .len = .incomplete, |
| 3712 | 3718 | } }); |
| ... | ... | @@ -3729,7 +3735,7 @@ fn directDeclarator( |
| 3729 | 3735 | // Set after call to `directDeclarator` since we will return |
| 3730 | 3736 | // a function type from here. |
| 3731 | 3737 | 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 }); | |
| 3733 | 3739 | } |
| 3734 | 3740 | |
| 3735 | 3741 | // Set here so the call to directDeclarator for the return type |
| ... | ... | @@ -3756,7 +3762,7 @@ fn directDeclarator( |
| 3756 | 3762 | const name_tok = try p.expectIdentifier(); |
| 3757 | 3763 | const interned_name = try p.comp.internString(p.tokSlice(name_tok)); |
| 3758 | 3764 | try p.syms.defineParam(p, interned_name, undefined, name_tok, null); |
| 3759 | try p.param_buf.append(.{ | |
| 3765 | try p.param_buf.append(gpa, .{ | |
| 3760 | 3766 | .name = interned_name, |
| 3761 | 3767 | .name_tok = name_tok, |
| 3762 | 3768 | .qt = .int, |
| ... | ... | @@ -3776,7 +3782,7 @@ fn directDeclarator( |
| 3776 | 3782 | // a function type from here. |
| 3777 | 3783 | base_declarator.declarator_type = .func; |
| 3778 | 3784 | |
| 3779 | return p.comp.type_store.put(p.gpa, .{ .func = func_ty }); | |
| 3785 | return p.comp.type_store.put(gpa, .{ .func = func_ty }); | |
| 3780 | 3786 | } else return base_declarator.qt; |
| 3781 | 3787 | } |
| 3782 | 3788 | |
| ... | ... | @@ -3789,6 +3795,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param { |
| 3789 | 3795 | |
| 3790 | 3796 | // Clearing the param buf is handled in directDeclarator. |
| 3791 | 3797 | const param_buf_top = p.param_buf.items.len; |
| 3798 | const gpa = p.comp.gpa; | |
| 3792 | 3799 | |
| 3793 | 3800 | while (true) { |
| 3794 | 3801 | const attr_buf_top = p.attr_buf.len; |
| ... | ... | @@ -3802,7 +3809,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param { |
| 3802 | 3809 | const identifier = try p.expectIdentifier(); |
| 3803 | 3810 | try p.err(identifier, .unknown_type_name, .{p.tokSlice(identifier)}); |
| 3804 | 3811 | |
| 3805 | try p.param_buf.append(.{ | |
| 3812 | try p.param_buf.append(gpa, .{ | |
| 3806 | 3813 | .name = try p.comp.internString(p.tokSlice(identifier)), |
| 3807 | 3814 | .name_tok = identifier, |
| 3808 | 3815 | .qt = .int, |
| ... | ... | @@ -3882,7 +3889,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param { |
| 3882 | 3889 | try p.syms.defineParam(p, interned_name, param_qt, name_tok, node); |
| 3883 | 3890 | } |
| 3884 | 3891 | |
| 3885 | try p.param_buf.append(.{ | |
| 3892 | try p.param_buf.append(gpa, .{ | |
| 3886 | 3893 | .name = interned_name, |
| 3887 | 3894 | .name_tok = if (name_tok == 0) first_tok else name_tok, |
| 3888 | 3895 | .qt = param_qt, |
| ... | ... | @@ -3932,7 +3939,7 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result { |
| 3932 | 3939 | } |
| 3933 | 3940 | |
| 3934 | 3941 | var il: InitList = .{}; |
| 3935 | defer il.deinit(p.gpa); | |
| 3942 | defer il.deinit(p.comp.gpa); | |
| 3936 | 3943 | |
| 3937 | 3944 | try p.initializerItem(&il, final_init_qt, l_brace); |
| 3938 | 3945 | |
| ... | ... | @@ -3944,10 +3951,11 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result { |
| 3944 | 3951 | }; |
| 3945 | 3952 | } |
| 3946 | 3953 | |
| 3947 | const IndexList = std.ArrayListUnmanaged(u64); | |
| 3954 | const IndexList = std.ArrayList(u64); | |
| 3948 | 3955 | |
| 3949 | 3956 | /// initializerItems : designation? initializer (',' designation? initializer)* ','? |
| 3950 | 3957 | fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenIndex) Error!void { |
| 3958 | const gpa = p.comp.gpa; | |
| 3951 | 3959 | const is_scalar = !init_qt.isInvalid() and init_qt.scalarKind(p.comp) != .none; |
| 3952 | 3960 | |
| 3953 | 3961 | if (p.eatToken(.r_brace)) |_| { |
| ... | ... | @@ -3962,7 +3970,7 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI |
| 3962 | 3970 | } |
| 3963 | 3971 | |
| 3964 | 3972 | var index_list: IndexList = .empty; |
| 3965 | defer index_list.deinit(p.gpa); | |
| 3973 | defer index_list.deinit(gpa); | |
| 3966 | 3974 | |
| 3967 | 3975 | var seen_any = false; |
| 3968 | 3976 | var warned_excess = init_qt.isInvalid(); |
| ... | ... | @@ -3980,14 +3988,14 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI |
| 3980 | 3988 | if (item.il.tok != 0 and !init_qt.isInvalid()) { |
| 3981 | 3989 | try p.err(first_tok, .initializer_overrides, .{}); |
| 3982 | 3990 | try p.err(item.il.tok, .previous_initializer, .{}); |
| 3983 | item.il.deinit(p.gpa); | |
| 3991 | item.il.deinit(gpa); | |
| 3984 | 3992 | item.il.* = .{}; |
| 3985 | 3993 | } |
| 3986 | 3994 | try p.initializerItem(item.il, item.qt, inner_l_brace); |
| 3987 | 3995 | } else { |
| 3988 | 3996 | // discard further values |
| 3989 | 3997 | var tmp_il: InitList = .{}; |
| 3990 | defer tmp_il.deinit(p.gpa); | |
| 3998 | defer tmp_il.deinit(gpa); | |
| 3991 | 3999 | try p.initializerItem(&tmp_il, .invalid, inner_l_brace); |
| 3992 | 4000 | if (!warned_excess) try p.err(first_tok, switch (init_qt.base(p.comp).type) { |
| 3993 | 4001 | .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 |
| 4042 | 4050 | .l_bracket, .period => index_list.items.len = 0, |
| 4043 | 4051 | else => return false, |
| 4044 | 4052 | } |
| 4053 | const gpa = p.comp.gpa; | |
| 4045 | 4054 | |
| 4046 | 4055 | var cur_qt = init_qt; |
| 4047 | 4056 | var cur_il = il; |
| ... | ... | @@ -4074,8 +4083,8 @@ fn designation(p: *Parser, il: *InitList, init_qt: QualType, index_list: *IndexL |
| 4074 | 4083 | return error.ParsingFailed; |
| 4075 | 4084 | } |
| 4076 | 4085 | |
| 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); | |
| 4079 | 4088 | cur_qt = array_ty.elem; |
| 4080 | 4089 | } else if (p.eatToken(.period)) |period| { |
| 4081 | 4090 | const field_tok = try p.expectIdentifier(); |
| ... | ... | @@ -4094,16 +4103,16 @@ fn designation(p: *Parser, il: *InitList, init_qt: QualType, index_list: *IndexL |
| 4094 | 4103 | if (field.name_tok == 0) if (field.qt.getRecord(p.comp)) |field_record_ty| { |
| 4095 | 4104 | // Recurse into anonymous field if it has a field by the name. |
| 4096 | 4105 | 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); | |
| 4099 | 4108 | record_ty = field_record_ty; |
| 4100 | 4109 | field_index = 0; |
| 4101 | 4110 | continue; |
| 4102 | 4111 | }; |
| 4103 | 4112 | if (field.name == target_name) { |
| 4104 | 4113 | 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); | |
| 4107 | 4116 | break; |
| 4108 | 4117 | } |
| 4109 | 4118 | field_index += 1; |
| ... | ... | @@ -4132,7 +4141,8 @@ fn findScalarInitializer( |
| 4132 | 4141 | index_list_top: u32, |
| 4133 | 4142 | ) Error!bool { |
| 4134 | 4143 | 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); | |
| 4136 | 4146 | const index = index_list.items[index_list_top]; |
| 4137 | 4147 | |
| 4138 | 4148 | switch (qt.base(p.comp).type) { |
| ... | ... | @@ -4147,7 +4157,7 @@ fn findScalarInitializer( |
| 4147 | 4157 | return true; |
| 4148 | 4158 | } |
| 4149 | 4159 | |
| 4150 | const elem_il = try il.find(p.gpa, index); | |
| 4160 | const elem_il = try il.find(gpa, index); | |
| 4151 | 4161 | if (try p.setInitializerIfEqual(elem_il, complex_ty, first_tok, res) or |
| 4152 | 4162 | try p.findScalarInitializer( |
| 4153 | 4163 | elem_il, |
| ... | ... | @@ -4180,7 +4190,7 @@ fn findScalarInitializer( |
| 4180 | 4190 | return true; |
| 4181 | 4191 | } |
| 4182 | 4192 | |
| 4183 | const elem_il = try il.find(p.gpa, index); | |
| 4193 | const elem_il = try il.find(gpa, index); | |
| 4184 | 4194 | if (try p.setInitializerIfEqual(elem_il, vector_ty.elem, first_tok, res) or |
| 4185 | 4195 | try p.findScalarInitializer( |
| 4186 | 4196 | elem_il, |
| ... | ... | @@ -4229,7 +4239,7 @@ fn findScalarInitializer( |
| 4229 | 4239 | return true; |
| 4230 | 4240 | } |
| 4231 | 4241 | |
| 4232 | const elem_il = try il.find(p.gpa, index); | |
| 4242 | const elem_il = try il.find(gpa, index); | |
| 4233 | 4243 | if (try p.setInitializerIfEqual(elem_il, array_ty.elem, first_tok, res) or |
| 4234 | 4244 | try p.findScalarInitializer( |
| 4235 | 4245 | elem_il, |
| ... | ... | @@ -4262,7 +4272,7 @@ fn findScalarInitializer( |
| 4262 | 4272 | } |
| 4263 | 4273 | |
| 4264 | 4274 | 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); | |
| 4266 | 4276 | if (try p.setInitializerIfEqual(field_il, field.qt, first_tok, res) or |
| 4267 | 4277 | try p.findScalarInitializer( |
| 4268 | 4278 | field_il, |
| ... | ... | @@ -4297,7 +4307,7 @@ fn findScalarInitializer( |
| 4297 | 4307 | } |
| 4298 | 4308 | |
| 4299 | 4309 | 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); | |
| 4301 | 4311 | if (try p.setInitializerIfEqual(field_il, field.qt, first_tok, res) or |
| 4302 | 4312 | try p.findScalarInitializer( |
| 4303 | 4313 | field_il, |
| ... | ... | @@ -4342,7 +4352,8 @@ fn findBracedInitializer( |
| 4342 | 4352 | if (il.node != .null) return .{ .il = il, .qt = qt }; |
| 4343 | 4353 | return null; |
| 4344 | 4354 | } |
| 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); | |
| 4346 | 4357 | const index = index_list.items[0]; |
| 4347 | 4358 | |
| 4348 | 4359 | switch (qt.base(p.comp).type) { |
| ... | ... | @@ -4352,7 +4363,7 @@ fn findBracedInitializer( |
| 4352 | 4363 | if (index < 2) { |
| 4353 | 4364 | index_list.items[0] = index + 1; |
| 4354 | 4365 | 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 }; | |
| 4356 | 4367 | } |
| 4357 | 4368 | }, |
| 4358 | 4369 | .vector => |vector_ty| { |
| ... | ... | @@ -4361,7 +4372,7 @@ fn findBracedInitializer( |
| 4361 | 4372 | if (index < vector_ty.len) { |
| 4362 | 4373 | index_list.items[0] = index + 1; |
| 4363 | 4374 | 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 }; | |
| 4365 | 4376 | } |
| 4366 | 4377 | }, |
| 4367 | 4378 | .array => |array_ty| { |
| ... | ... | @@ -4374,7 +4385,7 @@ fn findBracedInitializer( |
| 4374 | 4385 | if (index < max_len) { |
| 4375 | 4386 | index_list.items[0] = index + 1; |
| 4376 | 4387 | 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 }; | |
| 4378 | 4389 | } |
| 4379 | 4390 | }, |
| 4380 | 4391 | .@"struct" => |struct_ty| { |
| ... | ... | @@ -4384,7 +4395,7 @@ fn findBracedInitializer( |
| 4384 | 4395 | index_list.items[0] = index + 1; |
| 4385 | 4396 | index_list.items.len = 1; |
| 4386 | 4397 | 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 }; | |
| 4388 | 4399 | } |
| 4389 | 4400 | }, |
| 4390 | 4401 | .@"union" => |union_ty| { |
| ... | ... | @@ -4395,7 +4406,7 @@ fn findBracedInitializer( |
| 4395 | 4406 | index_list.items[0] = index + 1; |
| 4396 | 4407 | index_list.items.len = 1; |
| 4397 | 4408 | 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 }; | |
| 4399 | 4410 | } |
| 4400 | 4411 | }, |
| 4401 | 4412 | else => { |
| ... | ... | @@ -4495,6 +4506,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4495 | 4506 | |
| 4496 | 4507 | if (il.node.unpack()) |some| return some; |
| 4497 | 4508 | |
| 4509 | const gpa = p.comp.gpa; | |
| 4498 | 4510 | switch (init_qt.base(p.comp).type) { |
| 4499 | 4511 | .complex => |complex_ty| { |
| 4500 | 4512 | if (il.list.items.len == 0) { |
| ... | ... | @@ -4535,7 +4547,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4535 | 4547 | 128 => .{ .complex = .{ .cf128 = .{ first_val.toFloat(f128, p.comp), second_val.toFloat(f128, p.comp) } } }, |
| 4536 | 4548 | else => unreachable, |
| 4537 | 4549 | }); |
| 4538 | try p.tree.value_map.put(p.gpa, node, complex_val); | |
| 4550 | try p.tree.value_map.put(gpa, node, complex_val); | |
| 4539 | 4551 | return node; |
| 4540 | 4552 | }, |
| 4541 | 4553 | .vector => |vector_ty| { |
| ... | ... | @@ -4555,12 +4567,12 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4555 | 4567 | .qt = elem_ty, |
| 4556 | 4568 | }, |
| 4557 | 4569 | }); |
| 4558 | try p.list_buf.append(elem); | |
| 4570 | try p.list_buf.append(gpa, elem); | |
| 4559 | 4571 | } |
| 4560 | 4572 | start = init.index + 1; |
| 4561 | 4573 | |
| 4562 | 4574 | const elem = try p.convertInitList(init.list, elem_ty); |
| 4563 | try p.list_buf.append(elem); | |
| 4575 | try p.list_buf.append(gpa, elem); | |
| 4564 | 4576 | } |
| 4565 | 4577 | |
| 4566 | 4578 | if (start < max_len) { |
| ... | ... | @@ -4571,7 +4583,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4571 | 4583 | .qt = elem_ty, |
| 4572 | 4584 | }, |
| 4573 | 4585 | }); |
| 4574 | try p.list_buf.append(elem); | |
| 4586 | try p.list_buf.append(gpa, elem); | |
| 4575 | 4587 | } |
| 4576 | 4588 | |
| 4577 | 4589 | return p.addNode(.{ .array_init_expr = .{ |
| ... | ... | @@ -4605,12 +4617,12 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4605 | 4617 | .qt = elem_ty, |
| 4606 | 4618 | }, |
| 4607 | 4619 | }); |
| 4608 | try p.list_buf.append(elem); | |
| 4620 | try p.list_buf.append(gpa, elem); | |
| 4609 | 4621 | } |
| 4610 | 4622 | start = init.index + 1; |
| 4611 | 4623 | |
| 4612 | 4624 | const elem = try p.convertInitList(init.list, elem_ty); |
| 4613 | try p.list_buf.append(elem); | |
| 4625 | try p.list_buf.append(gpa, elem); | |
| 4614 | 4626 | } |
| 4615 | 4627 | |
| 4616 | 4628 | 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 |
| 4621 | 4633 | |
| 4622 | 4634 | var arr_init_qt = init_qt; |
| 4623 | 4635 | 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 = .{ | |
| 4625 | 4637 | .elem = array_ty.elem, |
| 4626 | 4638 | .len = .{ .fixed = start }, |
| 4627 | 4639 | } }); |
| ... | ... | @@ -4633,7 +4645,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4633 | 4645 | .qt = elem_ty, |
| 4634 | 4646 | }, |
| 4635 | 4647 | }); |
| 4636 | try p.list_buf.append(elem); | |
| 4648 | try p.list_buf.append(gpa, elem); | |
| 4637 | 4649 | } |
| 4638 | 4650 | |
| 4639 | 4651 | return p.addNode(.{ .array_init_expr = .{ |
| ... | ... | @@ -4651,7 +4663,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4651 | 4663 | for (struct_ty.fields, 0..) |field, i| { |
| 4652 | 4664 | if (init_index < il.list.items.len and il.list.items[init_index].index == i) { |
| 4653 | 4665 | 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); | |
| 4655 | 4667 | init_index += 1; |
| 4656 | 4668 | } else { |
| 4657 | 4669 | const item = try p.addNode(.{ |
| ... | ... | @@ -4660,7 +4672,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index |
| 4660 | 4672 | .qt = field.qt, |
| 4661 | 4673 | }, |
| 4662 | 4674 | }); |
| 4663 | try p.list_buf.append(item); | |
| 4675 | try p.list_buf.append(gpa, item); | |
| 4664 | 4676 | } |
| 4665 | 4677 | } |
| 4666 | 4678 | |
| ... | ... | @@ -4706,19 +4718,20 @@ fn msvcAsmStmt(p: *Parser) Error!?Node.Index { |
| 4706 | 4718 | } |
| 4707 | 4719 | |
| 4708 | 4720 | /// asmOperand : ('[' IDENTIFIER ']')? asmStr '(' expr ')' |
| 4709 | fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void { | |
| 4721 | fn asmOperand(p: *Parser, names: *std.ArrayList(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void { | |
| 4722 | const gpa = p.comp.gpa; | |
| 4710 | 4723 | if (p.eatToken(.l_bracket)) |l_bracket| { |
| 4711 | 4724 | const ident = (try p.eatIdentifier()) orelse { |
| 4712 | 4725 | try p.err(p.tok_i, .expected_identifier, .{}); |
| 4713 | 4726 | return error.ParsingFailed; |
| 4714 | 4727 | }; |
| 4715 | try names.append(ident); | |
| 4728 | try names.append(gpa, ident); | |
| 4716 | 4729 | try p.expectClosing(l_bracket, .r_bracket); |
| 4717 | 4730 | } else { |
| 4718 | try names.append(null); | |
| 4731 | try names.append(gpa, null); | |
| 4719 | 4732 | } |
| 4720 | 4733 | const constraint = try p.asmStr(); |
| 4721 | try constraints.append(constraint.node); | |
| 4734 | try constraints.append(gpa, constraint.node); | |
| 4722 | 4735 | |
| 4723 | 4736 | const l_paren = p.eatToken(.l_paren) orelse { |
| 4724 | 4737 | 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 |
| 4727 | 4740 | const maybe_res = try p.expr(); |
| 4728 | 4741 | try p.expectClosing(l_paren, .r_paren); |
| 4729 | 4742 | const res = try p.expectResult(maybe_res); |
| 4730 | try exprs.append(res.node); | |
| 4743 | try exprs.append(gpa, res.node); | |
| 4731 | 4744 | } |
| 4732 | 4745 | |
| 4733 | 4746 | /// gnuAsmStmt |
| ... | ... | @@ -4737,6 +4750,7 @@ fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constrain |
| 4737 | 4750 | /// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)* |
| 4738 | 4751 | /// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)* : IDENTIFIER (',' IDENTIFIER)* |
| 4739 | 4752 | fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex, l_paren: TokenIndex) Error!Node.Index { |
| 4753 | const gpa = p.comp.gpa; | |
| 4740 | 4754 | const asm_str = try p.asmStr(); |
| 4741 | 4755 | try p.checkAsmStr(asm_str.val, l_paren); |
| 4742 | 4756 | |
| ... | ... | @@ -4752,18 +4766,22 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex |
| 4752 | 4766 | const expected_items = 8; // arbitrarily chosen, most assembly will have fewer than 8 inputs/outputs/constraints/names |
| 4753 | 4767 | const bytes_needed = expected_items * @sizeOf(?TokenIndex) + expected_items * 3 * @sizeOf(Node.Index); |
| 4754 | 4768 | |
| 4755 | var stack_fallback = std.heap.stackFallback(bytes_needed, p.gpa); | |
| 4769 | var stack_fallback = std.heap.stackFallback(bytes_needed, gpa); | |
| 4756 | 4770 | const allocator = stack_fallback.get(); |
| 4757 | 4771 | |
| 4758 | 4772 | // 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 | |
| 4767 | 4785 | |
| 4768 | 4786 | // Outputs |
| 4769 | 4787 | var ate_extra_colon = false; |
| ... | ... | @@ -4813,7 +4831,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex |
| 4813 | 4831 | if (!ate_extra_colon and p.tok_ids[p.tok_i].isStringLiteral()) { |
| 4814 | 4832 | while (true) { |
| 4815 | 4833 | const clobber = try p.asmStr(); |
| 4816 | try clobbers.append(clobber.node); | |
| 4834 | try clobbers.append(allocator, clobber.node); | |
| 4817 | 4835 | if (p.eatToken(.comma) == null) break; |
| 4818 | 4836 | } |
| 4819 | 4837 | } |
| ... | ... | @@ -4837,10 +4855,10 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex |
| 4837 | 4855 | }; |
| 4838 | 4856 | const ident_str = p.tokSlice(ident); |
| 4839 | 4857 | 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 }); | |
| 4841 | 4859 | break :blk ident; |
| 4842 | 4860 | }; |
| 4843 | try names.append(ident); | |
| 4861 | try names.append(allocator, ident); | |
| 4844 | 4862 | |
| 4845 | 4863 | const label_addr_node = try p.addNode(.{ |
| 4846 | 4864 | .addr_of_label = .{ |
| ... | ... | @@ -4848,7 +4866,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex |
| 4848 | 4866 | .qt = .void_pointer, |
| 4849 | 4867 | }, |
| 4850 | 4868 | }); |
| 4851 | try exprs.append(label_addr_node); | |
| 4869 | try exprs.append(allocator, label_addr_node); | |
| 4852 | 4870 | |
| 4853 | 4871 | num_labels += 1; |
| 4854 | 4872 | if (p.eatToken(.comma) == null) break; |
| ... | ... | @@ -4922,7 +4940,7 @@ fn assembly(p: *Parser, kind: enum { global, decl_label, stmt }) Error!?Node.Ind |
| 4922 | 4940 | const str = try p.removeNull(asm_str.val); |
| 4923 | 4941 | |
| 4924 | 4942 | 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 }); | |
| 4926 | 4944 | }, |
| 4927 | 4945 | .global => { |
| 4928 | 4946 | const asm_str = try p.asmStr(); |
| ... | ... | @@ -4985,6 +5003,7 @@ fn asmStr(p: *Parser) Error!Result { |
| 4985 | 5003 | fn stmt(p: *Parser) Error!Node.Index { |
| 4986 | 5004 | if (try p.labeledStmt()) |some| return some; |
| 4987 | 5005 | if (try p.compoundStmt(false, null)) |some| return some; |
| 5006 | const gpa = p.comp.gpa; | |
| 4988 | 5007 | if (p.eatToken(.keyword_if)) |kw_if| { |
| 4989 | 5008 | const l_paren = try p.expectToken(.l_paren); |
| 4990 | 5009 | |
| ... | ... | @@ -5035,14 +5054,13 @@ fn stmt(p: *Parser) Error!Node.Index { |
| 5035 | 5054 | try p.expectClosing(l_paren, .r_paren); |
| 5036 | 5055 | |
| 5037 | 5056 | const old_switch = p.@"switch"; |
| 5038 | var @"switch" = Switch{ | |
| 5039 | .ranges = std.array_list.Managed(Switch.Range).init(p.gpa), | |
| 5057 | var @"switch": Switch = .{ | |
| 5040 | 5058 | .qt = cond.qt, |
| 5041 | 5059 | .comp = p.comp, |
| 5042 | 5060 | }; |
| 5043 | 5061 | p.@"switch" = &@"switch"; |
| 5044 | 5062 | defer { |
| 5045 | @"switch".ranges.deinit(); | |
| 5063 | @"switch".ranges.deinit(gpa); | |
| 5046 | 5064 | p.@"switch" = old_switch; |
| 5047 | 5065 | } |
| 5048 | 5066 | |
| ... | ... | @@ -5183,7 +5201,7 @@ fn stmt(p: *Parser) Error!Node.Index { |
| 5183 | 5201 | p.computed_goto_tok = p.computed_goto_tok orelse goto_tok; |
| 5184 | 5202 | |
| 5185 | 5203 | 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 = .{ | |
| 5187 | 5205 | .child = .{ .@"const" = true, ._index = .void }, |
| 5188 | 5206 | .decayed = null, |
| 5189 | 5207 | } }); |
| ... | ... | @@ -5204,7 +5222,7 @@ fn stmt(p: *Parser) Error!Node.Index { |
| 5204 | 5222 | const name_tok = try p.expectIdentifier(); |
| 5205 | 5223 | const str = p.tokSlice(name_tok); |
| 5206 | 5224 | if (p.findLabel(str) == null) { |
| 5207 | try p.labels.append(.{ .unresolved_goto = name_tok }); | |
| 5225 | try p.labels.append(gpa, .{ .unresolved_goto = name_tok }); | |
| 5208 | 5226 | } |
| 5209 | 5227 | _ = try p.expectToken(.semicolon); |
| 5210 | 5228 | return p.addNode(.{ .goto_stmt = .{ .label_tok = name_tok } }); |
| ... | ... | @@ -5259,7 +5277,7 @@ fn labeledStmt(p: *Parser) Error!?Node.Index { |
| 5259 | 5277 | try p.err(some, .previous_label, .{str}); |
| 5260 | 5278 | } else { |
| 5261 | 5279 | p.label_count += 1; |
| 5262 | try p.labels.append(.{ .label = name_tok }); | |
| 5280 | try p.labels.append(p.comp.gpa, .{ .label = name_tok }); | |
| 5263 | 5281 | var i: usize = 0; |
| 5264 | 5282 | while (i < p.labels.items.len) { |
| 5265 | 5283 | if (p.labels.items[i] == .unresolved_goto and |
| ... | ... | @@ -5370,6 +5388,7 @@ const StmtExprState = struct { |
| 5370 | 5388 | fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState) Error!?Node.Index { |
| 5371 | 5389 | const l_brace = p.eatToken(.l_brace) orelse return null; |
| 5372 | 5390 | |
| 5391 | const gpa = p.comp.gpa; | |
| 5373 | 5392 | const decl_buf_top = p.decl_buf.items.len; |
| 5374 | 5393 | defer p.decl_buf.items.len = decl_buf_top; |
| 5375 | 5394 | |
| ... | ... | @@ -5406,7 +5425,7 @@ fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState) |
| 5406 | 5425 | .last_expr_qt = s.qt(&p.tree), |
| 5407 | 5426 | }; |
| 5408 | 5427 | } |
| 5409 | try p.decl_buf.append(s); | |
| 5428 | try p.decl_buf.append(gpa, s); | |
| 5410 | 5429 | |
| 5411 | 5430 | if (noreturn_index == null and p.nodeIsNoreturn(s) == .yes) { |
| 5412 | 5431 | noreturn_index = p.tok_i; |
| ... | ... | @@ -5456,10 +5475,10 @@ fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState) |
| 5456 | 5475 | .return_qt = ret_qt, |
| 5457 | 5476 | .operand = .{ .implicit = return_zero }, |
| 5458 | 5477 | } }); |
| 5459 | try p.decl_buf.append(implicit_ret); | |
| 5478 | try p.decl_buf.append(gpa, implicit_ret); | |
| 5460 | 5479 | } |
| 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); | |
| 5463 | 5482 | } |
| 5464 | 5483 | |
| 5465 | 5484 | return try p.addNode(.{ .compound_stmt = .{ |
| ... | ... | @@ -5988,6 +6007,7 @@ pub const Result = struct { |
| 5988 | 6007 | |
| 5989 | 6008 | fn adjustCondExprPtrs(a: *Result, tok: TokenIndex, b: *Result, p: *Parser) !bool { |
| 5990 | 6009 | assert(a.qt.isPointer(p.comp) and b.qt.isPointer(p.comp)); |
| 6010 | const gpa = p.comp.gpa; | |
| 5991 | 6011 | |
| 5992 | 6012 | const a_elem = a.qt.childType(p.comp); |
| 5993 | 6013 | const b_elem = b.qt.childType(p.comp); |
| ... | ... | @@ -6014,14 +6034,14 @@ pub const Result = struct { |
| 6014 | 6034 | } |
| 6015 | 6035 | |
| 6016 | 6036 | 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 = .{ | |
| 6018 | 6038 | .child = adjusted_elem_qt, |
| 6019 | 6039 | .decayed = null, |
| 6020 | 6040 | } }); |
| 6021 | 6041 | try a.implicitCast(p, .bitcast, tok); |
| 6022 | 6042 | } |
| 6023 | 6043 | 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 = .{ | |
| 6025 | 6045 | .child = adjusted_elem_qt, |
| 6026 | 6046 | .decayed = null, |
| 6027 | 6047 | } }); |
| ... | ... | @@ -6659,7 +6679,7 @@ pub const Result = struct { |
| 6659 | 6679 | /// Saves value without altering the result. |
| 6660 | 6680 | fn putValue(res: *const Result, p: *Parser) !void { |
| 6661 | 6681 | 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); | |
| 6663 | 6683 | } |
| 6664 | 6684 | |
| 6665 | 6685 | fn castType(res: *Result, p: *Parser, dest_qt: QualType, operand_tok: TokenIndex, l_paren: TokenIndex) !void { |
| ... | ... | @@ -7085,9 +7105,13 @@ pub const Result = struct { |
| 7085 | 7105 | return; // ok |
| 7086 | 7106 | } |
| 7087 | 7107 | } 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 | } | |
| 7091 | 7115 | } else if (c == .test_coerce) { |
| 7092 | 7116 | return error.CoercionFailed; |
| 7093 | 7117 | } |
| ... | ... | @@ -7186,6 +7210,47 @@ fn nonAssignExpr(assign_node: std.meta.Tag(Node)) std.meta.Tag(Node) { |
| 7186 | 7210 | }; |
| 7187 | 7211 | } |
| 7188 | 7212 | |
| 7213 | fn 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 | ||
| 7235 | fn 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 | ||
| 7244 | fn 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 | ||
| 7189 | 7254 | /// assignExpr |
| 7190 | 7255 | /// : condExpr |
| 7191 | 7256 | /// | unExpr ('=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=') assignExpr |
| ... | ... | @@ -7209,7 +7274,7 @@ fn assignExpr(p: *Parser) Error!?Result { |
| 7209 | 7274 | |
| 7210 | 7275 | var is_const: bool = undefined; |
| 7211 | 7276 | 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); | |
| 7213 | 7278 | lhs.qt = .invalid; |
| 7214 | 7279 | } |
| 7215 | 7280 | |
| ... | ... | @@ -7702,12 +7767,13 @@ fn shufflevector(p: *Parser, builtin_tok: TokenIndex) Error!Result { |
| 7702 | 7767 | }; |
| 7703 | 7768 | const negative_one = try Value.intern(p.comp, .{ .int = .{ .i64 = -1 } }); |
| 7704 | 7769 | |
| 7770 | const gpa = p.comp.gpa; | |
| 7705 | 7771 | const list_buf_top = p.list_buf.items.len; |
| 7706 | 7772 | defer p.list_buf.items.len = list_buf_top; |
| 7707 | 7773 | while (p.eatToken(.comma)) |_| { |
| 7708 | 7774 | const index_tok = p.tok_i; |
| 7709 | 7775 | 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); | |
| 7711 | 7777 | if (index.val.compare(.lt, negative_one, p.comp)) { |
| 7712 | 7778 | try p.err(index_tok, .shufflevector_negative_index, .{}); |
| 7713 | 7779 | } 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 { |
| 7727 | 7793 | } else if (p.list_buf.items.len == list_buf_top) { |
| 7728 | 7794 | res_qt = lhs.qt; |
| 7729 | 7795 | } else { |
| 7730 | res_qt = try p.comp.type_store.put(p.gpa, .{ .vector = .{ | |
| 7796 | res_qt = try p.comp.type_store.put(gpa, .{ .vector = .{ | |
| 7731 | 7797 | .elem = lhs.qt.childType(p.comp), |
| 7732 | 7798 | .len = @intCast(p.list_buf.items.len - list_buf_top), |
| 7733 | 7799 | } }); |
| ... | ... | @@ -8086,6 +8152,7 @@ fn computeOffset(p: *Parser, res: Result) !Value { |
| 8086 | 8152 | /// | keyword_alignof '(' typeName ')' |
| 8087 | 8153 | /// | keyword_c23_alignof '(' typeName ')' |
| 8088 | 8154 | fn unExpr(p: *Parser) Error!?Result { |
| 8155 | const gpa = p.comp.gpa; | |
| 8089 | 8156 | const tok = p.tok_i; |
| 8090 | 8157 | switch (p.tok_ids[tok]) { |
| 8091 | 8158 | .ampersand_ampersand => { |
| ... | ... | @@ -8097,7 +8164,7 @@ fn unExpr(p: *Parser) Error!?Result { |
| 8097 | 8164 | |
| 8098 | 8165 | const str = p.tokSlice(name_tok); |
| 8099 | 8166 | if (p.findLabel(str) == null) { |
| 8100 | try p.labels.append(.{ .unresolved_goto = name_tok }); | |
| 8167 | try p.labels.append(gpa, .{ .unresolved_goto = name_tok }); | |
| 8101 | 8168 | } |
| 8102 | 8169 | |
| 8103 | 8170 | return .{ |
| ... | ... | @@ -8139,7 +8206,7 @@ fn unExpr(p: *Parser) Error!?Result { |
| 8139 | 8206 | } |
| 8140 | 8207 | addr_val = try p.computeOffset(operand); |
| 8141 | 8208 | |
| 8142 | operand.qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{ | |
| 8209 | operand.qt = try p.comp.type_store.put(gpa, .{ .pointer = .{ | |
| 8143 | 8210 | .child = operand.qt, |
| 8144 | 8211 | .decayed = null, |
| 8145 | 8212 | } }); |
| ... | ... | @@ -8845,6 +8912,7 @@ fn checkComplexArg(p: *Parser, builtin_tok: TokenIndex, first_after: TokenIndex, |
| 8845 | 8912 | } |
| 8846 | 8913 | |
| 8847 | 8914 | fn callExpr(p: *Parser, lhs: Result) Error!Result { |
| 8915 | const gpa = p.comp.gpa; | |
| 8848 | 8916 | const l_paren = p.tok_i; |
| 8849 | 8917 | p.tok_i += 1; |
| 8850 | 8918 | |
| ... | ... | @@ -8892,7 +8960,7 @@ fn callExpr(p: *Parser, lhs: Result) Error!Result { |
| 8892 | 8960 | |
| 8893 | 8961 | try call_expr.checkVarArg(p, first_after, param_tok, &arg, arg_count); |
| 8894 | 8962 | try arg.saveValue(p); |
| 8895 | try p.list_buf.append(arg.node); | |
| 8963 | try p.list_buf.append(gpa, arg.node); | |
| 8896 | 8964 | arg_count += 1; |
| 8897 | 8965 | |
| 8898 | 8966 | _ = p.eatToken(.comma) orelse { |
| ... | ... | @@ -8927,7 +8995,7 @@ fn callExpr(p: *Parser, lhs: Result) Error!Result { |
| 8927 | 8995 | } |
| 8928 | 8996 | } |
| 8929 | 8997 | try arg.saveValue(p); |
| 8930 | try p.list_buf.append(arg.node); | |
| 8998 | try p.list_buf.append(gpa, arg.node); | |
| 8931 | 8999 | arg_count += 1; |
| 8932 | 9000 | |
| 8933 | 9001 | _ = p.eatToken(.comma) orelse { |
| ... | ... | @@ -9024,6 +9092,7 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9024 | 9092 | return grouped_expr; |
| 9025 | 9093 | } |
| 9026 | 9094 | |
| 9095 | const gpa = p.comp.gpa; | |
| 9027 | 9096 | switch (p.tok_ids[p.tok_i]) { |
| 9028 | 9097 | .identifier, .extended_identifier => { |
| 9029 | 9098 | const name_tok = try p.expectIdentifier(); |
| ... | ... | @@ -9134,7 +9203,7 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9134 | 9203 | else |
| 9135 | 9204 | try p.err(name_tok, .implicit_func_decl, .{name}); |
| 9136 | 9205 | |
| 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 = .{ | |
| 9138 | 9207 | .return_type = .int, |
| 9139 | 9208 | .kind = .old_style, |
| 9140 | 9209 | .params = &.{}, |
| ... | ... | @@ -9150,7 +9219,7 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9150 | 9219 | }, |
| 9151 | 9220 | }); |
| 9152 | 9221 | |
| 9153 | try p.decl_buf.append(node); | |
| 9222 | try p.decl_buf.append(gpa, node); | |
| 9154 | 9223 | try p.syms.declareSymbol(p, interned_name, func_qt, name_tok, node); |
| 9155 | 9224 | |
| 9156 | 9225 | return .{ |
| ... | ... | @@ -9211,8 +9280,11 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9211 | 9280 | const strings_top = p.strings.items.len; |
| 9212 | 9281 | defer p.strings.items.len = strings_top; |
| 9213 | 9282 | |
| 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); | |
| 9216 | 9288 | const predef = try p.makePredefinedIdentifier(p.strings.items[strings_top..]); |
| 9217 | 9289 | ty = predef.qt; |
| 9218 | 9290 | p.func.ident = predef; |
| ... | ... | @@ -9220,7 +9292,7 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9220 | 9292 | const predef = try p.makePredefinedIdentifier("\x00"); |
| 9221 | 9293 | ty = predef.qt; |
| 9222 | 9294 | p.func.ident = predef; |
| 9223 | try p.decl_buf.append(predef.node); | |
| 9295 | try p.decl_buf.append(gpa, predef.node); | |
| 9224 | 9296 | } |
| 9225 | 9297 | if (p.func.qt == null) try p.err(p.tok_i, .predefined_top_level, .{}); |
| 9226 | 9298 | |
| ... | ... | @@ -9241,7 +9313,7 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9241 | 9313 | if (p.func.pretty_ident) |some| { |
| 9242 | 9314 | qt = some.qt; |
| 9243 | 9315 | } else if (p.func.qt) |func_qt| { |
| 9244 | var sf = std.heap.stackFallback(1024, p.gpa); | |
| 9316 | var sf = std.heap.stackFallback(1024, gpa); | |
| 9245 | 9317 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 9246 | 9318 | defer allocating.deinit(); |
| 9247 | 9319 | |
| ... | ... | @@ -9255,7 +9327,7 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9255 | 9327 | const predef = try p.makePredefinedIdentifier("top level\x00"); |
| 9256 | 9328 | qt = predef.qt; |
| 9257 | 9329 | p.func.pretty_ident = predef; |
| 9258 | try p.decl_buf.append(predef.node); | |
| 9330 | try p.decl_buf.append(gpa, predef.node); | |
| 9259 | 9331 | } |
| 9260 | 9332 | if (p.func.qt == null) try p.err(p.tok_i, .predefined_top_level, .{}); |
| 9261 | 9333 | return .{ |
| ... | ... | @@ -9332,7 +9404,8 @@ fn primaryExpr(p: *Parser) Error!?Result { |
| 9332 | 9404 | } |
| 9333 | 9405 | |
| 9334 | 9406 | fn 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 = .{ | |
| 9336 | 9409 | .elem = .{ .@"const" = true, ._index = .int_char }, |
| 9337 | 9410 | .len = .{ .fixed = slice.len }, |
| 9338 | 9411 | } }); |
| ... | ... | @@ -9340,7 +9413,7 @@ fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result { |
| 9340 | 9413 | const val = try Value.intern(p.comp, .{ .bytes = slice }); |
| 9341 | 9414 | |
| 9342 | 9415 | 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); | |
| 9344 | 9417 | |
| 9345 | 9418 | return .{ .qt = array_qt, .node = try p.addNode(.{ |
| 9346 | 9419 | .variable = .{ |
| ... | ... | @@ -9356,6 +9429,7 @@ fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result { |
| 9356 | 9429 | } |
| 9357 | 9430 | |
| 9358 | 9431 | fn stringLiteral(p: *Parser) Error!Result { |
| 9432 | const gpa = p.comp.gpa; | |
| 9359 | 9433 | const string_start = p.tok_i; |
| 9360 | 9434 | var string_end = p.tok_i; |
| 9361 | 9435 | var string_kind: text_literal.Kind = .char; |
| ... | ... | @@ -9380,7 +9454,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 9380 | 9454 | defer p.strings.items.len = strings_top; |
| 9381 | 9455 | |
| 9382 | 9456 | 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); | |
| 9384 | 9458 | |
| 9385 | 9459 | while (p.tok_i < string_end) : (p.tok_i += 1) { |
| 9386 | 9460 | 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 { |
| 9395 | 9469 | .incorrect_encoding_is_error = count > 1, |
| 9396 | 9470 | }; |
| 9397 | 9471 | |
| 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 | |
| 9399 | 9473 | while (try char_literal_parser.next()) |item| switch (item) { |
| 9400 | 9474 | .value => |v| { |
| 9401 | 9475 | switch (char_width) { |
| ... | ... | @@ -9443,7 +9517,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 9443 | 9517 | const dest_len = std.mem.alignBackward(usize, capacity_slice.len, 2); |
| 9444 | 9518 | const dest = std.mem.bytesAsSlice(u16, capacity_slice[0..dest_len]); |
| 9445 | 9519 | 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; | |
| 9447 | 9521 | }, |
| 9448 | 9522 | .@"4" => { |
| 9449 | 9523 | var it = view.iterator(); |
| ... | ... | @@ -9465,11 +9539,11 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 9465 | 9539 | p.comp.interner.strings.items.len, |
| 9466 | 9540 | string_kind.internalStorageAlignment(p.comp), |
| 9467 | 9541 | ); |
| 9468 | try p.comp.interner.strings.resize(p.gpa, interned_align); | |
| 9542 | try p.comp.interner.strings.resize(gpa, interned_align); | |
| 9469 | 9543 | |
| 9470 | 9544 | const val = try Value.intern(p.comp, .{ .bytes = slice }); |
| 9471 | 9545 | |
| 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 = .{ | |
| 9473 | 9547 | .elem = string_kind.elementType(p.comp), |
| 9474 | 9548 | .len = .{ .fixed = @divExact(slice.len, @intFromEnum(char_width)) }, |
| 9475 | 9549 | } }); |
| ... | ... | @@ -9510,6 +9584,7 @@ fn charLiteral(p: *Parser) Error!?Result { |
| 9510 | 9584 | if (char_kind == .utf_8) try p.err(p.tok_i, .u8_char_lit, .{}); |
| 9511 | 9585 | var val: u32 = 0; |
| 9512 | 9586 | |
| 9587 | const gpa = p.comp.gpa; | |
| 9513 | 9588 | const slice = char_kind.contentSlice(p.tokSlice(p.tok_i)); |
| 9514 | 9589 | |
| 9515 | 9590 | var is_multichar = false; |
| ... | ... | @@ -9528,21 +9603,24 @@ fn charLiteral(p: *Parser) Error!?Result { |
| 9528 | 9603 | }; |
| 9529 | 9604 | |
| 9530 | 9605 | 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 | |
| 9534 | 9612 | |
| 9535 | 9613 | 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), | |
| 9538 | 9616 | .improperly_encoded => |s| { |
| 9539 | try chars.ensureUnusedCapacity(s.len); | |
| 9617 | try chars.ensureUnusedCapacity(allocator, s.len); | |
| 9540 | 9618 | for (s) |c| chars.appendAssumeCapacity(c); |
| 9541 | 9619 | }, |
| 9542 | 9620 | .utf8_text => |view| { |
| 9543 | 9621 | var it = view.iterator(); |
| 9544 | 9622 | var max_codepoint_seen: u21 = 0; |
| 9545 | try chars.ensureUnusedCapacity(view.bytes.len); | |
| 9623 | try chars.ensureUnusedCapacity(allocator, view.bytes.len); | |
| 9546 | 9624 | while (it.nextCodepoint()) |c| { |
| 9547 | 9625 | max_codepoint_seen = @max(max_codepoint_seen, c); |
| 9548 | 9626 | chars.appendAssumeCapacity(c); |
| ... | ... | @@ -9603,7 +9681,7 @@ fn charLiteral(p: *Parser) Error!?Result { |
| 9603 | 9681 | _ = try value.intCast(.char, p.comp); |
| 9604 | 9682 | } |
| 9605 | 9683 | |
| 9606 | const res = Result{ | |
| 9684 | const res: Result = .{ | |
| 9607 | 9685 | .qt = if (p.in_macro) macro_qt else char_literal_qt, |
| 9608 | 9686 | .val = value, |
| 9609 | 9687 | .node = try p.addNode(.{ .char_literal = .{ |
| ... | ... | @@ -9618,7 +9696,7 @@ fn charLiteral(p: *Parser) Error!?Result { |
| 9618 | 9696 | }, |
| 9619 | 9697 | } }), |
| 9620 | 9698 | }; |
| 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); | |
| 9622 | 9700 | return res; |
| 9623 | 9701 | } |
| 9624 | 9702 | |
| ... | ... | @@ -9633,7 +9711,7 @@ fn parseFloat(p: *Parser, buf: []const u8, suffix: NumberSuffix, tok_i: TokenInd |
| 9633 | 9711 | else => unreachable, |
| 9634 | 9712 | }; |
| 9635 | 9713 | 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); | |
| 9637 | 9715 | |
| 9638 | 9716 | const strings_top = p.strings.items.len; |
| 9639 | 9717 | defer p.strings.items.len = strings_top; |
| ... | ... | @@ -9821,14 +9899,15 @@ fn parseInt(p: *Parser, prefix: NumberPrefix, buf: []const u8, suffix: NumberSuf |
| 9821 | 9899 | } |
| 9822 | 9900 | |
| 9823 | 9901 | fn bitInt(p: *Parser, base: u8, buf: []const u8, suffix: NumberSuffix, tok_i: TokenIndex) Error!Result { |
| 9902 | const gpa = p.comp.gpa; | |
| 9824 | 9903 | try p.err(tok_i, .pre_c23_compat, .{"'_BitInt' suffix for literals"}); |
| 9825 | 9904 | try p.err(tok_i, .bitint_suffix, .{}); |
| 9826 | 9905 | |
| 9827 | var managed = try big.int.Managed.init(p.gpa); | |
| 9906 | var managed = try big.int.Managed.init(gpa); | |
| 9828 | 9907 | defer managed.deinit(); |
| 9829 | 9908 | |
| 9830 | 9909 | { |
| 9831 | try p.strings.ensureUnusedCapacity(buf.len); | |
| 9910 | try p.strings.ensureUnusedCapacity(gpa, buf.len); | |
| 9832 | 9911 | |
| 9833 | 9912 | const strings_top = p.strings.items.len; |
| 9834 | 9913 | 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 |
| 9853 | 9932 | break :blk @intCast(bits_needed); |
| 9854 | 9933 | }; |
| 9855 | 9934 | |
| 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 = .{ | |
| 9857 | 9936 | .bits = bits_needed, |
| 9858 | 9937 | .signedness = suffix.signedness(), |
| 9859 | 9938 | } }); |
| ... | ... | @@ -9986,6 +10065,7 @@ fn parseNoEval(p: *Parser, comptime func: fn (*Parser) Error!?Result) Error!Resu |
| 9986 | 10065 | /// : typeName ':' assignExpr |
| 9987 | 10066 | /// | keyword_default ':' assignExpr |
| 9988 | 10067 | fn genericSelection(p: *Parser) Error!?Result { |
| 10068 | const gpa = p.comp.gpa; | |
| 9989 | 10069 | const kw_generic = p.tok_i; |
| 9990 | 10070 | p.tok_i += 1; |
| 9991 | 10071 | const l_paren = try p.expectToken(.l_paren); |
| ... | ... | @@ -10030,8 +10110,8 @@ fn genericSelection(p: *Parser) Error!?Result { |
| 10030 | 10110 | .expr = res.node, |
| 10031 | 10111 | }, |
| 10032 | 10112 | }); |
| 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 }); | |
| 10035 | 10115 | |
| 10036 | 10116 | if (qt.eql(controlling_qt, p.comp)) { |
| 10037 | 10117 | if (chosen_tok == null) { |
| ... | ... | @@ -10083,7 +10163,7 @@ fn genericSelection(p: *Parser) Error!?Result { |
| 10083 | 10163 | return error.ParsingFailed; |
| 10084 | 10164 | } |
| 10085 | 10165 | } else if (default_tok != null) { |
| 10086 | try p.list_buf.append(default.node); | |
| 10166 | try p.list_buf.append(gpa, default.node); | |
| 10087 | 10167 | } |
| 10088 | 10168 | |
| 10089 | 10169 | 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 = .{ |
| 2304 | 2304 | pub const attribute_todo: Diagnostic = .{ |
| 2305 | 2305 | .fmt = "TODO: implement '{s}' attribute for {s}", |
| 2306 | 2306 | .kind = .warning, |
| 2307 | .opt = .@"attribute-todo", | |
| 2307 | 2308 | }; |
| 2308 | 2309 | |
| 2309 | 2310 | pub const invalid_type_underlying_enum: Diagnostic = .{ |
| ... | ... | @@ -2395,3 +2396,29 @@ pub const invalid_nullability: Diagnostic = .{ |
| 2395 | 2396 | .fmt = "nullability specifier cannot be applied to non-pointer type {qt}", |
| 2396 | 2397 | .kind = .@"error", |
| 2397 | 2398 | }; |
| 2399 | ||
| 2400 | pub const array_not_assignable: Diagnostic = .{ | |
| 2401 | .fmt = "array type {qt} is not assignable", | |
| 2402 | .kind = .@"error", | |
| 2403 | }; | |
| 2404 | ||
| 2405 | pub const non_object_not_assignable: Diagnostic = .{ | |
| 2406 | .fmt = "non-object type {qt} is not assignable", | |
| 2407 | .kind = .@"error", | |
| 2408 | }; | |
| 2409 | ||
| 2410 | pub const const_var_assignment: Diagnostic = .{ | |
| 2411 | .fmt = "cannot assign to variable '{s}' with const-qualified type {qt}", | |
| 2412 | .kind = .@"error", | |
| 2413 | }; | |
| 2414 | ||
| 2415 | pub const declared_const_here: Diagnostic = .{ | |
| 2416 | .fmt = "variable '{s}' declared const here", | |
| 2417 | .kind = .note, | |
| 2418 | }; | |
| 2419 | ||
| 2420 | pub 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 { |
| 60 | 60 | .string_literal => { |
| 61 | 61 | if (rparen_count != 0) return error.ExpectedStringLiteral; |
| 62 | 62 | 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]); | |
| 64 | 64 | }, |
| 65 | 65 | else => return error.ExpectedStringLiteral, |
| 66 | 66 | } |
| ... | ... | @@ -194,7 +194,7 @@ pub const Diagnostic = struct { |
| 194 | 194 | }; |
| 195 | 195 | |
| 196 | 196 | pub 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); | |
| 198 | 198 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 199 | 199 | defer allocating.deinit(); |
| 200 | 200 |
lib/compiler/aro/aro/Preprocessor.zig+275-245| ... | ... | @@ -21,7 +21,7 @@ const Token = Tree.Token; |
| 21 | 21 | const TokenWithExpansionLocs = Tree.TokenWithExpansionLocs; |
| 22 | 22 | |
| 23 | 23 | const DefineMap = std.StringArrayHashMapUnmanaged(Macro); |
| 24 | const RawTokenList = std.array_list.Managed(RawToken); | |
| 24 | const RawTokenList = std.ArrayList(RawToken); | |
| 25 | 25 | const max_include_depth = 200; |
| 26 | 26 | |
| 27 | 27 | /// Errors that can be returned when expanding a macro. |
| ... | ... | @@ -115,16 +115,15 @@ const TokenState = struct { |
| 115 | 115 | |
| 116 | 116 | comp: *Compilation, |
| 117 | 117 | diagnostics: *Diagnostics, |
| 118 | gpa: mem.Allocator, | |
| 119 | 118 | |
| 120 | 119 | arena: std.heap.ArenaAllocator, |
| 121 | defines: DefineMap = .{}, | |
| 120 | defines: DefineMap = .empty, | |
| 122 | 121 | /// Do not directly mutate this; use addToken / addTokenAssumeCapacity / ensureTotalTokenCapacity / ensureUnusedTokenCapacity |
| 123 | tokens: Token.List = .{}, | |
| 122 | tokens: Token.List = .empty, | |
| 124 | 123 | /// Do not directly mutate this; must be kept in sync with `tokens` |
| 125 | expansion_entries: std.MultiArrayList(ExpansionEntry) = .{}, | |
| 126 | token_buf: RawTokenList, | |
| 127 | char_buf: std.array_list.Managed(u8), | |
| 124 | expansion_entries: std.MultiArrayList(ExpansionEntry) = .empty, | |
| 125 | token_buf: RawTokenList = .empty, | |
| 126 | char_buf: std.ArrayList(u8) = .empty, | |
| 128 | 127 | /// Counter that is incremented each time preprocess() is called |
| 129 | 128 | /// Can be used to distinguish multiple preprocessings of the same file |
| 130 | 129 | preprocess_count: u32 = 0, |
| ... | ... | @@ -133,9 +132,9 @@ add_expansion_nl: u32 = 0, |
| 133 | 132 | include_depth: u8 = 0, |
| 134 | 133 | counter: u32 = 0, |
| 135 | 134 | expansion_source_loc: Source.Location = undefined, |
| 136 | poisoned_identifiers: std.StringHashMap(void), | |
| 135 | poisoned_identifiers: std.StringHashMapUnmanaged(void) = .empty, | |
| 137 | 136 | /// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any |
| 138 | include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{}, | |
| 137 | include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty, | |
| 139 | 138 | |
| 140 | 139 | /// Store `keyword_define` and `keyword_undef` tokens. |
| 141 | 140 | /// Used to implement preprocessor debug dump options |
| ... | ... | @@ -143,7 +142,7 @@ include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{}, |
| 143 | 142 | store_macro_tokens: bool = false, |
| 144 | 143 | |
| 145 | 144 | /// Memory is retained to avoid allocation on every single token. |
| 146 | top_expansion_buf: ExpandBuf, | |
| 145 | top_expansion_buf: ExpandBuf = .empty, | |
| 147 | 146 | |
| 148 | 147 | /// Dump current state to stderr. |
| 149 | 148 | verbose: bool = false, |
| ... | ... | @@ -156,7 +155,7 @@ hideset: Hideset, |
| 156 | 155 | |
| 157 | 156 | /// Epoch used for __DATE__, __TIME__, and possibly __TIMESTAMP__ |
| 158 | 157 | source_epoch: SourceEpoch, |
| 159 | m_times: std.AutoHashMapUnmanaged(Source.Id, u64) = .{}, | |
| 158 | m_times: std.AutoHashMapUnmanaged(Source.Id, u64) = .empty, | |
| 160 | 159 | |
| 161 | 160 | /// The dependency file tracking all includes and embeds. |
| 162 | 161 | dep_file: ?*DepFile = null, |
| ... | ... | @@ -176,12 +175,7 @@ pub fn init(comp: *Compilation, source_epoch: SourceEpoch) Preprocessor { |
| 176 | 175 | const pp: Preprocessor = .{ |
| 177 | 176 | .comp = comp, |
| 178 | 177 | .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), | |
| 185 | 179 | .hideset = .{ .comp = comp }, |
| 186 | 180 | .source_epoch = source_epoch, |
| 187 | 181 | }; |
| ... | ... | @@ -207,7 +201,7 @@ pub fn initDefault(comp: *Compilation) !Preprocessor { |
| 207 | 201 | |
| 208 | 202 | // `param_tok_id` is comptime so that the generated `tokens` list is unique for every macro. |
| 209 | 203 | fn 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, .{ | |
| 211 | 205 | .params = &[1][]const u8{"X"}, |
| 212 | 206 | .tokens = &[1]RawToken{.{ |
| 213 | 207 | .id = param_tok_id, |
| ... | ... | @@ -248,30 +242,33 @@ pub fn addBuiltinMacros(pp: *Preprocessor) !void { |
| 248 | 242 | } |
| 249 | 243 | |
| 250 | 244 | pub 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); | |
| 253 | 248 | 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); | |
| 259 | 254 | 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; | |
| 263 | 259 | } |
| 264 | 260 | |
| 265 | 261 | /// Free buffers that are not needed after preprocessing |
| 266 | 262 | fn 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); | |
| 270 | 267 | pp.hideset.clearAndFree(); |
| 271 | 268 | } |
| 272 | 269 | |
| 273 | 270 | fn 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); | |
| 275 | 272 | if (!gop.found_existing) { |
| 276 | 273 | gop.value_ptr.* = pp.comp.getSourceMTimeUncached(source_id) orelse 0; |
| 277 | 274 | } |
| ... | ... | @@ -385,6 +382,7 @@ fn findIncludeGuard(pp: *Preprocessor, source: Source) ?[]const u8 { |
| 385 | 382 | } |
| 386 | 383 | |
| 387 | 384 | fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!TokenWithExpansionLocs { |
| 385 | const gpa = pp.comp.gpa; | |
| 388 | 386 | var guard_name = pp.findIncludeGuard(source); |
| 389 | 387 | |
| 390 | 388 | pp.preprocess_count += 1; |
| ... | ... | @@ -418,7 +416,7 @@ fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!TokenWithExpans |
| 418 | 416 | tok = tokenizer.next(); |
| 419 | 417 | if (tok.id == .nl or tok.id == .eof) break; |
| 420 | 418 | 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)); | |
| 422 | 420 | } |
| 423 | 421 | try pp.stringify(pp.top_expansion_buf.items); |
| 424 | 422 | 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 |
| 713 | 711 | try pp.err(tok, .newline_eof, .{}); |
| 714 | 712 | } |
| 715 | 713 | 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| { | |
| 717 | 715 | assert(mem.eql(u8, name, prev.value)); |
| 718 | 716 | } |
| 719 | 717 | } |
| ... | ... | @@ -761,8 +759,11 @@ pub const Diagnostic = @import("Preprocessor/Diagnostic.zig"); |
| 761 | 759 | |
| 762 | 760 | fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) Compilation.Error!void { |
| 763 | 761 | 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; | |
| 764 | 765 | |
| 765 | var sf = std.heap.stackFallback(1024, pp.gpa); | |
| 766 | var sf = std.heap.stackFallback(1024, pp.comp.gpa); | |
| 766 | 767 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 767 | 768 | defer allocating.deinit(); |
| 768 | 769 | |
| ... | ... | @@ -791,7 +792,7 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C |
| 791 | 792 | } |
| 792 | 793 | |
| 793 | 794 | fn 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); | |
| 795 | 796 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 796 | 797 | defer allocating.deinit(); |
| 797 | 798 | |
| ... | ... | @@ -813,11 +814,12 @@ fn fatalNotFound(pp: *Preprocessor, tok: TokenWithExpansionLocs, filename: []con |
| 813 | 814 | pp.diagnostics.state.fatal_errors = true; |
| 814 | 815 | defer pp.diagnostics.state.fatal_errors = old; |
| 815 | 816 | |
| 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); | |
| 819 | 821 | |
| 820 | try buf.print("'{s}' not found", .{filename}); | |
| 822 | try buf.print(allocator, "'{s}' not found", .{filename}); | |
| 821 | 823 | try pp.diagnostics.addWithLocation(pp.comp, .{ |
| 822 | 824 | .kind = .@"fatal error", |
| 823 | 825 | .text = buf.items, |
| ... | ... | @@ -831,14 +833,16 @@ fn verboseLog(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: |
| 831 | 833 | const source = pp.comp.getSource(raw.source); |
| 832 | 834 | const line_col = source.lineCol(.{ .id = raw.source, .line = raw.line, .byte_offset = raw.start }); |
| 833 | 835 | |
| 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; | |
| 842 | 846 | } |
| 843 | 847 | |
| 844 | 848 | /// Consume next token, error if it is not an identifier. |
| ... | ... | @@ -880,9 +884,10 @@ fn restoreTokenState(pp: *Preprocessor, state: TokenState) void { |
| 880 | 884 | |
| 881 | 885 | /// Consume all tokens until a newline and parse the result into a boolean. |
| 882 | 886 | fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool { |
| 887 | const gpa = pp.comp.gpa; | |
| 883 | 888 | const token_state = pp.getTokenState(); |
| 884 | 889 | 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); | |
| 886 | 891 | pp.restoreTokenState(token_state); |
| 887 | 892 | } |
| 888 | 893 | |
| ... | ... | @@ -894,7 +899,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool { |
| 894 | 899 | .whitespace => if (pp.top_expansion_buf.items.len == 0) continue, |
| 895 | 900 | else => {}, |
| 896 | 901 | } |
| 897 | try pp.top_expansion_buf.append(tokFromRaw(tok)); | |
| 902 | try pp.top_expansion_buf.append(gpa, tokFromRaw(tok)); | |
| 898 | 903 | } else unreachable; |
| 899 | 904 | if (pp.top_expansion_buf.items.len != 0) { |
| 900 | 905 | pp.expansion_source_loc = pp.top_expansion_buf.items[0].loc; |
| ... | ... | @@ -989,11 +994,9 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool { |
| 989 | 994 | .pp = pp, |
| 990 | 995 | .comp = pp.comp, |
| 991 | 996 | .diagnostics = pp.diagnostics, |
| 992 | .gpa = pp.gpa, | |
| 993 | 997 | .tok_ids = pp.tokens.items(.id), |
| 994 | 998 | .tok_i = @intCast(token_state.tokens_len), |
| 995 | 999 | .in_macro = true, |
| 996 | .strings = std.array_list.Managed(u8).init(pp.comp.gpa), | |
| 997 | 1000 | |
| 998 | 1001 | .tree = undefined, |
| 999 | 1002 | .labels = undefined, |
| ... | ... | @@ -1005,7 +1008,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool { |
| 1005 | 1008 | .attr_buf = undefined, |
| 1006 | 1009 | .string_ids = undefined, |
| 1007 | 1010 | }; |
| 1008 | defer parser.strings.deinit(); | |
| 1011 | defer parser.strings.deinit(gpa); | |
| 1009 | 1012 | return parser.macroExpr(); |
| 1010 | 1013 | } |
| 1011 | 1014 | |
| ... | ... | @@ -1140,34 +1143,35 @@ fn skipToNl(tokenizer: *Tokenizer) void { |
| 1140 | 1143 | } |
| 1141 | 1144 | } |
| 1142 | 1145 | |
| 1143 | const ExpandBuf = std.array_list.Managed(TokenWithExpansionLocs); | |
| 1144 | fn removePlacemarkers(buf: *ExpandBuf) void { | |
| 1146 | const ExpandBuf = std.ArrayList(TokenWithExpansionLocs); | |
| 1147 | fn removePlacemarkers(gpa: Allocator, buf: *ExpandBuf) void { | |
| 1145 | 1148 | var i: usize = buf.items.len -% 1; |
| 1146 | 1149 | while (i < buf.items.len) : (i -%= 1) { |
| 1147 | 1150 | if (buf.items[i].id == .placemarker) { |
| 1148 | 1151 | const placemarker = buf.orderedRemove(i); |
| 1149 | TokenWithExpansionLocs.free(placemarker.expansion_locs, buf.allocator); | |
| 1152 | TokenWithExpansionLocs.free(placemarker.expansion_locs, gpa); | |
| 1150 | 1153 | } |
| 1151 | 1154 | } |
| 1152 | 1155 | } |
| 1153 | 1156 | |
| 1154 | const MacroArguments = std.array_list.Managed([]const TokenWithExpansionLocs); | |
| 1155 | fn deinitMacroArguments(allocator: Allocator, args: *const MacroArguments) void { | |
| 1157 | const MacroArguments = std.ArrayList([]const TokenWithExpansionLocs); | |
| 1158 | fn deinitMacroArguments(gpa: Allocator, args: *MacroArguments) void { | |
| 1156 | 1159 | 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); | |
| 1159 | 1162 | } |
| 1160 | args.deinit(); | |
| 1163 | args.deinit(gpa); | |
| 1161 | 1164 | } |
| 1162 | 1165 | |
| 1163 | 1166 | fn 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); | |
| 1166 | 1170 | 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 } }); | |
| 1168 | 1172 | return buf; |
| 1169 | 1173 | } |
| 1170 | try buf.ensureTotalCapacity(simple_macro.tokens.len); | |
| 1174 | try buf.ensureTotalCapacity(gpa, simple_macro.tokens.len); | |
| 1171 | 1175 | |
| 1172 | 1176 | // Add all of the simple_macros tokens to the new buffer handling any concats. |
| 1173 | 1177 | var i: usize = 0; |
| ... | ... | @@ -1193,25 +1197,26 @@ fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf |
| 1193 | 1197 | .macro_file => { |
| 1194 | 1198 | const start = pp.comp.generated_buf.items.len; |
| 1195 | 1199 | 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)}); | |
| 1197 | 1201 | |
| 1198 | 1202 | buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .string_literal, tok)); |
| 1199 | 1203 | }, |
| 1200 | 1204 | .macro_line => { |
| 1201 | 1205 | const start = pp.comp.generated_buf.items.len; |
| 1202 | 1206 | 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)}); | |
| 1204 | 1208 | |
| 1205 | 1209 | buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok)); |
| 1206 | 1210 | }, |
| 1207 | 1211 | .macro_counter => { |
| 1208 | 1212 | defer pp.counter += 1; |
| 1209 | 1213 | 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}); | |
| 1211 | 1215 | |
| 1212 | 1216 | buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok)); |
| 1213 | 1217 | }, |
| 1214 | 1218 | .macro_date, .macro_time => { |
| 1219 | try pp.err(pp.expansion_source_loc, .date_time, .{}); | |
| 1215 | 1220 | const start = pp.comp.generated_buf.items.len; |
| 1216 | 1221 | const timestamp = switch (pp.source_epoch) { |
| 1217 | 1222 | .system, .provided => |ts| ts, |
| ... | ... | @@ -1220,6 +1225,7 @@ fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf |
| 1220 | 1225 | buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .string_literal, tok)); |
| 1221 | 1226 | }, |
| 1222 | 1227 | .macro_timestamp => { |
| 1228 | try pp.err(pp.expansion_source_loc, .date_time, .{}); | |
| 1223 | 1229 | const start = pp.comp.generated_buf.items.len; |
| 1224 | 1230 | const timestamp = switch (pp.source_epoch) { |
| 1225 | 1231 | .provided => |ts| ts, |
| ... | ... | @@ -1251,8 +1257,9 @@ const DateTimeStampKind = enum { |
| 1251 | 1257 | } |
| 1252 | 1258 | }; |
| 1253 | 1259 | |
| 1254 | fn writeDateTimeStamp(pp: *Preprocessor, kind: DateTimeStampKind, timestamp: u64) !void { | |
| 1260 | fn writeDateTimeStamp(pp: *const Preprocessor, kind: DateTimeStampKind, timestamp: u64) !void { | |
| 1255 | 1261 | std.debug.assert(std.time.epoch.Month.jan.numeric() == 1); |
| 1262 | const gpa = pp.comp.gpa; | |
| 1256 | 1263 | |
| 1257 | 1264 | const epoch_seconds = std.time.epoch.EpochSeconds{ .secs = timestamp }; |
| 1258 | 1265 | const epoch_day = epoch_seconds.getEpochDay(); |
| ... | ... | @@ -1267,21 +1274,21 @@ fn writeDateTimeStamp(pp: *Preprocessor, kind: DateTimeStampKind, timestamp: u64 |
| 1267 | 1274 | |
| 1268 | 1275 | switch (kind) { |
| 1269 | 1276 | .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}\"", .{ | |
| 1271 | 1278 | month_name, |
| 1272 | 1279 | month_day.day_index + 1, |
| 1273 | 1280 | year_day.year, |
| 1274 | 1281 | }); |
| 1275 | 1282 | }, |
| 1276 | 1283 | .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}\"", .{ | |
| 1278 | 1285 | day_seconds.getHoursIntoDay(), |
| 1279 | 1286 | day_seconds.getMinutesIntoHour(), |
| 1280 | 1287 | day_seconds.getSecondsIntoMinute(), |
| 1281 | 1288 | }); |
| 1282 | 1289 | }, |
| 1283 | 1290 | .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}\"", .{ | |
| 1285 | 1292 | day_name, |
| 1286 | 1293 | month_name, |
| 1287 | 1294 | month_day.day_index + 1, |
| ... | ... | @@ -1312,7 +1319,7 @@ fn pasteStringsUnsafe(pp: *Preprocessor, toks: []const TokenWithExpansionLocs) ! |
| 1312 | 1319 | if (tok.id == .macro_ws) continue; |
| 1313 | 1320 | if (tok.id != .string_literal) return error.ExpectedStringLiteral; |
| 1314 | 1321 | 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]); | |
| 1316 | 1323 | } |
| 1317 | 1324 | return pp.char_buf.items[char_top..]; |
| 1318 | 1325 | } |
| ... | ... | @@ -1322,16 +1329,17 @@ fn pragmaOperator(pp: *Preprocessor, arg_tok: TokenWithExpansionLocs, operator_l |
| 1322 | 1329 | const arg_slice = pp.expandedSlice(arg_tok); |
| 1323 | 1330 | const content = arg_slice[1 .. arg_slice.len - 1]; |
| 1324 | 1331 | const directive = "#pragma "; |
| 1332 | const gpa = pp.comp.gpa; | |
| 1325 | 1333 | |
| 1326 | 1334 | pp.char_buf.clearRetainingCapacity(); |
| 1327 | 1335 | 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); | |
| 1329 | 1337 | pp.char_buf.appendSliceAssumeCapacity(directive); |
| 1330 | 1338 | pp.destringify(content); |
| 1331 | 1339 | pp.char_buf.appendAssumeCapacity('\n'); |
| 1332 | 1340 | |
| 1333 | 1341 | 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); | |
| 1335 | 1343 | var tmp_tokenizer = Tokenizer{ |
| 1336 | 1344 | .buf = pp.comp.generated_buf.items, |
| 1337 | 1345 | .langopts = pp.comp.langopts, |
| ... | ... | @@ -1353,9 +1361,10 @@ fn msPragmaOperator(pp: *Preprocessor, pragma_tok: TokenWithExpansionLocs, args: |
| 1353 | 1361 | try pp.err(pragma_tok, .unknown_pragma, .{}); |
| 1354 | 1362 | return; |
| 1355 | 1363 | } |
| 1364 | const gpa = pp.comp.gpa; | |
| 1356 | 1365 | |
| 1357 | 1366 | { |
| 1358 | var copy = try pragma_tok.dupe(pp.gpa); | |
| 1367 | var copy = try pragma_tok.dupe(gpa); | |
| 1359 | 1368 | copy.id = .keyword_pragma; |
| 1360 | 1369 | try pp.addToken(copy); |
| 1361 | 1370 | } |
| ... | ... | @@ -1364,7 +1373,7 @@ fn msPragmaOperator(pp: *Preprocessor, pragma_tok: TokenWithExpansionLocs, args: |
| 1364 | 1373 | for (args) |tok| { |
| 1365 | 1374 | switch (tok.id) { |
| 1366 | 1375 | .macro_ws, .comment => continue, |
| 1367 | else => try pp.addToken(try tok.dupe(pp.gpa)), | |
| 1376 | else => try pp.addToken(try tok.dupe(gpa)), | |
| 1368 | 1377 | } |
| 1369 | 1378 | } |
| 1370 | 1379 | try pp.addToken(.{ .id = .nl, .loc = .{ .id = .generated } }); |
| ... | ... | @@ -1406,7 +1415,8 @@ fn destringify(pp: *Preprocessor, str: []const u8) void { |
| 1406 | 1415 | /// Stringify `tokens` into pp.char_buf. |
| 1407 | 1416 | /// See https://gcc.gnu.org/onlinedocs/gcc-11.2.0/cpp/Stringizing.html#Stringizing |
| 1408 | 1417 | fn 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, '"'); | |
| 1410 | 1420 | var ws_state: enum { start, need, not_needed } = .start; |
| 1411 | 1421 | for (tokens) |tok| { |
| 1412 | 1422 | if (tok.id == .macro_ws) { |
| ... | ... | @@ -1414,7 +1424,7 @@ fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void { |
| 1414 | 1424 | ws_state = .need; |
| 1415 | 1425 | continue; |
| 1416 | 1426 | } |
| 1417 | if (ws_state == .need) try pp.char_buf.append(' '); | |
| 1427 | if (ws_state == .need) try pp.char_buf.append(gpa, ' '); | |
| 1418 | 1428 | ws_state = .not_needed; |
| 1419 | 1429 | |
| 1420 | 1430 | // backslashes not inside strings are not escaped |
| ... | ... | @@ -1434,14 +1444,14 @@ fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void { |
| 1434 | 1444 | |
| 1435 | 1445 | for (pp.expandedSlice(tok)) |c| { |
| 1436 | 1446 | if (c == '"') |
| 1437 | try pp.char_buf.appendSlice("\\\"") | |
| 1447 | try pp.char_buf.appendSlice(gpa, "\\\"") | |
| 1438 | 1448 | else if (c == '\\' and is_str) |
| 1439 | try pp.char_buf.appendSlice("\\\\") | |
| 1449 | try pp.char_buf.appendSlice(gpa, "\\\\") | |
| 1440 | 1450 | else |
| 1441 | try pp.char_buf.append(c); | |
| 1451 | try pp.char_buf.append(gpa, c); | |
| 1442 | 1452 | } |
| 1443 | 1453 | } |
| 1444 | try pp.char_buf.ensureUnusedCapacity(2); | |
| 1454 | try pp.char_buf.ensureUnusedCapacity(gpa, 2); | |
| 1445 | 1455 | if (pp.char_buf.items[pp.char_buf.items.len - 1] != '\\') { |
| 1446 | 1456 | pp.char_buf.appendSliceAssumeCapacity("\"\n"); |
| 1447 | 1457 | return; |
| ... | ... | @@ -1492,7 +1502,7 @@ fn reconstructIncludeString(pp: *Preprocessor, param_toks: []const TokenWithExpa |
| 1492 | 1502 | |
| 1493 | 1503 | for (params, 0..) |tok, i| { |
| 1494 | 1504 | 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); | |
| 1496 | 1506 | if (embed_args) |some| { |
| 1497 | 1507 | if ((i == 0 and tok.id == .string_literal) or tok.id == .angle_bracket_right) { |
| 1498 | 1508 | some.* = params[i + 1 ..]; |
| ... | ... | @@ -1649,25 +1659,26 @@ fn expandFuncMacro( |
| 1649 | 1659 | expanded_args: *const MacroArguments, |
| 1650 | 1660 | hideset_arg: Hideset.Index, |
| 1651 | 1661 | ) MacroError!ExpandBuf { |
| 1662 | const gpa = pp.comp.gpa; | |
| 1652 | 1663 | 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); | |
| 1656 | 1667 | |
| 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); | |
| 1661 | 1672 | |
| 1662 | 1673 | if (func_macro.var_args) { |
| 1663 | 1674 | var i: usize = func_macro.params.len; |
| 1664 | 1675 | 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]); | |
| 1667 | 1678 | 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); | |
| 1671 | 1682 | } |
| 1672 | 1683 | } |
| 1673 | 1684 | } |
| ... | ... | @@ -1681,8 +1692,8 @@ fn expandFuncMacro( |
| 1681 | 1692 | const raw_next = func_macro.tokens[tok_i + 1]; |
| 1682 | 1693 | tok_i += 1; |
| 1683 | 1694 | |
| 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); | |
| 1686 | 1697 | |
| 1687 | 1698 | const next = switch (raw_next.id) { |
| 1688 | 1699 | .macro_ws => continue, |
| ... | ... | @@ -1709,7 +1720,7 @@ fn expandFuncMacro( |
| 1709 | 1720 | } |
| 1710 | 1721 | const slice = getPasteArgs(args.items[raw.end]); |
| 1711 | 1722 | 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}); | |
| 1713 | 1724 | }, |
| 1714 | 1725 | .macro_param => { |
| 1715 | 1726 | if (tok_i + 1 < func_macro.tokens.len and func_macro.tokens[tok_i + 1].id == .hash_hash) { |
| ... | ... | @@ -1717,11 +1728,11 @@ fn expandFuncMacro( |
| 1717 | 1728 | } |
| 1718 | 1729 | const arg = expanded_args.items[raw.end]; |
| 1719 | 1730 | 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}); | |
| 1721 | 1732 | }, |
| 1722 | 1733 | .keyword_va_args => { |
| 1723 | 1734 | 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}); | |
| 1725 | 1736 | }, |
| 1726 | 1737 | .keyword_va_opt => { |
| 1727 | 1738 | try pp.expandVaOpt(&buf, raw, variable_arguments.items.len != 0); |
| ... | ... | @@ -1736,9 +1747,9 @@ fn expandFuncMacro( |
| 1736 | 1747 | try pp.stringify(arg); |
| 1737 | 1748 | |
| 1738 | 1749 | 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); | |
| 1740 | 1751 | |
| 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))); | |
| 1742 | 1753 | }, |
| 1743 | 1754 | .macro_param_has_attribute, |
| 1744 | 1755 | .macro_param_has_declspec_attribute, |
| ... | ... | @@ -1757,8 +1768,8 @@ fn expandFuncMacro( |
| 1757 | 1768 | } else try pp.handleBuiltinMacro(raw.id, arg, macro_tok.loc); |
| 1758 | 1769 | const start = pp.comp.generated_buf.items.len; |
| 1759 | 1770 | |
| 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))); | |
| 1762 | 1773 | }, |
| 1763 | 1774 | .macro_param_has_c_attribute => { |
| 1764 | 1775 | const arg = expanded_args.items[0]; |
| ... | ... | @@ -1808,8 +1819,8 @@ fn expandFuncMacro( |
| 1808 | 1819 | const exists = Attribute.fromString(.gnu, vendor_str, attr_str) != null; |
| 1809 | 1820 | |
| 1810 | 1821 | 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))); | |
| 1813 | 1824 | continue; |
| 1814 | 1825 | } |
| 1815 | 1826 | if (!pp.comp.langopts.standard.atLeast(.c23)) break :res not_found; |
| ... | ... | @@ -1829,8 +1840,8 @@ fn expandFuncMacro( |
| 1829 | 1840 | break :res attrs.get(attr_str) orelse not_found; |
| 1830 | 1841 | }; |
| 1831 | 1842 | 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))); | |
| 1834 | 1845 | }, |
| 1835 | 1846 | .macro_param_has_embed => { |
| 1836 | 1847 | const arg = expanded_args.items[0]; |
| ... | ... | @@ -1936,12 +1947,12 @@ fn expandFuncMacro( |
| 1936 | 1947 | const contents = (try pp.comp.findEmbed(filename, arg[0].loc.id, include_type, .limited(1), pp.dep_file)) orelse |
| 1937 | 1948 | break :res not_found; |
| 1938 | 1949 | |
| 1939 | defer pp.comp.gpa.free(contents); | |
| 1950 | defer gpa.free(contents); | |
| 1940 | 1951 | break :res if (contents.len != 0) "1\n" else "2\n"; |
| 1941 | 1952 | }; |
| 1942 | 1953 | 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))); | |
| 1945 | 1956 | }, |
| 1946 | 1957 | .macro_param_pragma_operator => { |
| 1947 | 1958 | // Clang and GCC require exactly one token (so, no parentheses or string pasting) |
| ... | ... | @@ -1993,7 +2004,7 @@ fn expandFuncMacro( |
| 1993 | 2004 | } |
| 1994 | 2005 | if (ident) |*some| { |
| 1995 | 2006 | some.id = .identifier; |
| 1996 | try buf.append(some.*); | |
| 2007 | try buf.append(gpa, some.*); | |
| 1997 | 2008 | } else { |
| 1998 | 2009 | try pp.err(macro_tok, .expected_identifier, .{}); |
| 1999 | 2010 | } |
| ... | ... | @@ -2023,10 +2034,10 @@ fn expandFuncMacro( |
| 2023 | 2034 | try pp.err(hash_hash, .comma_deletion_va_args, .{}); |
| 2024 | 2035 | } else { |
| 2025 | 2036 | // C standard, retain the comma |
| 2026 | try buf.append(tokFromRaw(raw)); | |
| 2037 | try buf.append(gpa, tokFromRaw(raw)); | |
| 2027 | 2038 | } |
| 2028 | 2039 | } else { |
| 2029 | try buf.append(tokFromRaw(raw)); | |
| 2040 | try buf.append(gpa, tokFromRaw(raw)); | |
| 2030 | 2041 | if (expanded_variable_arguments.items.len > 0 or variable_arguments.items.len == func_macro.params.len) { |
| 2031 | 2042 | try pp.err(hash_hash, .comma_deletion_va_args, .{}); |
| 2032 | 2043 | } |
| ... | ... | @@ -2035,23 +2046,23 @@ fn expandFuncMacro( |
| 2035 | 2046 | .byte_offset = maybe_va_args.start, |
| 2036 | 2047 | .line = maybe_va_args.line, |
| 2037 | 2048 | }; |
| 2038 | try bufCopyTokens(&buf, expanded_variable_arguments.items, &.{raw_loc}); | |
| 2049 | try bufCopyTokens(gpa, &buf, expanded_variable_arguments.items, &.{raw_loc}); | |
| 2039 | 2050 | } |
| 2040 | 2051 | continue; |
| 2041 | 2052 | } |
| 2042 | 2053 | } |
| 2043 | 2054 | // Regular comma, no token pasting with __VA_ARGS__ |
| 2044 | try buf.append(tokFromRaw(raw)); | |
| 2055 | try buf.append(gpa, tokFromRaw(raw)); | |
| 2045 | 2056 | }, |
| 2046 | else => try buf.append(tokFromRaw(raw)), | |
| 2057 | else => try buf.append(gpa, tokFromRaw(raw)), | |
| 2047 | 2058 | } |
| 2048 | 2059 | } |
| 2049 | removePlacemarkers(&buf); | |
| 2060 | removePlacemarkers(gpa, &buf); | |
| 2050 | 2061 | |
| 2051 | 2062 | const macro_expansion_locs = macro_tok.expansionSlice(); |
| 2052 | 2063 | 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); | |
| 2055 | 2066 | const tok_hidelist = pp.hideset.get(tok.loc); |
| 2056 | 2067 | const new_hidelist = try pp.hideset.@"union"(tok_hidelist, hideset); |
| 2057 | 2068 | try pp.hideset.put(tok.loc, new_hidelist); |
| ... | ... | @@ -2078,16 +2089,16 @@ fn expandVaOpt( |
| 2078 | 2089 | }; |
| 2079 | 2090 | while (tokenizer.index < raw.end) { |
| 2080 | 2091 | const tok = tokenizer.next(); |
| 2081 | try buf.append(tokFromRaw(tok)); | |
| 2092 | try buf.append(pp.comp.gpa, tokFromRaw(tok)); | |
| 2082 | 2093 | } |
| 2083 | 2094 | } |
| 2084 | 2095 | |
| 2085 | fn bufCopyTokens(buf: *ExpandBuf, tokens: []const TokenWithExpansionLocs, src: []const Source.Location) !void { | |
| 2086 | try buf.ensureUnusedCapacity(tokens.len); | |
| 2096 | fn bufCopyTokens(gpa: Allocator, buf: *ExpandBuf, tokens: []const TokenWithExpansionLocs, src: []const Source.Location) !void { | |
| 2097 | try buf.ensureUnusedCapacity(gpa, tokens.len); | |
| 2087 | 2098 | 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); | |
| 2091 | 2102 | buf.appendAssumeCapacity(copy); |
| 2092 | 2103 | } |
| 2093 | 2104 | } |
| ... | ... | @@ -2112,10 +2123,10 @@ fn nextBufToken( |
| 2112 | 2123 | |
| 2113 | 2124 | const new_tok = tokFromRaw(raw_tok); |
| 2114 | 2125 | end_idx.* += 1; |
| 2115 | try buf.append(new_tok); | |
| 2126 | try buf.append(pp.comp.gpa, new_tok); | |
| 2116 | 2127 | return new_tok; |
| 2117 | 2128 | } else { |
| 2118 | return TokenWithExpansionLocs{ .id = .eof, .loc = .{ .id = .generated } }; | |
| 2129 | return .{ .id = .eof, .loc = .{ .id = .generated } }; | |
| 2119 | 2130 | } |
| 2120 | 2131 | } else { |
| 2121 | 2132 | return buf.items[start_idx.*]; |
| ... | ... | @@ -2132,6 +2143,7 @@ fn collectMacroFuncArguments( |
| 2132 | 2143 | is_builtin: bool, |
| 2133 | 2144 | r_paren: *TokenWithExpansionLocs, |
| 2134 | 2145 | ) !MacroArguments { |
| 2146 | const gpa = pp.comp.gpa; | |
| 2135 | 2147 | const name_tok = buf.items[start_idx.*]; |
| 2136 | 2148 | const saved_tokenizer = tokenizer.*; |
| 2137 | 2149 | const old_end = end_idx.*; |
| ... | ... | @@ -2155,62 +2167,62 @@ fn collectMacroFuncArguments( |
| 2155 | 2167 | |
| 2156 | 2168 | // collect the arguments. |
| 2157 | 2169 | 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); | |
| 2162 | 2174 | while (true) { |
| 2163 | 2175 | var tok = try nextBufToken(pp, tokenizer, buf, start_idx, end_idx, extend_buf); |
| 2164 | 2176 | tok.flags.is_macro_arg = true; |
| 2165 | 2177 | switch (tok.id) { |
| 2166 | 2178 | .comma => { |
| 2167 | 2179 | 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); | |
| 2171 | 2183 | } 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); | |
| 2175 | 2187 | } |
| 2176 | 2188 | }, |
| 2177 | 2189 | .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); | |
| 2181 | 2193 | parens += 1; |
| 2182 | 2194 | }, |
| 2183 | 2195 | .r_paren => { |
| 2184 | 2196 | 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); | |
| 2188 | 2200 | r_paren.* = tok; |
| 2189 | 2201 | break; |
| 2190 | 2202 | } 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); | |
| 2194 | 2206 | parens -= 1; |
| 2195 | 2207 | } |
| 2196 | 2208 | }, |
| 2197 | 2209 | .eof => { |
| 2198 | 2210 | { |
| 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); | |
| 2202 | 2214 | } |
| 2203 | 2215 | tokenizer.* = saved_tokenizer; |
| 2204 | 2216 | try pp.err(name_tok, .unterminated_macro_arg_list, .{}); |
| 2205 | 2217 | return error.Unterminated; |
| 2206 | 2218 | }, |
| 2207 | 2219 | .nl, .whitespace => { |
| 2208 | try curArgument.append(.{ .id = .macro_ws, .loc = tok.loc }); | |
| 2220 | try cur_argument.append(gpa, .{ .id = .macro_ws, .loc = tok.loc }); | |
| 2209 | 2221 | }, |
| 2210 | 2222 | 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); | |
| 2214 | 2226 | }, |
| 2215 | 2227 | } |
| 2216 | 2228 | } |
| ... | ... | @@ -2219,8 +2231,9 @@ fn collectMacroFuncArguments( |
| 2219 | 2231 | } |
| 2220 | 2232 | |
| 2221 | 2233 | fn 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, &.{}); | |
| 2224 | 2237 | moving_end_idx.* -|= len; |
| 2225 | 2238 | } |
| 2226 | 2239 | |
| ... | ... | @@ -2263,6 +2276,7 @@ fn expandMacroExhaustive( |
| 2263 | 2276 | extend_buf: bool, |
| 2264 | 2277 | eval_ctx: EvalContext, |
| 2265 | 2278 | ) MacroError!void { |
| 2279 | const gpa = pp.comp.gpa; | |
| 2266 | 2280 | var moving_end_idx = end_idx; |
| 2267 | 2281 | var advance_index: usize = 0; |
| 2268 | 2282 | // rescan loop |
| ... | ... | @@ -2309,7 +2323,7 @@ fn expandMacroExhaustive( |
| 2309 | 2323 | var r_paren: TokenWithExpansionLocs = undefined; |
| 2310 | 2324 | var macro_scan_idx = idx; |
| 2311 | 2325 | // to be saved in case this doesn't turn out to be a call |
| 2312 | const args = pp.collectMacroFuncArguments( | |
| 2326 | var args = pp.collectMacroFuncArguments( | |
| 2313 | 2327 | tokenizer, |
| 2314 | 2328 | buf, |
| 2315 | 2329 | &macro_scan_idx, |
| ... | ... | @@ -2334,10 +2348,10 @@ fn expandMacroExhaustive( |
| 2334 | 2348 | var free_arg_expansion_locs = false; |
| 2335 | 2349 | defer { |
| 2336 | 2350 | 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); | |
| 2339 | 2353 | } |
| 2340 | args.deinit(); | |
| 2354 | args.deinit(gpa); | |
| 2341 | 2355 | } |
| 2342 | 2356 | const r_paren_hidelist = pp.hideset.get(r_paren.loc); |
| 2343 | 2357 | var hs = try pp.hideset.intersection(macro_hidelist, r_paren_hidelist); |
| ... | ... | @@ -2370,25 +2384,25 @@ fn expandMacroExhaustive( |
| 2370 | 2384 | try pp.removeExpandedTokens(buf, idx, macro_scan_idx - idx + 1, &moving_end_idx); |
| 2371 | 2385 | continue; |
| 2372 | 2386 | } |
| 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); | |
| 2376 | 2390 | 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); | |
| 2380 | 2394 | |
| 2381 | 2395 | try pp.expandMacroExhaustive(tokenizer, &expand_buf, 0, expand_buf.items.len, false, eval_ctx); |
| 2382 | 2396 | |
| 2383 | expanded_args.appendAssumeCapacity(try expand_buf.toOwnedSlice()); | |
| 2397 | expanded_args.appendAssumeCapacity(try expand_buf.toOwnedSlice(gpa)); | |
| 2384 | 2398 | } |
| 2385 | 2399 | |
| 2386 | 2400 | var res = try pp.expandFuncMacro(macro_tok, macro, &args, &expanded_args, hs); |
| 2387 | defer res.deinit(); | |
| 2401 | defer res.deinit(gpa); | |
| 2388 | 2402 | const tokens_added = res.items.len; |
| 2389 | 2403 | 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); | |
| 2392 | 2406 | |
| 2393 | 2407 | moving_end_idx += tokens_added; |
| 2394 | 2408 | // Overflow here means that we encountered an unterminated argument list |
| ... | ... | @@ -2397,8 +2411,8 @@ fn expandMacroExhaustive( |
| 2397 | 2411 | idx += tokens_added; |
| 2398 | 2412 | do_rescan = true; |
| 2399 | 2413 | } else { |
| 2400 | const res = try pp.expandObjMacro(macro); | |
| 2401 | defer res.deinit(); | |
| 2414 | var res = try pp.expandObjMacro(macro); | |
| 2415 | defer res.deinit(gpa); | |
| 2402 | 2416 | |
| 2403 | 2417 | const hs = try pp.hideset.prepend(macro_tok.loc, macro_hidelist); |
| 2404 | 2418 | |
| ... | ... | @@ -2406,8 +2420,8 @@ fn expandMacroExhaustive( |
| 2406 | 2420 | var increment_idx_by = res.items.len; |
| 2407 | 2421 | for (res.items, 0..) |*tok, i| { |
| 2408 | 2422 | 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); | |
| 2411 | 2425 | |
| 2412 | 2426 | const tok_hidelist = pp.hideset.get(tok.loc); |
| 2413 | 2427 | const new_hidelist = try pp.hideset.@"union"(tok_hidelist, hs); |
| ... | ... | @@ -2426,8 +2440,8 @@ fn expandMacroExhaustive( |
| 2426 | 2440 | } |
| 2427 | 2441 | } |
| 2428 | 2442 | |
| 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); | |
| 2431 | 2445 | idx += increment_idx_by; |
| 2432 | 2446 | moving_end_idx = moving_end_idx + res.items.len - 1; |
| 2433 | 2447 | do_rescan = true; |
| ... | ... | @@ -2442,7 +2456,7 @@ fn expandMacroExhaustive( |
| 2442 | 2456 | |
| 2443 | 2457 | // trim excess buffer |
| 2444 | 2458 | for (buf.items[moving_end_idx..]) |item| { |
| 2445 | TokenWithExpansionLocs.free(item.expansion_locs, pp.gpa); | |
| 2459 | TokenWithExpansionLocs.free(item.expansion_locs, gpa); | |
| 2446 | 2460 | } |
| 2447 | 2461 | buf.items.len = moving_end_idx; |
| 2448 | 2462 | } |
| ... | ... | @@ -2456,10 +2470,11 @@ fn unescapeUcn(pp: *Preprocessor, tok: TokenWithExpansionLocs) !TokenWithExpansi |
| 2456 | 2470 | .extended_identifier => { |
| 2457 | 2471 | @branchHint(.cold); |
| 2458 | 2472 | const identifier = pp.expandedSlice(tok); |
| 2473 | const gpa = pp.comp.gpa; | |
| 2459 | 2474 | if (mem.indexOfScalar(u8, identifier, '\\') != null) { |
| 2460 | 2475 | @branchHint(.cold); |
| 2461 | 2476 | 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); | |
| 2463 | 2478 | var identifier_parser: text_literal.Parser = .{ |
| 2464 | 2479 | .comp = pp.comp, |
| 2465 | 2480 | .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 |
| 2486 | 2501 | } |
| 2487 | 2502 | } |
| 2488 | 2503 | pp.comp.generated_buf.appendAssumeCapacity('\n'); |
| 2489 | defer TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa); | |
| 2504 | defer TokenWithExpansionLocs.free(tok.expansion_locs, gpa); | |
| 2490 | 2505 | return pp.makeGeneratedToken(start, .extended_identifier, tok); |
| 2491 | 2506 | } |
| 2492 | 2507 | }, |
| ... | ... | @@ -2503,8 +2518,9 @@ fn expandMacro(pp: *Preprocessor, tokenizer: *Tokenizer, raw: RawToken) MacroErr |
| 2503 | 2518 | source_tok.id.simplifyMacroKeyword(); |
| 2504 | 2519 | return pp.addToken(source_tok); |
| 2505 | 2520 | } |
| 2521 | const gpa = pp.comp.gpa; | |
| 2506 | 2522 | 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); | |
| 2508 | 2524 | pp.expansion_source_loc = source_tok.loc; |
| 2509 | 2525 | |
| 2510 | 2526 | pp.hideset.clearRetainingCapacity(); |
| ... | ... | @@ -2512,15 +2528,15 @@ fn expandMacro(pp: *Preprocessor, tokenizer: *Tokenizer, raw: RawToken) MacroErr |
| 2512 | 2528 | try pp.ensureUnusedTokenCapacity(pp.top_expansion_buf.items.len); |
| 2513 | 2529 | for (pp.top_expansion_buf.items) |*tok| { |
| 2514 | 2530 | if (tok.id == .macro_ws and !pp.preserve_whitespace) { |
| 2515 | TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa); | |
| 2531 | TokenWithExpansionLocs.free(tok.expansion_locs, gpa); | |
| 2516 | 2532 | continue; |
| 2517 | 2533 | } |
| 2518 | 2534 | 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); | |
| 2520 | 2536 | continue; |
| 2521 | 2537 | } |
| 2522 | 2538 | if (tok.id == .placemarker) { |
| 2523 | TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa); | |
| 2539 | TokenWithExpansionLocs.free(tok.expansion_locs, gpa); | |
| 2524 | 2540 | continue; |
| 2525 | 2541 | } |
| 2526 | 2542 | tok.id.simplifyMacroKeywordExtra(true); |
| ... | ... | @@ -2564,14 +2580,15 @@ pub fn expandedSlice(pp: *const Preprocessor, tok: anytype) []const u8 { |
| 2564 | 2580 | |
| 2565 | 2581 | /// Concat two tokens and add the result to pp.generated |
| 2566 | 2582 | fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenWithExpansionLocs) Error!void { |
| 2583 | const gpa = pp.comp.gpa; | |
| 2567 | 2584 | const lhs = while (lhs_toks.pop()) |lhs| { |
| 2568 | 2585 | if ((pp.comp.langopts.preserve_comments_in_macros and lhs.id == .comment) or |
| 2569 | 2586 | (lhs.id != .macro_ws and lhs.id != .comment)) |
| 2570 | 2587 | break lhs; |
| 2571 | 2588 | |
| 2572 | TokenWithExpansionLocs.free(lhs.expansion_locs, pp.gpa); | |
| 2589 | TokenWithExpansionLocs.free(lhs.expansion_locs, gpa); | |
| 2573 | 2590 | } else { |
| 2574 | return bufCopyTokens(lhs_toks, rhs_toks, &.{}); | |
| 2591 | return bufCopyTokens(gpa, lhs_toks, rhs_toks, &.{}); | |
| 2575 | 2592 | }; |
| 2576 | 2593 | |
| 2577 | 2594 | var rhs_rest: u32 = 1; |
| ... | ... | @@ -2584,11 +2601,11 @@ fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenW |
| 2584 | 2601 | } else { |
| 2585 | 2602 | return lhs_toks.appendAssumeCapacity(lhs); |
| 2586 | 2603 | }; |
| 2587 | defer TokenWithExpansionLocs.free(lhs.expansion_locs, pp.gpa); | |
| 2604 | defer TokenWithExpansionLocs.free(lhs.expansion_locs, gpa); | |
| 2588 | 2605 | |
| 2589 | 2606 | const start = pp.comp.generated_buf.items.len; |
| 2590 | 2607 | 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 | |
| 2592 | 2609 | // We cannot use the same slices here since they might be invalidated by `ensureCapacity` |
| 2593 | 2610 | pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(lhs)); |
| 2594 | 2611 | pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(rhs)); |
| ... | ... | @@ -2607,32 +2624,33 @@ fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenW |
| 2607 | 2624 | .placemarker |
| 2608 | 2625 | else |
| 2609 | 2626 | 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)); | |
| 2611 | 2628 | |
| 2612 | 2629 | if (next.id != .nl and next.id != .eof) { |
| 2613 | 2630 | 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)); | |
| 2615 | 2632 | } |
| 2616 | 2633 | |
| 2617 | try bufCopyTokens(lhs_toks, rhs_toks[rhs_rest..], &.{}); | |
| 2634 | try bufCopyTokens(gpa, lhs_toks, rhs_toks[rhs_rest..], &.{}); | |
| 2618 | 2635 | } |
| 2619 | 2636 | |
| 2620 | 2637 | fn makeGeneratedToken(pp: *Preprocessor, start: usize, id: Token.Id, source: TokenWithExpansionLocs) !TokenWithExpansionLocs { |
| 2638 | const gpa = pp.comp.gpa; | |
| 2621 | 2639 | var pasted_token = TokenWithExpansionLocs{ .id = id, .loc = .{ |
| 2622 | 2640 | .id = .generated, |
| 2623 | 2641 | .byte_offset = @intCast(start), |
| 2624 | 2642 | .line = pp.generated_line, |
| 2625 | 2643 | } }; |
| 2626 | 2644 | 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()); | |
| 2629 | 2647 | return pasted_token; |
| 2630 | 2648 | } |
| 2631 | 2649 | |
| 2632 | 2650 | /// Defines a new macro and warns if it is a duplicate |
| 2633 | 2651 | fn defineMacro(pp: *Preprocessor, define_tok: RawToken, name_tok: TokenWithExpansionLocs, macro: Macro) Error!void { |
| 2634 | 2652 | 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); | |
| 2636 | 2654 | if (gop.found_existing and !gop.value_ptr.eql(macro, pp)) { |
| 2637 | 2655 | const loc = name_tok.loc; |
| 2638 | 2656 | const prev_total = pp.diagnostics.total; |
| ... | ... | @@ -2668,8 +2686,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error! |
| 2668 | 2686 | try pp.err(escaped_macro_name, .macro_name_must_be_identifier, .{}); |
| 2669 | 2687 | return skipToNl(tokenizer); |
| 2670 | 2688 | } |
| 2689 | const gpa = pp.comp.gpa; | |
| 2671 | 2690 | 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); | |
| 2673 | 2692 | |
| 2674 | 2693 | var macro_name_token_id = macro_name.id; |
| 2675 | 2694 | macro_name_token_id.simplifyMacroKeyword(); |
| ... | ... | @@ -2724,21 +2743,21 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error! |
| 2724 | 2743 | }, |
| 2725 | 2744 | else => {}, |
| 2726 | 2745 | } |
| 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); | |
| 2729 | 2748 | }, |
| 2730 | 2749 | .nl, .eof => break, |
| 2731 | 2750 | .comment => if (pp.comp.langopts.preserve_comments_in_macros) { |
| 2732 | 2751 | if (need_ws) { |
| 2733 | 2752 | 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 }); | |
| 2735 | 2754 | } |
| 2736 | try pp.token_buf.append(tok); | |
| 2755 | try pp.token_buf.append(gpa, tok); | |
| 2737 | 2756 | }, |
| 2738 | 2757 | .whitespace => need_ws = true, |
| 2739 | 2758 | .unterminated_string_literal, .unterminated_char_literal, .empty_char_literal => |tag| { |
| 2740 | 2759 | try pp.err(tok, invalidTokenDiagnostic(tag), .{}); |
| 2741 | try pp.token_buf.append(tok); | |
| 2760 | try pp.token_buf.append(gpa, tok); | |
| 2742 | 2761 | }, |
| 2743 | 2762 | .unterminated_comment => try pp.err(tok, .unterminated_comment, .{}), |
| 2744 | 2763 | else => { |
| ... | ... | @@ -2748,9 +2767,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error! |
| 2748 | 2767 | } |
| 2749 | 2768 | if (tok.id != .whitespace and need_ws) { |
| 2750 | 2769 | 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 }); | |
| 2752 | 2771 | } |
| 2753 | try pp.token_buf.append(tok); | |
| 2772 | try pp.token_buf.append(gpa, tok); | |
| 2754 | 2773 | }, |
| 2755 | 2774 | } |
| 2756 | 2775 | tok = tokenizer.next(); |
| ... | ... | @@ -2769,8 +2788,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error! |
| 2769 | 2788 | /// Handle a function like #define directive. |
| 2770 | 2789 | fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macro_name: TokenWithExpansionLocs, l_paren: RawToken) Error!void { |
| 2771 | 2790 | 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); | |
| 2774 | 2794 | |
| 2775 | 2795 | // Parse the parameter list. |
| 2776 | 2796 | var gnu_var_args: []const u8 = ""; |
| ... | ... | @@ -2794,7 +2814,7 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr |
| 2794 | 2814 | return skipToNl(tokenizer); |
| 2795 | 2815 | } |
| 2796 | 2816 | |
| 2797 | try params.append(pp.tokSlice(tok)); | |
| 2817 | try params.append(gpa, pp.tokSlice(tok)); | |
| 2798 | 2818 | |
| 2799 | 2819 | tok = tokenizer.nextNoWS(); |
| 2800 | 2820 | if (tok.id == .ellipsis) { |
| ... | ... | @@ -2826,34 +2846,34 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr |
| 2826 | 2846 | .comment => if (!pp.comp.langopts.preserve_comments_in_macros) continue else { |
| 2827 | 2847 | if (need_ws) { |
| 2828 | 2848 | 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 }); | |
| 2830 | 2850 | } |
| 2831 | try pp.token_buf.append(tok); | |
| 2851 | try pp.token_buf.append(gpa, tok); | |
| 2832 | 2852 | }, |
| 2833 | 2853 | .hash => { |
| 2834 | 2854 | if (tok.id != .whitespace and need_ws) { |
| 2835 | 2855 | 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 }); | |
| 2837 | 2857 | } |
| 2838 | 2858 | const param = tokenizer.nextNoWS(); |
| 2839 | 2859 | blk: { |
| 2840 | 2860 | if (var_args and param.id == .keyword_va_args) { |
| 2841 | 2861 | tok.id = .stringify_va_args; |
| 2842 | try pp.token_buf.append(tok); | |
| 2862 | try pp.token_buf.append(gpa, tok); | |
| 2843 | 2863 | continue :tok_loop; |
| 2844 | 2864 | } |
| 2845 | 2865 | if (!param.id.isMacroIdentifier()) break :blk; |
| 2846 | 2866 | const s = pp.tokSlice(param); |
| 2847 | 2867 | if (mem.eql(u8, s, gnu_var_args)) { |
| 2848 | 2868 | tok.id = .stringify_va_args; |
| 2849 | try pp.token_buf.append(tok); | |
| 2869 | try pp.token_buf.append(gpa, tok); | |
| 2850 | 2870 | continue :tok_loop; |
| 2851 | 2871 | } |
| 2852 | 2872 | for (params.items, 0..) |p, i| { |
| 2853 | 2873 | if (mem.eql(u8, p, s)) { |
| 2854 | 2874 | tok.id = .stringify_param; |
| 2855 | 2875 | tok.end = @intCast(i); |
| 2856 | try pp.token_buf.append(tok); | |
| 2876 | try pp.token_buf.append(gpa, tok); | |
| 2857 | 2877 | continue :tok_loop; |
| 2858 | 2878 | } |
| 2859 | 2879 | } |
| ... | ... | @@ -2880,17 +2900,17 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr |
| 2880 | 2900 | if (pp.token_buf.items[pp.token_buf.items.len - 1].id == .macro_param) { |
| 2881 | 2901 | pp.token_buf.items[pp.token_buf.items.len - 1].id = .macro_param_no_expand; |
| 2882 | 2902 | } |
| 2883 | try pp.token_buf.append(tok); | |
| 2903 | try pp.token_buf.append(gpa, tok); | |
| 2884 | 2904 | }, |
| 2885 | 2905 | .unterminated_string_literal, .unterminated_char_literal, .empty_char_literal => |tag| { |
| 2886 | 2906 | try pp.err(tok, invalidTokenDiagnostic(tag), .{}); |
| 2887 | try pp.token_buf.append(tok); | |
| 2907 | try pp.token_buf.append(gpa, tok); | |
| 2888 | 2908 | }, |
| 2889 | 2909 | .unterminated_comment => try pp.err(tok, .unterminated_comment, .{}), |
| 2890 | 2910 | else => { |
| 2891 | 2911 | if (tok.id != .whitespace and need_ws) { |
| 2892 | 2912 | 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 }); | |
| 2894 | 2914 | } |
| 2895 | 2915 | if (var_args and tok.id == .keyword_va_args) { |
| 2896 | 2916 | // do nothing |
| ... | ... | @@ -2937,7 +2957,7 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr |
| 2937 | 2957 | } |
| 2938 | 2958 | } |
| 2939 | 2959 | } |
| 2940 | try pp.token_buf.append(tok); | |
| 2960 | try pp.token_buf.append(gpa, tok); | |
| 2941 | 2961 | }, |
| 2942 | 2962 | } |
| 2943 | 2963 | } |
| ... | ... | @@ -2957,12 +2977,13 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr |
| 2957 | 2977 | /// embedDirective : ("FILENAME" | <FILENAME>) embedParam* |
| 2958 | 2978 | /// embedParam : IDENTIFIER (:: IDENTIFIER)? '(' <tokens> ')' |
| 2959 | 2979 | fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void { |
| 2980 | const gpa = pp.comp.gpa; | |
| 2960 | 2981 | const first = tokenizer.nextNoWS(); |
| 2961 | 2982 | const filename_tok = pp.findIncludeFilenameToken(first, tokenizer, .ignore_trailing_tokens) catch |er| switch (er) { |
| 2962 | 2983 | error.InvalidInclude => return, |
| 2963 | 2984 | else => |e| return e, |
| 2964 | 2985 | }; |
| 2965 | defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, pp.gpa); | |
| 2986 | defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, gpa); | |
| 2966 | 2987 | |
| 2967 | 2988 | // Check for empty filename. |
| 2968 | 2989 | const tok_slice = pp.expandedSliceExtra(filename_tok, .single_macro_ws); |
| ... | ... | @@ -3024,9 +3045,12 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void { |
| 3024 | 3045 | try pp.err(l_paren, .malformed_embed_param, .{}); |
| 3025 | 3046 | continue; |
| 3026 | 3047 | } |
| 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); | |
| 3030 | 3054 | break :blk pp.char_buf.items; |
| 3031 | 3055 | }, |
| 3032 | 3056 | .l_paren => Attribute.normalize(pp.tokSlice(param_first)), |
| ... | ... | @@ -3044,7 +3068,7 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void { |
| 3044 | 3068 | try pp.err(maybe_colon, .malformed_embed_param, .{}); |
| 3045 | 3069 | break; |
| 3046 | 3070 | } |
| 3047 | try pp.token_buf.append(next); | |
| 3071 | try pp.token_buf.append(gpa, next); | |
| 3048 | 3072 | } |
| 3049 | 3073 | const end: u32 = @intCast(pp.token_buf.items.len); |
| 3050 | 3074 | |
| ... | ... | @@ -3093,7 +3117,7 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void { |
| 3093 | 3117 | |
| 3094 | 3118 | const embed_bytes = (try pp.comp.findEmbed(filename, first.source, include_type, limit orelse .unlimited, pp.dep_file)) orelse |
| 3095 | 3119 | return pp.fatalNotFound(filename_tok, filename); |
| 3096 | defer pp.comp.gpa.free(embed_bytes); | |
| 3120 | defer gpa.free(embed_bytes); | |
| 3097 | 3121 | |
| 3098 | 3122 | try Range.expand(prefix, pp, tokenizer); |
| 3099 | 3123 | |
| ... | ... | @@ -3111,17 +3135,17 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void { |
| 3111 | 3135 | { |
| 3112 | 3136 | const byte = embed_bytes[0]; |
| 3113 | 3137 | 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}); | |
| 3115 | 3139 | pp.addTokenAssumeCapacity(try pp.makeGeneratedToken(start, .embed_byte, filename_tok)); |
| 3116 | 3140 | } |
| 3117 | 3141 | |
| 3118 | 3142 | for (embed_bytes[1..]) |byte| { |
| 3119 | 3143 | 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}); | |
| 3121 | 3145 | pp.addTokenAssumeCapacity(.{ .id = .comma, .loc = .{ .id = .generated, .byte_offset = @intCast(start) } }); |
| 3122 | 3146 | pp.addTokenAssumeCapacity(try pp.makeGeneratedToken(start + 1, .embed_byte, filename_tok)); |
| 3123 | 3147 | } |
| 3124 | try pp.comp.generated_buf.append(pp.gpa, '\n'); | |
| 3148 | try pp.comp.generated_buf.append(gpa, '\n'); | |
| 3125 | 3149 | |
| 3126 | 3150 | try Range.expand(suffix, pp, tokenizer); |
| 3127 | 3151 | } |
| ... | ... | @@ -3133,6 +3157,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc |
| 3133 | 3157 | error.InvalidInclude => return, |
| 3134 | 3158 | else => |e| return e, |
| 3135 | 3159 | }; |
| 3160 | const gpa = pp.comp.gpa; | |
| 3136 | 3161 | |
| 3137 | 3162 | // Prevent stack overflow |
| 3138 | 3163 | pp.include_depth += 1; |
| ... | ... | @@ -3147,7 +3172,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc |
| 3147 | 3172 | if (pp.defines.contains(guard)) return; |
| 3148 | 3173 | } |
| 3149 | 3174 | |
| 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); | |
| 3151 | 3176 | if (pp.verbose) { |
| 3152 | 3177 | pp.verboseLog(first, "include file {s}", .{new_source.path}); |
| 3153 | 3178 | } |
| ... | ... | @@ -3156,7 +3181,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc |
| 3156 | 3181 | try pp.addIncludeStart(new_source); |
| 3157 | 3182 | const eof = pp.preprocessExtra(new_source) catch |er| switch (er) { |
| 3158 | 3183 | 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); | |
| 3160 | 3185 | pp.restoreTokenState(token_state); |
| 3161 | 3186 | return; |
| 3162 | 3187 | }, |
| ... | ... | @@ -3187,20 +3212,22 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc |
| 3187 | 3212 | /// operator_loc: Location of `_Pragma`; null if this is from #pragma |
| 3188 | 3213 | /// arg_locs: expansion locations of the argument to _Pragma. empty if #pragma or a raw string literal was used |
| 3189 | 3214 | fn makePragmaToken(pp: *Preprocessor, raw: RawToken, operator_loc: ?Source.Location, arg_locs: []const Source.Location) !TokenWithExpansionLocs { |
| 3215 | const gpa = pp.comp.gpa; | |
| 3190 | 3216 | var tok = tokFromRaw(raw); |
| 3191 | 3217 | if (operator_loc) |loc| { |
| 3192 | try tok.addExpansionLocation(pp.gpa, &.{loc}); | |
| 3218 | try tok.addExpansionLocation(gpa, &.{loc}); | |
| 3193 | 3219 | } |
| 3194 | try tok.addExpansionLocation(pp.gpa, arg_locs); | |
| 3220 | try tok.addExpansionLocation(gpa, arg_locs); | |
| 3195 | 3221 | return tok; |
| 3196 | 3222 | } |
| 3197 | 3223 | |
| 3198 | 3224 | pub fn addToken(pp: *Preprocessor, tok_arg: TokenWithExpansionLocs) !void { |
| 3225 | const gpa = pp.comp.gpa; | |
| 3199 | 3226 | const tok = try pp.unescapeUcn(tok_arg); |
| 3200 | 3227 | 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 }); | |
| 3202 | 3229 | } |
| 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 }); | |
| 3204 | 3231 | } |
| 3205 | 3232 | |
| 3206 | 3233 | pub fn addTokenAssumeCapacity(pp: *Preprocessor, tok: TokenWithExpansionLocs) void { |
| ... | ... | @@ -3211,13 +3238,15 @@ pub fn addTokenAssumeCapacity(pp: *Preprocessor, tok: TokenWithExpansionLocs) vo |
| 3211 | 3238 | } |
| 3212 | 3239 | |
| 3213 | 3240 | pub 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); | |
| 3216 | 3244 | } |
| 3217 | 3245 | |
| 3218 | 3246 | pub 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); | |
| 3221 | 3250 | } |
| 3222 | 3251 | |
| 3223 | 3252 | /// Handle a pragma directive |
| ... | ... | @@ -3285,10 +3314,11 @@ fn findIncludeFilenameToken( |
| 3285 | 3314 | const filename_tok, const expanded_trailing = switch (source_tok.id) { |
| 3286 | 3315 | .string_literal, .macro_string => .{ source_tok, false }, |
| 3287 | 3316 | else => expanded: { |
| 3317 | const gpa = pp.comp.gpa; | |
| 3288 | 3318 | // Try to expand if the argument is a macro. |
| 3289 | 3319 | 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); | |
| 3292 | 3322 | pp.expansion_source_loc = source_tok.loc; |
| 3293 | 3323 | |
| 3294 | 3324 | try pp.expandMacroExhaustive(tokenizer, &pp.top_expansion_buf, 0, 1, true, .non_expr); |
| ... | ... | @@ -3298,7 +3328,7 @@ fn findIncludeFilenameToken( |
| 3298 | 3328 | return error.InvalidInclude; |
| 3299 | 3329 | }; |
| 3300 | 3330 | 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); | |
| 3302 | 3332 | |
| 3303 | 3333 | break :expanded .{ try pp.makeGeneratedToken(start, switch (include_str[0]) { |
| 3304 | 3334 | '"' => .string_literal, |
| ... | ... | @@ -3326,7 +3356,7 @@ fn findIncludeFilenameToken( |
| 3326 | 3356 | |
| 3327 | 3357 | fn findIncludeSource(pp: *Preprocessor, tokenizer: *Tokenizer, first: RawToken, which: Compilation.WhichInclude) !Source { |
| 3328 | 3358 | 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); | |
| 3330 | 3360 | |
| 3331 | 3361 | // Check for empty filename. |
| 3332 | 3362 | const tok_slice = pp.expandedSliceExtra(filename_tok, .single_macro_ws); |
| ... | ... | @@ -3650,7 +3680,7 @@ test "destringify" { |
| 3650 | 3680 | const Test = struct { |
| 3651 | 3681 | fn testDestringify(pp: *Preprocessor, stringified: []const u8, destringified: []const u8) !void { |
| 3652 | 3682 | pp.char_buf.clearRetainingCapacity(); |
| 3653 | try pp.char_buf.ensureUnusedCapacity(stringified.len); | |
| 3683 | try pp.char_buf.ensureUnusedCapacity(gpa, stringified.len); | |
| 3654 | 3684 | pp.destringify(stringified); |
| 3655 | 3685 | try std.testing.expectEqualStrings(destringified, pp.char_buf.items); |
| 3656 | 3686 | } |
| ... | ... | @@ -3730,18 +3760,18 @@ test "Include guards" { |
| 3730 | 3760 | |
| 3731 | 3761 | _ = try comp.addSourceFromBuffer(path, "int bar = 5;\n"); |
| 3732 | 3762 | |
| 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); | |
| 3735 | 3765 | |
| 3736 | 3766 | 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" }), | |
| 3739 | 3769 | .keyword_ifndef, |
| 3740 | 3770 | .keyword_ifdef, |
| 3741 | 3771 | .keyword_elifdef, |
| 3742 | 3772 | .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().?, "" }), | |
| 3745 | 3775 | } |
| 3746 | 3776 | const source = try comp.addSourceFromBuffer("test.h", buf.items); |
| 3747 | 3777 | _ = try pp.preprocess(source); |
lib/compiler/aro/aro/Preprocessor/Diagnostic.zig+9| ... | ... | @@ -10,6 +10,7 @@ fmt: []const u8, |
| 10 | 10 | kind: Diagnostics.Message.Kind, |
| 11 | 11 | opt: ?Diagnostics.Option = null, |
| 12 | 12 | extension: bool = false, |
| 13 | show_in_system_headers: bool = false, | |
| 13 | 14 | |
| 14 | 15 | pub const elif_without_if: Diagnostic = .{ |
| 15 | 16 | .fmt = "#elif without #if", |
| ... | ... | @@ -91,6 +92,7 @@ pub const warning_directive: Diagnostic = .{ |
| 91 | 92 | .fmt = "{s}", |
| 92 | 93 | .opt = .@"#warnings", |
| 93 | 94 | .kind = .warning, |
| 95 | .show_in_system_headers = true, | |
| 94 | 96 | }; |
| 95 | 97 | |
| 96 | 98 | pub const macro_name_missing: Diagnostic = .{ |
| ... | ... | @@ -440,3 +442,10 @@ pub const invalid_source_epoch: Diagnostic = .{ |
| 440 | 442 | .fmt = "environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799", |
| 441 | 443 | .kind = .@"error", |
| 442 | 444 | }; |
| 445 | ||
| 446 | pub 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 { |
| 38 | 38 | col: u32, |
| 39 | 39 | width: u32, |
| 40 | 40 | end_with_splice: bool, |
| 41 | kind: Kind, | |
| 41 | 42 | }; |
| 42 | 43 | |
| 43 | 44 | const Source = @This(); |
| ... | ... | @@ -120,6 +121,7 @@ pub fn lineCol(source: Source, loc: Location) ExpandedLocation { |
| 120 | 121 | .col = col, |
| 121 | 122 | .width = width, |
| 122 | 123 | .end_with_splice = end_with_splice, |
| 124 | .kind = source.kind, | |
| 123 | 125 | }; |
| 124 | 126 | } |
| 125 | 127 |
lib/compiler/aro/aro/SymbolStack.zig+10-10| ... | ... | @@ -35,14 +35,14 @@ pub const Kind = enum { |
| 35 | 35 | constexpr, |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | scopes: std.ArrayListUnmanaged(Scope) = .{}, | |
| 38 | scopes: std.ArrayList(Scope) = .empty, | |
| 39 | 39 | /// allocations from nested scopes are retained after popping; `active_len` is the number |
| 40 | 40 | /// of currently-active items in `scopes`. |
| 41 | 41 | active_len: usize = 0, |
| 42 | 42 | |
| 43 | 43 | const 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, | |
| 46 | 46 | |
| 47 | 47 | fn deinit(self: *Scope, allocator: Allocator) void { |
| 48 | 48 | self.vars.deinit(allocator); |
| ... | ... | @@ -66,7 +66,7 @@ pub fn deinit(s: *SymbolStack, gpa: Allocator) void { |
| 66 | 66 | |
| 67 | 67 | pub fn pushScope(s: *SymbolStack, p: *Parser) !void { |
| 68 | 68 | if (s.active_len + 1 > s.scopes.items.len) { |
| 69 | try s.scopes.append(p.gpa, .{}); | |
| 69 | try s.scopes.append(p.comp.gpa, .{}); | |
| 70 | 70 | s.active_len = s.scopes.items.len; |
| 71 | 71 | } else { |
| 72 | 72 | s.scopes.items[s.active_len].clearRetainingCapacity(); |
| ... | ... | @@ -195,7 +195,7 @@ pub fn defineTypedef( |
| 195 | 195 | else => unreachable, |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | try s.define(p.gpa, .{ | |
| 198 | try s.define(p.comp.gpa, .{ | |
| 199 | 199 | .kind = .typedef, |
| 200 | 200 | .name = name, |
| 201 | 201 | .tok = tok, |
| ... | ... | @@ -245,7 +245,7 @@ pub fn defineSymbol( |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | try s.define(p.gpa, .{ | |
| 248 | try s.define(p.comp.gpa, .{ | |
| 249 | 249 | .kind = if (constexpr) .constexpr else .def, |
| 250 | 250 | .name = name, |
| 251 | 251 | .tok = tok, |
| ... | ... | @@ -306,7 +306,7 @@ pub fn declareSymbol( |
| 306 | 306 | else => unreachable, |
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | try s.define(p.gpa, .{ | |
| 309 | try s.define(p.comp.gpa, .{ | |
| 310 | 310 | .kind = .decl, |
| 311 | 311 | .name = name, |
| 312 | 312 | .tok = tok, |
| ... | ... | @@ -317,7 +317,7 @@ pub fn declareSymbol( |
| 317 | 317 | |
| 318 | 318 | // Declare out of scope symbol for functions declared in functions. |
| 319 | 319 | 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, .{ | |
| 321 | 321 | .kind = .decl, |
| 322 | 322 | .name = name, |
| 323 | 323 | .tok = tok, |
| ... | ... | @@ -352,7 +352,7 @@ pub fn defineParam( |
| 352 | 352 | else => unreachable, |
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | try s.define(p.gpa, .{ | |
| 355 | try s.define(p.comp.gpa, .{ | |
| 356 | 356 | .kind = .def, |
| 357 | 357 | .name = name, |
| 358 | 358 | .tok = tok, |
| ... | ... | @@ -424,7 +424,7 @@ pub fn defineEnumeration( |
| 424 | 424 | else => unreachable, |
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | try s.define(p.gpa, .{ | |
| 427 | try s.define(p.comp.gpa, .{ | |
| 428 | 428 | .kind = .enumeration, |
| 429 | 429 | .name = name, |
| 430 | 430 | .tok = tok, |
lib/compiler/aro/aro/Toolchain.zig+40-38| ... | ... | @@ -9,7 +9,7 @@ const Filesystem = @import("Driver/Filesystem.zig").Filesystem; |
| 9 | 9 | const Multilib = @import("Driver/Multilib.zig"); |
| 10 | 10 | const target_util = @import("target.zig"); |
| 11 | 11 | |
| 12 | pub const PathList = std.ArrayListUnmanaged([]const u8); | |
| 12 | pub const PathList = std.ArrayList([]const u8); | |
| 13 | 13 | |
| 14 | 14 | pub const RuntimeLibKind = enum { |
| 15 | 15 | compiler_rt, |
| ... | ... | @@ -64,7 +64,6 @@ pub fn getTarget(tc: *const Toolchain) std.Target { |
| 64 | 64 | fn getDefaultLinker(tc: *const Toolchain) []const u8 { |
| 65 | 65 | return switch (tc.inner) { |
| 66 | 66 | .uninitialized => unreachable, |
| 67 | .linux => |linux| linux.getDefaultLinker(tc.getTarget()), | |
| 68 | 67 | .unknown => "ld", |
| 69 | 68 | }; |
| 70 | 69 | } |
| ... | ... | @@ -72,6 +71,7 @@ fn getDefaultLinker(tc: *const Toolchain) []const u8 { |
| 72 | 71 | /// Call this after driver has finished parsing command line arguments to find the toolchain |
| 73 | 72 | pub fn discover(tc: *Toolchain) !void { |
| 74 | 73 | if (tc.inner != .uninitialized) return; |
| 74 | ||
| 75 | 75 | tc.inner = .unknown; |
| 76 | 76 | return switch (tc.inner) { |
| 77 | 77 | .uninitialized => unreachable, |
| ... | ... | @@ -143,8 +143,11 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 { |
| 143 | 143 | return use_linker; |
| 144 | 144 | } |
| 145 | 145 | } 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 | ||
| 148 | 151 | if (tc.getTarget().os.tag.isDarwin()) { |
| 149 | 152 | linker_name.appendSliceAssumeCapacity("ld64."); |
| 150 | 153 | } else { |
| ... | ... | @@ -171,20 +174,27 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 { |
| 171 | 174 | /// TODO: this isn't exactly right since our target names don't necessarily match up |
| 172 | 175 | /// with GCC's. |
| 173 | 176 | /// For example the Zig target `arm-freestanding-eabi` would need the `arm-none-eabi` tools |
| 174 | fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8, possible_names: *std.ArrayListUnmanaged([]const u8)) void { | |
| 177 | fn 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; | |
| 175 | 184 | if (raw_triple) |triple| { |
| 176 | 185 | if (std.fmt.bufPrint(buf, "{s}-{s}", .{ triple, name })) |res| { |
| 177 | possible_names.appendAssumeCapacity(res); | |
| 186 | possible_name_buf[i] = res; | |
| 187 | i += 1; | |
| 178 | 188 | } else |_| {} |
| 179 | 189 | } |
| 180 | possible_names.appendAssumeCapacity(name); | |
| 190 | possible_name_buf[i] = name; | |
| 181 | 191 | |
| 182 | return possible_names; | |
| 192 | return possible_name_buf[0..i]; | |
| 183 | 193 | } |
| 184 | 194 | |
| 185 | 195 | /// Add toolchain `file_paths` to argv as `-L` arguments |
| 186 | pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { | |
| 187 | try argv.ensureUnusedCapacity(tc.file_paths.items.len); | |
| 196 | pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 197 | try argv.ensureUnusedCapacity(tc.driver.comp.gpa, tc.file_paths.items.len); | |
| 188 | 198 | |
| 189 | 199 | var bytes_needed: usize = 0; |
| 190 | 200 | for (tc.file_paths.items) |path| { |
| ... | ... | @@ -208,11 +218,10 @@ fn getProgramPath(tc: *const Toolchain, name: []const u8, buf: []u8) []const u8 |
| 208 | 218 | var fib = std.heap.FixedBufferAllocator.init(&path_buf); |
| 209 | 219 | |
| 210 | 220 | 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); | |
| 214 | 223 | |
| 215 | for (possible_names.items) |tool_name| { | |
| 224 | for (possible_names) |tool_name| { | |
| 216 | 225 | for (tc.program_paths.items) |program_path| { |
| 217 | 226 | defer fib.reset(); |
| 218 | 227 | |
| ... | ... | @@ -318,16 +327,6 @@ pub fn addPathFromComponents(tc: *Toolchain, components: []const []const u8, des |
| 318 | 327 | try dest.append(tc.driver.comp.gpa, full_path); |
| 319 | 328 | } |
| 320 | 329 | |
| 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 | |
| 323 | pub 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 | ||
| 331 | 330 | fn getDefaultRuntimeLibKind(tc: *const Toolchain) RuntimeLibKind { |
| 332 | 331 | if (tc.getTarget().abi.isAndroid()) { |
| 333 | 332 | return .compiler_rt; |
| ... | ... | @@ -400,7 +399,7 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 { |
| 400 | 399 | } |
| 401 | 400 | } |
| 402 | 401 | |
| 403 | fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { | |
| 402 | fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 404 | 403 | const unw = try tc.getUnwindLibKind(); |
| 405 | 404 | const target = tc.getTarget(); |
| 406 | 405 | if ((target.abi.isAndroid() and unw == .libgcc) or |
| ... | ... | @@ -410,46 +409,49 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const |
| 410 | 409 | |
| 411 | 410 | const lgk = tc.getLibGCCKind(); |
| 412 | 411 | 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); | |
| 413 | 414 | if (as_needed) { |
| 414 | try argv.append(getAsNeededOption(target.os.tag == .solaris, true)); | |
| 415 | argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, true)); | |
| 415 | 416 | } |
| 416 | 417 | switch (unw) { |
| 417 | 418 | .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"), | |
| 419 | 420 | .compiler_rt => if (target.os.tag == .aix) { |
| 420 | 421 | if (lgk != .static) { |
| 421 | try argv.append("-lunwind"); | |
| 422 | argv.appendAssumeCapacity("-lunwind"); | |
| 422 | 423 | } |
| 423 | 424 | } else if (lgk == .static) { |
| 424 | try argv.append("-l:libunwind.a"); | |
| 425 | argv.appendAssumeCapacity("-l:libunwind.a"); | |
| 425 | 426 | } else if (lgk == .shared) { |
| 426 | 427 | if (target_util.isCygwinMinGW(target)) { |
| 427 | try argv.append("-l:libunwind.dll.a"); | |
| 428 | argv.appendAssumeCapacity("-l:libunwind.dll.a"); | |
| 428 | 429 | } else { |
| 429 | try argv.append("-l:libunwind.so"); | |
| 430 | argv.appendAssumeCapacity("-l:libunwind.so"); | |
| 430 | 431 | } |
| 431 | 432 | } else { |
| 432 | try argv.append("-lunwind"); | |
| 433 | argv.appendAssumeCapacity("-lunwind"); | |
| 433 | 434 | }, |
| 434 | 435 | } |
| 435 | 436 | |
| 436 | 437 | if (as_needed) { |
| 437 | try argv.append(getAsNeededOption(target.os.tag == .solaris, false)); | |
| 438 | argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, false)); | |
| 438 | 439 | } |
| 439 | 440 | } |
| 440 | 441 | |
| 441 | fn addLibGCC(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { | |
| 442 | fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 443 | const gpa = tc.driver.comp.gpa; | |
| 442 | 444 | const libgcc_kind = tc.getLibGCCKind(); |
| 443 | 445 | if (libgcc_kind == .static or libgcc_kind == .unspecified) { |
| 444 | try argv.append("-lgcc"); | |
| 446 | try argv.append(gpa, "-lgcc"); | |
| 445 | 447 | } |
| 446 | 448 | try tc.addUnwindLibrary(argv); |
| 447 | 449 | if (libgcc_kind == .shared) { |
| 448 | try argv.append("-lgcc"); | |
| 450 | try argv.append(gpa, "-lgcc"); | |
| 449 | 451 | } |
| 450 | 452 | } |
| 451 | 453 | |
| 452 | pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void { | |
| 454 | pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 453 | 455 | const target = tc.getTarget(); |
| 454 | 456 | const rlt = tc.getRuntimeLibKind(); |
| 455 | 457 | switch (rlt) { |
| ... | ... | @@ -469,7 +471,7 @@ pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]cons |
| 469 | 471 | } |
| 470 | 472 | |
| 471 | 473 | 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"); | |
| 473 | 475 | } |
| 474 | 476 | } |
| 475 | 477 |
lib/compiler/aro/aro/Tree.zig+4-4| ... | ... | @@ -42,7 +42,7 @@ pub const TokenWithExpansionLocs = struct { |
| 42 | 42 | |
| 43 | 43 | pub fn addExpansionLocation(tok: *TokenWithExpansionLocs, gpa: std.mem.Allocator, new: []const Source.Location) !void { |
| 44 | 44 | 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; | |
| 46 | 46 | defer { |
| 47 | 47 | @memset(list.items.ptr[list.items.len..list.capacity], .{}); |
| 48 | 48 | // Add a sentinel to indicate the end of the list since |
| ... | ... | @@ -65,7 +65,7 @@ pub const TokenWithExpansionLocs = struct { |
| 65 | 65 | const min_len = @max(list.items.len + new.len + 1, 4); |
| 66 | 66 | const wanted_len = std.math.ceilPowerOfTwo(usize, min_len) catch |
| 67 | 67 | return error.OutOfMemory; |
| 68 | try list.ensureTotalCapacity(wanted_len); | |
| 68 | try list.ensureTotalCapacity(gpa, wanted_len); | |
| 69 | 69 | |
| 70 | 70 | for (new) |new_loc| { |
| 71 | 71 | if (new_loc.id == .generated) continue; |
| ... | ... | @@ -119,8 +119,8 @@ tokens: Token.List.Slice, |
| 119 | 119 | |
| 120 | 120 | // Values owned by this Tree |
| 121 | 121 | nodes: std.MultiArrayList(Node.Repr) = .empty, |
| 122 | extra: std.ArrayListUnmanaged(u32) = .empty, | |
| 123 | root_decls: std.ArrayListUnmanaged(Node.Index) = .empty, | |
| 122 | extra: std.ArrayList(u32) = .empty, | |
| 123 | root_decls: std.ArrayList(Node.Index) = .empty, | |
| 124 | 124 | value_map: ValueMap = .empty, |
| 125 | 125 | |
| 126 | 126 | pub const genIr = CodeGen.genIr; |
lib/compiler/aro/aro/TypeStore.zig+13-13| ... | ... | @@ -1216,6 +1216,13 @@ pub const QualType = packed struct(u32) { |
| 1216 | 1216 | return false; |
| 1217 | 1217 | }, |
| 1218 | 1218 | .array => |array| { |
| 1219 | if (qt.@"const") { | |
| 1220 | try w.writeAll("const "); | |
| 1221 | } | |
| 1222 | if (qt.@"volatile") { | |
| 1223 | try w.writeAll("volatile"); | |
| 1224 | } | |
| 1225 | ||
| 1219 | 1226 | const simple = try array.elem.printPrologue(comp, desugar, w); |
| 1220 | 1227 | if (simple) try w.writeByte(' '); |
| 1221 | 1228 | return false; |
| ... | ... | @@ -1341,14 +1348,6 @@ pub const QualType = packed struct(u32) { |
| 1341 | 1348 | |
| 1342 | 1349 | const static = array.len == .static; |
| 1343 | 1350 | 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 | } | |
| 1352 | 1351 | if (qt.restrict) { |
| 1353 | 1352 | if (static or qt.@"const" or qt.@"volatile") try w.writeByte(' '); |
| 1354 | 1353 | try w.writeAll("restrict"); |
| ... | ... | @@ -1694,8 +1693,8 @@ pub const Type = union(enum) { |
| 1694 | 1693 | }; |
| 1695 | 1694 | |
| 1696 | 1695 | types: std.MultiArrayList(Repr) = .empty, |
| 1697 | extra: std.ArrayListUnmanaged(u32) = .empty, | |
| 1698 | attributes: std.ArrayListUnmanaged(Attribute) = .empty, | |
| 1696 | extra: std.ArrayList(u32) = .empty, | |
| 1697 | attributes: std.ArrayList(Attribute) = .empty, | |
| 1699 | 1698 | anon_name_arena: std.heap.ArenaAllocator.State = .{}, |
| 1700 | 1699 | |
| 1701 | 1700 | wchar: QualType = .invalid, |
| ... | ... | @@ -2435,7 +2434,7 @@ pub const Builder = struct { |
| 2435 | 2434 | } |
| 2436 | 2435 | if (b.complex_tok) |tok| try b.parser.err(tok, .complex_int, .{}); |
| 2437 | 2436 | |
| 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 = .{ | |
| 2439 | 2438 | .signedness = if (unsigned) .unsigned else .signed, |
| 2440 | 2439 | .bits = @intCast(bits), |
| 2441 | 2440 | } }); |
| ... | ... | @@ -2476,6 +2475,7 @@ pub const Builder = struct { |
| 2476 | 2475 | |
| 2477 | 2476 | pub fn finishQuals(b: Builder, qt: QualType) !QualType { |
| 2478 | 2477 | if (qt.isInvalid()) return .invalid; |
| 2478 | const gpa = b.parser.comp.gpa; | |
| 2479 | 2479 | var result_qt = qt; |
| 2480 | 2480 | if (b.atomic_type orelse b.atomic) |atomic_tok| { |
| 2481 | 2481 | if (result_qt.isAutoType()) return b.parser.todo("_Atomic __auto_type"); |
| ... | ... | @@ -2505,7 +2505,7 @@ pub const Builder = struct { |
| 2505 | 2505 | return .invalid; |
| 2506 | 2506 | }, |
| 2507 | 2507 | 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 }); | |
| 2509 | 2509 | }, |
| 2510 | 2510 | } |
| 2511 | 2511 | } |
| ... | ... | @@ -2514,7 +2514,7 @@ pub const Builder = struct { |
| 2514 | 2514 | const is_pointer = qt.isAutoType() or qt.isC23Auto() or qt.base(b.parser.comp).type == .pointer; |
| 2515 | 2515 | |
| 2516 | 2516 | 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 = .{ | |
| 2518 | 2518 | .base = result_qt, |
| 2519 | 2519 | .attributes = &.{.{ .tag = .unaligned, .args = .{ .unaligned = .{} }, .syntax = .keyword }}, |
| 2520 | 2520 | } })).withQualifiers(result_qt); |
lib/compiler/aro/aro/pragmas/gcc.zig+2-2| ... | ... | @@ -20,7 +20,7 @@ pragma: Pragma = .{ |
| 20 | 20 | .preserveTokens = preserveTokens, |
| 21 | 21 | }, |
| 22 | 22 | original_state: Diagnostics.State = .{}, |
| 23 | state_stack: std.ArrayListUnmanaged(Diagnostics.State) = .{}, | |
| 23 | state_stack: std.ArrayList(Diagnostics.State) = .empty, | |
| 24 | 24 | |
| 25 | 25 | const Directive = enum { |
| 26 | 26 | warning, |
| ... | ... | @@ -138,7 +138,7 @@ fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex |
| 138 | 138 | if (pp.defines.get(str) != null) { |
| 139 | 139 | try Pragma.err(pp, start_idx + i, .pragma_poison_macro, .{}); |
| 140 | 140 | } |
| 141 | try pp.poisoned_identifiers.put(str, {}); | |
| 141 | try pp.poisoned_identifiers.put(pp.comp.gpa, str, {}); | |
| 142 | 142 | } |
| 143 | 143 | return; |
| 144 | 144 | }, |
lib/compiler/aro/aro/pragmas/message.zig+1-1| ... | ... | @@ -44,7 +44,7 @@ fn preprocessorHandler(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pra |
| 44 | 44 | |
| 45 | 45 | const diagnostic: Pragma.Diagnostic = .pragma_message; |
| 46 | 46 | |
| 47 | var sf = std.heap.stackFallback(1024, pp.gpa); | |
| 47 | var sf = std.heap.stackFallback(1024, pp.comp.gpa); | |
| 48 | 48 | var allocating: std.Io.Writer.Allocating = .init(sf.get()); |
| 49 | 49 | defer allocating.deinit(); |
| 50 | 50 |
lib/compiler/aro/aro/pragmas/once.zig+5-6| ... | ... | @@ -17,14 +17,12 @@ pragma: Pragma = .{ |
| 17 | 17 | .preprocessorHandler = preprocessorHandler, |
| 18 | 18 | .preserveTokens = preserveTokens, |
| 19 | 19 | }, |
| 20 | pragma_once: std.AutoHashMap(Source.Id, void), | |
| 20 | pragma_once: std.AutoHashMapUnmanaged(Source.Id, void) = .empty, | |
| 21 | 21 | preprocess_count: u32 = 0, |
| 22 | 22 | |
| 23 | 23 | pub fn init(allocator: mem.Allocator) !*Pragma { |
| 24 | 24 | var once = try allocator.create(Once); |
| 25 | once.* = .{ | |
| 26 | .pragma_once = std.AutoHashMap(Source.Id, void).init(allocator), | |
| 27 | }; | |
| 25 | once.* = .{}; | |
| 28 | 26 | return &once.pragma; |
| 29 | 27 | } |
| 30 | 28 | |
| ... | ... | @@ -35,8 +33,9 @@ fn afterParse(pragma: *Pragma, _: *Compilation) void { |
| 35 | 33 | |
| 36 | 34 | fn deinit(pragma: *Pragma, comp: *Compilation) void { |
| 37 | 35 | var self: *Once = @fieldParentPtr("pragma", pragma); |
| 38 | self.pragma_once.deinit(); | |
| 36 | self.pragma_once.deinit(comp.gpa); | |
| 39 | 37 | comp.gpa.destroy(self); |
| 38 | pragma.* = undefined; | |
| 40 | 39 | } |
| 41 | 40 | |
| 42 | 41 | fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { |
| ... | ... | @@ -53,7 +52,7 @@ fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex |
| 53 | 52 | }, pp.expansionSlice(start_idx + 1), true); |
| 54 | 53 | } |
| 55 | 54 | 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, {}); | |
| 57 | 56 | if (prev != null and !seen) { |
| 58 | 57 | return error.StopPreprocessing; |
| 59 | 58 | } |
lib/compiler/aro/aro/pragmas/pack.zig+2-2| ... | ... | @@ -15,7 +15,7 @@ pragma: Pragma = .{ |
| 15 | 15 | .deinit = deinit, |
| 16 | 16 | .parserHandler = parserHandler, |
| 17 | 17 | }, |
| 18 | stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{}, | |
| 18 | stack: std.ArrayList(struct { label: []const u8, val: u8 }) = .empty, | |
| 19 | 19 | |
| 20 | 20 | pub fn init(allocator: mem.Allocator) !*Pragma { |
| 21 | 21 | var pack = try allocator.create(Pack); |
| ... | ... | @@ -82,7 +82,7 @@ fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | 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 }); | |
| 86 | 86 | } else { |
| 87 | 87 | pack.pop(p, label); |
| 88 | 88 | 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 { |
| 70 | 70 | const loc: Source.Location = c.tree.tokens.items(.loc)[tok]; |
| 71 | 71 | |
| 72 | 72 | 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); | |
| 75 | 76 | |
| 76 | try buf.print("TODO: {s}", .{msg}); | |
| 77 | try buf.print(allocator, "TODO: {s}", .{msg}); | |
| 77 | 78 | try c.comp.diagnostics.add(.{ |
| 78 | 79 | .text = buf.items, |
| 79 | 80 | .kind = .@"error", |
| ... | ... | @@ -163,7 +164,7 @@ pub fn genAsm(tree: *const Tree) Error!Assembly { |
| 163 | 164 | } |
| 164 | 165 | |
| 165 | 166 | fn genDecls(c: *AsmCodeGen) !void { |
| 166 | if (c.tree.comp.code_gen_options.debug) { | |
| 167 | if (c.tree.comp.code_gen_options.debug != .strip) { | |
| 167 | 168 | const sources = c.tree.comp.sources.values(); |
| 168 | 169 | for (sources) |source| { |
| 169 | 170 | 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 { |
| 66 | 66 | pub fn fromString(str: []const u8) ?OptimizationLevel { |
| 67 | 67 | return level_map.get(str); |
| 68 | 68 | } |
| 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 | } | |
| 69 | 83 | }; |
| 70 | 84 | |
| 71 | 85 | pub const default: @This() = .{ |
lib/compiler/aro/backend/Interner.zig+5-5| ... | ... | @@ -8,14 +8,14 @@ const Limb = std.math.big.Limb; |
| 8 | 8 | |
| 9 | 9 | const Interner = @This(); |
| 10 | 10 | |
| 11 | map: std.AutoArrayHashMapUnmanaged(void, void) = .{}, | |
| 11 | map: std.AutoArrayHashMapUnmanaged(void, void) = .empty, | |
| 12 | 12 | items: std.MultiArrayList(struct { |
| 13 | 13 | tag: Tag, |
| 14 | 14 | data: u32, |
| 15 | }) = .{}, | |
| 16 | extra: std.ArrayListUnmanaged(u32) = .{}, | |
| 17 | limbs: std.ArrayListUnmanaged(Limb) = .{}, | |
| 18 | strings: std.ArrayListUnmanaged(u8) = .{}, | |
| 15 | }) = .empty, | |
| 16 | extra: std.ArrayList(u32) = .empty, | |
| 17 | limbs: std.ArrayList(Limb) = .empty, | |
| 18 | strings: std.ArrayList(u8) = .empty, | |
| 19 | 19 | |
| 20 | 20 | const KeyAdapter = struct { |
| 21 | 21 | interner: *const Interner, |
lib/compiler/aro/backend/Ir.zig+20-20| ... | ... | @@ -11,7 +11,7 @@ decls: std.StringArrayHashMapUnmanaged(Decl), |
| 11 | 11 | |
| 12 | 12 | pub const Decl = struct { |
| 13 | 13 | instructions: std.MultiArrayList(Inst), |
| 14 | body: std.ArrayListUnmanaged(Ref), | |
| 14 | body: std.ArrayList(Ref), | |
| 15 | 15 | arena: std.heap.ArenaAllocator.State, |
| 16 | 16 | |
| 17 | 17 | pub fn deinit(decl: *Decl, gpa: Allocator) void { |
| ... | ... | @@ -26,9 +26,9 @@ pub const Builder = struct { |
| 26 | 26 | arena: std.heap.ArenaAllocator, |
| 27 | 27 | interner: *Interner, |
| 28 | 28 | |
| 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, | |
| 32 | 32 | alloc_count: u32 = 0, |
| 33 | 33 | arg_count: u32 = 0, |
| 34 | 34 | current_label: Ref = undefined, |
| ... | ... | @@ -380,7 +380,7 @@ const REF = std.Io.tty.Color.bright_blue; |
| 380 | 380 | const LITERAL = std.Io.tty.Color.bright_green; |
| 381 | 381 | const ATTRIBUTE = std.Io.tty.Color.bright_yellow; |
| 382 | 382 | |
| 383 | const RefMap = std.AutoArrayHashMap(Ref, void); | |
| 383 | const RefMap = std.AutoArrayHashMapUnmanaged(Ref, void); | |
| 384 | 384 | |
| 385 | 385 | pub fn dump(ir: *const Ir, gpa: Allocator, config: std.Io.tty.Config, w: *std.Io.Writer) !void { |
| 386 | 386 | 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, |
| 393 | 393 | const tags = decl.instructions.items(.tag); |
| 394 | 394 | const data = decl.instructions.items(.data); |
| 395 | 395 | |
| 396 | var ref_map = RefMap.init(gpa); | |
| 397 | defer ref_map.deinit(); | |
| 396 | var ref_map: RefMap = .empty; | |
| 397 | defer ref_map.deinit(gpa); | |
| 398 | 398 | |
| 399 | var label_map = RefMap.init(gpa); | |
| 400 | defer label_map.deinit(); | |
| 399 | var label_map: RefMap = .empty; | |
| 400 | defer label_map.deinit(gpa); | |
| 401 | 401 | |
| 402 | 402 | const ret_inst = decl.body.items[decl.body.items.len - 1]; |
| 403 | 403 | 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, |
| 413 | 413 | const ref = decl.body.items[arg_count]; |
| 414 | 414 | if (tags[@intFromEnum(ref)] != .arg) break; |
| 415 | 415 | if (arg_count != 0) try w.writeAll(", "); |
| 416 | try ref_map.put(ref, {}); | |
| 416 | try ref_map.put(gpa, ref, {}); | |
| 417 | 417 | try ir.writeRef(decl, &ref_map, ref, config, w); |
| 418 | 418 | try config.setColor(w, .reset); |
| 419 | 419 | } |
| 420 | 420 | try w.writeAll(") {\n"); |
| 421 | 421 | for (decl.body.items[arg_count..]) |ref| { |
| 422 | 422 | switch (tags[@intFromEnum(ref)]) { |
| 423 | .label => try label_map.put(ref, {}), | |
| 423 | .label => try label_map.put(gpa, ref, {}), | |
| 424 | 424 | else => {}, |
| 425 | 425 | } |
| 426 | 426 | } |
| ... | ... | @@ -461,7 +461,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 461 | 461 | }, |
| 462 | 462 | .select => { |
| 463 | 463 | 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); | |
| 465 | 465 | try w.writeAll("select "); |
| 466 | 466 | try ir.writeRef(decl, &ref_map, br.cond, config, w); |
| 467 | 467 | try config.setColor(w, .reset); |
| ... | ... | @@ -501,7 +501,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 501 | 501 | }, |
| 502 | 502 | .call => { |
| 503 | 503 | 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); | |
| 505 | 505 | try w.writeAll("call "); |
| 506 | 506 | try ir.writeRef(decl, &ref_map, call.func, config, w); |
| 507 | 507 | try config.setColor(w, .reset); |
| ... | ... | @@ -515,7 +515,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 515 | 515 | }, |
| 516 | 516 | .alloc => { |
| 517 | 517 | 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); | |
| 519 | 519 | try w.writeAll("alloc "); |
| 520 | 520 | try config.setColor(w, ATTRIBUTE); |
| 521 | 521 | try w.writeAll("size "); |
| ... | ... | @@ -528,7 +528,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 528 | 528 | try w.writeByte('\n'); |
| 529 | 529 | }, |
| 530 | 530 | .phi => { |
| 531 | try ir.writeNewRef(decl, &ref_map, ref, config, w); | |
| 531 | try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w); | |
| 532 | 532 | try w.writeAll("phi"); |
| 533 | 533 | try config.setColor(w, .reset); |
| 534 | 534 | try w.writeAll(" {"); |
| ... | ... | @@ -560,7 +560,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 560 | 560 | try w.writeByte('\n'); |
| 561 | 561 | }, |
| 562 | 562 | .load => { |
| 563 | try ir.writeNewRef(decl, &ref_map, ref, config, w); | |
| 563 | try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w); | |
| 564 | 564 | try w.writeAll("load "); |
| 565 | 565 | try ir.writeRef(decl, &ref_map, data[i].un, config, w); |
| 566 | 566 | try w.writeByte('\n'); |
| ... | ... | @@ -583,7 +583,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 583 | 583 | .mod, |
| 584 | 584 | => { |
| 585 | 585 | 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); | |
| 587 | 587 | try w.print("{s} ", .{@tagName(tag)}); |
| 588 | 588 | try ir.writeRef(decl, &ref_map, bin.lhs, config, w); |
| 589 | 589 | try config.setColor(w, .reset); |
| ... | ... | @@ -598,7 +598,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 598 | 598 | .sext, |
| 599 | 599 | => { |
| 600 | 600 | 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); | |
| 602 | 602 | try w.print("{s} ", .{@tagName(tag)}); |
| 603 | 603 | try ir.writeRef(decl, &ref_map, un, config, w); |
| 604 | 604 | try w.writeByte('\n'); |
| ... | ... | @@ -679,8 +679,8 @@ fn writeRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, config: std.I |
| 679 | 679 | try w.print(" %{d}", .{ref_index}); |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | fn 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, {}); | |
| 682 | fn 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, {}); | |
| 684 | 684 | try w.writeAll(" "); |
| 685 | 685 | try ir.writeRef(decl, ref_map, ref, config, w); |
| 686 | 686 | try config.setColor(w, .reset); |
lib/compiler/aro/backend/Object.zig+1-1| ... | ... | @@ -30,7 +30,7 @@ pub const Section = union(enum) { |
| 30 | 30 | custom: []const u8, |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | pub fn getSection(obj: *Object, section: Section) !*std.array_list.Managed(u8) { | |
| 33 | pub fn getSection(obj: *Object, section: Section) !*std.ArrayList(u8) { | |
| 34 | 34 | switch (obj.format) { |
| 35 | 35 | .elf => return @as(*Elf, @alignCast(@fieldParentPtr("obj", obj))).getSection(section), |
| 36 | 36 | else => unreachable, |
lib/compiler/aro/backend/Object/Elf.zig+8-8| ... | ... | @@ -4,8 +4,8 @@ const Target = std.Target; |
| 4 | 4 | const Object = @import("../Object.zig"); |
| 5 | 5 | |
| 6 | 6 | const 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, | |
| 9 | 9 | flags: u64, |
| 10 | 10 | type: u32, |
| 11 | 11 | index: u16 = undefined, |
| ... | ... | @@ -37,9 +37,9 @@ const Elf = @This(); |
| 37 | 37 | |
| 38 | 38 | obj: Object, |
| 39 | 39 | /// The keys are owned by the Codegen.tree |
| 40 | sections: std.StringHashMapUnmanaged(*Section) = .{}, | |
| 41 | local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, | |
| 42 | global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, | |
| 40 | sections: std.StringHashMapUnmanaged(*Section) = .empty, | |
| 41 | local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty, | |
| 42 | global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty, | |
| 43 | 43 | unnamed_symbol_mangle: u32 = 0, |
| 44 | 44 | strtab_len: u64 = strtab_default.len, |
| 45 | 45 | arena: std.heap.ArenaAllocator, |
| ... | ... | @@ -58,7 +58,7 @@ pub fn deinit(elf: *Elf) void { |
| 58 | 58 | { |
| 59 | 59 | var it = elf.sections.valueIterator(); |
| 60 | 60 | while (it.next()) |sect| { |
| 61 | sect.*.data.deinit(); | |
| 61 | sect.*.data.deinit(gpa); | |
| 62 | 62 | sect.*.relocations.deinit(gpa); |
| 63 | 63 | } |
| 64 | 64 | } |
| ... | ... | @@ -80,12 +80,12 @@ fn sectionString(sec: Object.Section) []const u8 { |
| 80 | 80 | }; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.array_list.Managed(u8) { | |
| 83 | pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.ArrayList(u8) { | |
| 84 | 84 | const section_name = sectionString(section_kind); |
| 85 | 85 | const section = elf.sections.get(section_name) orelse blk: { |
| 86 | 86 | const section = try elf.arena.allocator().create(Section); |
| 87 | 87 | section.* = .{ |
| 88 | .data = std.array_list.Managed(u8).init(elf.arena.child_allocator), | |
| 88 | .data = std.ArrayList(u8).init(elf.arena.child_allocator), | |
| 89 | 89 | .type = std.elf.SHT_PROGBITS, |
| 90 | 90 | .flags = switch (section_kind) { |
| 91 | 91 | .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 { |
| 150 | 150 | // be written to a tmp file then renamed into place, meaning the path will be |
| 151 | 151 | // wrong as soon as the work is done. |
| 152 | 152 | 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); | |
| 154 | 154 | |
| 155 | 155 | if (opt_dep_file) |*dep_file| pp.dep_file = dep_file; |
| 156 | 156 |