Commit 8cba6b1df8
Changed files (31)
lib
compiler
aro
aro
Attribute
Driver
Parser
Preprocessor
assembly_backend
backend
translate-c
lib/compiler/aro/aro/Attribute/names.zig
@@ -78,6 +78,7 @@ pub const Tag = enum(u16) { aarch64_sve_pcs,
noinit,
@"noinline",
noipa,
+ nonnull,
nonstring,
noplt,
@"noreturn",
@@ -184,7 +185,7 @@ pub const longest_name = 30;
/// If found, returns the index of the node within the `dafsa` array.
/// Otherwise, returns `null`.
pub fn findInList(first_child_index: u16, char: u8) ?u16 {
- @setEvalBranchQuota(230);
+ @setEvalBranchQuota(232);
var index = first_child_index;
while (true) {
if (dafsa[index].char == char) return index;
@@ -290,7 +291,7 @@ const dafsa = [_]Node{
.{ .char = 'j', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 41 },
.{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 42 },
.{ .char = 'm', .end_of_word = false, .end_of_list = false, .number = 5, .child_index = 43 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 25, .child_index = 46 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 26, .child_index = 46 },
.{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 6, .child_index = 48 },
.{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 6, .child_index = 53 },
.{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 11, .child_index = 55 },
@@ -325,7 +326,7 @@ const dafsa = [_]Node{
.{ .char = 'o', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 106 },
.{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 107 },
.{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 108 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 24, .child_index = 109 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 25, .child_index = 109 },
.{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 118 },
.{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 120 },
.{ .char = 'e', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 121 },
@@ -392,574 +393,575 @@ const dafsa = [_]Node{
.{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 198 },
.{ .char = 'd', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 200 },
.{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 3, .child_index = 201 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 203 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 204 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 205 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 206 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 108 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 203 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 205 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 206 },
.{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 207 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 108 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 208 },
.{ .char = 's', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 208 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 209 },
.{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 75 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 209 },
- .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 210 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 211 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 213 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 214 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 215 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 216 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 217 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 218 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 210 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 211 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 212 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 214 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 215 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 216 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 217 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 218 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 219 },
.{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 219 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 220 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 221 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 222 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 223 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 224 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 225 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 226 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 227 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 228 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 229 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 230 },
- .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 231 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 232 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 220 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 221 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 222 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 223 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 224 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 225 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 226 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 227 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 228 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 229 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 230 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 231 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 232 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 233 },
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
.{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 233 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 234 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 235 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 236 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 237 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 238 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 239 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 234 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 235 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 236 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 237 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 238 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 239 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 240 },
.{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 120 },
- .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 240 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 241 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 242 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 243 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 244 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 245 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 248 },
+ .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 241 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 242 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 243 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 244 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 245 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 248 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 249 },
.{ .char = 'd', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 249 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 250 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 250 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 251 },
.{ .char = 'y', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 251 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 252 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 253 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 254 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 255 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 258 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 221 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 259 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 260 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 261 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 263 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 264 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 252 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 253 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 254 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 255 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 258 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 259 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 222 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 260 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 261 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 264 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 265 },
.{ .char = 'f', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 265 },
- .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 266 },
- .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 267 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 266 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 267 },
+ .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 268 },
.{ .char = 'e', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 268 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 269 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 270 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 272 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 273 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 8, .child_index = 274 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 277 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 278 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 279 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 280 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 281 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 283 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 284 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 269 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 270 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 271 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 273 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 274 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 8, .child_index = 275 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 278 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 279 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 280 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 281 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 282 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 284 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 285 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 286 },
.{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 285 },
- .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 286 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 287 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 288 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 289 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 290 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 291 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 292 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 293 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 294 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 295 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 296 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 297 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 287 },
+ .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 288 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 289 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 290 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 291 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 292 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 293 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 294 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 295 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 296 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 297 },
.{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 298 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 299 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 300 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 299 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 300 },
.{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 301 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 303 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
.{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 107 },
- .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 303 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 221 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 305 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 306 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 307 },
+ .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 305 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 222 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 306 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 307 },
.{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 308 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 309 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 309 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 310 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 311 },
.{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 310 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 311 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 312 },
- .{ .char = 'k', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 314 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 315 },
- .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 316 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 312 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 313 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 3, .child_index = 314 },
+ .{ .char = 'k', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 316 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 317 },
+ .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 318 },
.{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
- .{ .char = 'n', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 317 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 318 },
- .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 320 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 321 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 322 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 323 },
+ .{ .char = 'n', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 319 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 320 },
+ .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 322 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 323 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 324 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 325 },
.{ .char = 'l', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 324 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 325 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
- .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 327 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
- .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 329 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 330 },
- .{ .char = 'x', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 331 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 331 },
- .{ .char = 'r', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 327 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
+ .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 329 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 330 },
+ .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 331 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 332 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 333 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 334 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 335 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 336 },
+ .{ .char = 'x', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 333 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 333 },
+ .{ .char = 'r', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 334 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 335 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 336 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 337 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 338 },
.{ .char = 'c', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 337 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 338 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 339 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 340 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
.{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 197 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 339 },
- .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 340 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 341 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 341 },
+ .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 342 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 343 },
.{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 186 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 342 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 343 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 5, .child_index = 345 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 346 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 347 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 348 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 349 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 345 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 346 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 5, .child_index = 347 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 348 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 349 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 350 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
.{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 168 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 350 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 352 },
.{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 99 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 353 },
.{ .char = 'a', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 352 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 353 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 354 },
- .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 355 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 356 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 357 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 358 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 359 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 360 },
- .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 361 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 362 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 249 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 363 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 364 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 354 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 355 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 356 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 357 },
+ .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 358 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 359 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 360 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 361 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 362 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 363 },
+ .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 364 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 365 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 250 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 366 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 367 },
.{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 123 },
- .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 365 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 366 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 367 },
+ .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 368 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 354 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 369 },
.{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 368 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 369 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 370 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 371 },
- .{ .char = 'q', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 372 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 373 },
- .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 374 },
- .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 375 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 377 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 378 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 379 },
- .{ .char = '6', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 380 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 370 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 371 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 372 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 373 },
+ .{ .char = 'q', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 374 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 375 },
+ .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 376 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 377 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 379 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 380 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 381 },
+ .{ .char = '6', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 382 },
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
- .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 381 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 383 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 2, .child_index = 383 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 385 },
.{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 182 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 384 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 385 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 386 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 387 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 388 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 386 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 387 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 388 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 389 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 390 },
.{ .char = 'n', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 330 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 389 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 390 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 391 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 392 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 393 },
- .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 394 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
- .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 395 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 396 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 397 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 398 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 399 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 332 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 391 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 392 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 393 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 394 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 395 },
+ .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 396 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
+ .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 397 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 398 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 399 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 400 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 401 },
.{ .char = 'i', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 400 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 401 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 402 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 403 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 404 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 405 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 406 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 402 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 403 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 404 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 405 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 406 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 407 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 408 },
.{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
.{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 407 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 349 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 408 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 409 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 410 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 411 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 412 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 413 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 414 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 415 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 416 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 417 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 418 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 419 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 420 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 421 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
- .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 422 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 423 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 424 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 425 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 426 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 427 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 428 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 430 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 431 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 432 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 433 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 409 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 410 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 411 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 412 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 413 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 414 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 415 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 416 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 417 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 418 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 419 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 420 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 421 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 422 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 423 },
+ .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 424 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 425 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 426 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 427 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 428 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 429 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 430 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 432 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 433 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 434 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 435 },
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 186 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 434 },
- .{ .char = '4', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 435 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 436 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 437 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 438 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 291 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 440 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 441 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 436 },
+ .{ .char = '4', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 437 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 438 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 439 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 440 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 293 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 442 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 443 },
.{ .char = 'p', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 433 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 442 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 443 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 444 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 445 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 446 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 447 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 448 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 351 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 449 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 450 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 451 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 435 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 444 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 445 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 446 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 447 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 448 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 449 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 450 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 353 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 451 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 452 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 453 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 454 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 455 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 456 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 457 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 458 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 459 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 377 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 453 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 454 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 455 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 456 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 457 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 458 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 459 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 460 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 461 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 379 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
.{ .char = 'w', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 460 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 461 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 462 },
+ .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 462 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 463 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 464 },
.{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 463 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 464 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 465 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 466 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 467 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 468 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 469 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 420 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 470 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 471 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 472 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 473 },
- .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 474 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 301 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 475 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 476 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 477 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 465 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 466 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 467 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 468 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 469 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 470 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 471 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 422 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 472 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 473 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 474 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 475 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 476 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 303 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 477 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 478 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 479 },
.{ .char = 'g', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 478 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 479 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 481 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 482 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 480 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 481 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 483 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 484 },
.{ .char = 'e', .end_of_word = true, .end_of_list = false, .number = 1, .child_index = 0 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 256 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 483 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 484 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 257 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 485 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 486 },
.{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 485 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 487 },
.{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 176 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 486 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 487 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 488 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 489 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 490 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 491 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 492 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 493 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 494 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 495 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 496 },
- .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 497 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 488 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 489 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 490 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 491 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 492 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 493 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 494 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 495 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 496 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 497 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 498 },
+ .{ .char = 'k', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 499 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 167 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 498 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 499 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 500 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 501 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 503 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 504 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 505 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 500 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 501 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 502 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 503 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 505 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 506 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 507 },
.{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 170 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 506 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 507 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 508 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 509 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 510 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 511 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 437 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 512 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 513 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 514 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 515 },
- .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 516 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 517 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 518 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 509 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 510 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 511 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 512 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 513 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 439 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 514 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 515 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 516 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 517 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 518 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 519 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 520 },
.{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 246 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 519 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 520 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 247 },
.{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 521 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 522 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 433 },
- .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 523 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 524 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 232 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 525 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 526 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 527 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 528 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 529 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 530 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 532 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 522 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 523 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 524 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 435 },
+ .{ .char = 't', .end_of_word = true, .end_of_list = true, .number = 2, .child_index = 525 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 526 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 233 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 527 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 528 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 529 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 530 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 531 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 2, .child_index = 532 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 534 },
.{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 509 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 533 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 534 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 535 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 536 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 537 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 538 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 539 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 540 },
- .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 541 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 542 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 511 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 535 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 536 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 537 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 538 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 539 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 540 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 541 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 542 },
+ .{ .char = 'b', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 543 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 544 },
.{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
.{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 170 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 543 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 544 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 545 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 546 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 547 },
- .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 326 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 548 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 549 },
- .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 550 },
- .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 551 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 552 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 553 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 554 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 555 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 556 },
- .{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 557 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 558 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 559 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 560 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 561 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 562 },
- .{ .char = 'w', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 563 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 564 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 565 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 545 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 546 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 547 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 548 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 549 },
+ .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 328 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 550 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 551 },
+ .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 552 },
+ .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 553 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 554 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 555 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 556 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 557 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 558 },
+ .{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 5, .child_index = 559 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 560 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 561 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 562 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 563 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 564 },
+ .{ .char = 'w', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 565 },
.{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 566 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
.{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 567 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 568 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 568 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 569 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 570 },
.{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 569 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 570 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 571 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 572 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 571 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 572 },
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 573 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 574 },
- .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 576 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 577 },
- .{ .char = 'h', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 578 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 574 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 576 },
+ .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 577 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 578 },
.{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 579 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 580 },
+ .{ .char = 'h', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
+ .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 580 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
.{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 581 },
- .{ .char = 'e', .end_of_word = true, .end_of_list = true, .number = 5, .child_index = 582 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 583 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 584 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 585 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 586 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 587 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 588 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 589 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 590 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 414 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 591 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 592 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 582 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 583 },
+ .{ .char = 'e', .end_of_word = true, .end_of_list = true, .number = 5, .child_index = 584 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 585 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 586 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 587 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 588 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 589 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 590 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 591 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 592 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 416 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 593 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 594 },
.{ .char = 'z', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 386 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 593 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 594 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 595 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 596 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 388 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 595 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 596 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 597 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 598 },
.{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 148 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 597 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 598 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 599 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 600 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 601 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 602 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 603 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 607 },
- .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 608 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 609 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 610 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 611 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 599 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 600 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 601 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 602 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 603 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 604 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 4, .child_index = 605 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 609 },
+ .{ .char = 'm', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 610 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 611 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 612 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 285 },
.{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 612 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 613 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 613 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 614 },
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 614 },
.{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 615 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 616 },
- .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 617 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 618 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 608 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 619 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 620 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 621 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 622 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 342 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 623 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 624 },
- .{ .char = 't', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 625 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 626 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 627 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 616 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 617 },
+ .{ .char = 'p', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 618 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 619 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 610 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 620 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 621 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 622 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 623 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 624 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 625 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = false, .number = 1, .child_index = 626 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 627 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 628 },
.{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 99 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 628 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 629 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 366 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 630 },
- .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 631 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 632 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 633 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 634 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 629 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 630 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 631 },
+ .{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 632 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 633 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 634 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 635 },
.{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 573 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 500 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 635 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 636 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 637 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 638 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 639 },
- .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 640 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 641 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 502 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 636 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 637 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 638 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 639 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 640 },
+ .{ .char = 'h', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 641 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 642 },
.{ .char = 'k', .end_of_word = true, .end_of_list = true, .number = 1, .child_index = 0 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 391 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 642 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 262 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 643 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 296 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 393 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 643 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 263 },
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 644 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 645 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 302 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 646 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 647 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 648 },
- .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 649 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 226 },
- .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 650 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 651 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 344 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 652 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 653 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 654 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 655 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 298 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 645 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 646 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 304 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 647 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 648 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 649 },
+ .{ .char = 'v', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 650 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 227 },
+ .{ .char = 'd', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 651 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 652 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 346 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 653 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 654 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 655 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 656 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 156 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 656 },
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 657 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 658 },
- .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 204 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 659 },
- .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 660 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 661 },
- .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 662 },
- .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 663 },
- .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 664 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 665 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 666 },
- .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 216 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 667 },
- .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 575 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 668 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 658 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 659 },
+ .{ .char = 'u', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 205 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 660 },
+ .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 661 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 662 },
+ .{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 663 },
+ .{ .char = 'f', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 664 },
+ .{ .char = 'o', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 665 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 666 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 667 },
+ .{ .char = 'c', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 217 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 668 },
+ .{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 577 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 669 },
.{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 669 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 670 },
.{ .char = 'g', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 190 },
- .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 670 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 671 },
- .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 672 },
- .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 673 },
- .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 674 },
- .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 675 },
- .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 676 },
- .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 677 },
+ .{ .char = '_', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 671 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 672 },
+ .{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 673 },
+ .{ .char = 'a', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 674 },
+ .{ .char = 'n', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 675 },
+ .{ .char = 'l', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 676 },
+ .{ .char = 't', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 677 },
+ .{ .char = 'y', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 678 },
.{ .char = 'r', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 170 },
- .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 678 },
+ .{ .char = 's', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 679 },
.{ .char = 'i', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 120 },
};
pub const data = blk: {
- @setEvalBranchQuota(805);
+ @setEvalBranchQuota(812);
break :blk [_]@This(){
.{ .tag = .aarch64_sve_pcs, .properties = .{ .tag = .aarch64_sve_pcs, .gnu = true } },
.{ .tag = .aarch64_vector_pcs, .properties = .{ .tag = .aarch64_vector_pcs, .gnu = true } },
@@ -1028,6 +1030,7 @@ pub const data = blk: {
.{ .tag = .noinit, .properties = .{ .tag = .noinit, .gnu = true } },
.{ .tag = .@"noinline", .properties = .{ .tag = .@"noinline", .gnu = true, .declspec = true } },
.{ .tag = .noipa, .properties = .{ .tag = .noipa, .gnu = true } },
+ .{ .tag = .nonnull, .properties = .{ .tag = .nonnull, .gnu = true } },
.{ .tag = .nonstring, .properties = .{ .tag = .nonstring, .gnu = true } },
.{ .tag = .noplt, .properties = .{ .tag = .noplt, .gnu = true } },
.{ .tag = .@"noreturn", .properties = .{ .tag = .@"noreturn", .c23 = true, .gnu = true, .declspec = true } },
lib/compiler/aro/aro/Driver/Multilib.zig
@@ -1,47 +1,50 @@
const std = @import("std");
const Filesystem = @import("Filesystem.zig").Filesystem;
-pub const Flags = std.ArrayListUnmanaged([]const u8);
-
/// Large enough for GCCDetector for Linux; may need to be increased to support other toolchains.
const max_multilibs = 4;
-const MultilibArray = std.ArrayListUnmanaged(Multilib);
-
pub const Detected = struct {
- multilibs: MultilibArray = .{},
+ multilib_buf: [max_multilibs]Multilib = undefined,
+ multilib_count: u8 = 0,
selected: Multilib = .{},
biarch_sibling: ?Multilib = null,
- pub fn filter(self: *Detected, multilib_filter: Filter, fs: Filesystem) void {
- var found_count: usize = 0;
- for (self.multilibs.items) |multilib| {
+ pub fn filter(d: *Detected, multilib_filter: Filter, fs: Filesystem) void {
+ var found_count: u8 = 0;
+ for (d.multilibs()) |multilib| {
if (multilib_filter.exists(multilib, fs)) {
- self.multilibs.items[found_count] = multilib;
+ d.multilib_buf[found_count] = multilib;
found_count += 1;
}
}
- self.multilibs.resize(found_count) catch unreachable;
+ d.multilib_count = found_count;
}
- pub fn select(self: *Detected, flags: []const []const Flags) !bool {
- var filtered: MultilibArray = .{};
- for (self.multilibs.items) |multilib| {
- for (flags) |multilib_flag| {
- const matched = for (flags) |arg_flag| {
+ pub fn select(d: *Detected, check_flags: []const []const u8) !bool {
+ var selected: ?Multilib = null;
+
+ for (d.multilibs()) |multilib| {
+ for (multilib.flags()) |multilib_flag| {
+ const matched = for (check_flags) |arg_flag| {
if (std.mem.eql(u8, arg_flag[1..], multilib_flag[1..])) break arg_flag;
} else multilib_flag;
if (matched[0] != multilib_flag[0]) break;
+ } else if (selected != null) {
+ return error.TooManyMultilibs;
} else {
- filtered.appendAssumeCapacity(multilib);
+ selected = multilib;
}
}
- if (filtered.len == 0) return false;
- if (filtered.len == 1) {
- self.selected = filtered.get(0);
+ if (selected) |multilib| {
+ d.selected = multilib;
return true;
}
- return error.TooManyMultilibs;
+ return false;
+ }
+
+ pub fn multilibs(d: *const Detected) []const Multilib {
+ return d.multilib_buf[0..d.multilib_count];
}
};
@@ -58,14 +61,20 @@ const Multilib = @This();
gcc_suffix: []const u8 = "",
os_suffix: []const u8 = "",
include_suffix: []const u8 = "",
-flags: Flags = .{},
+flag_buf: [6][]const u8 = undefined,
+flag_count: u8 = 0,
priority: u32 = 0,
-pub fn init(gcc_suffix: []const u8, os_suffix: []const u8, flags: []const []const u8) Multilib {
+pub fn init(gcc_suffix: []const u8, os_suffix: []const u8, init_flags: []const []const u8) Multilib {
var self: Multilib = .{
.gcc_suffix = gcc_suffix,
.os_suffix = os_suffix,
+ .flag_count = @intCast(init_flags.len),
};
- self.flags.appendSliceAssumeCapacity(flags);
+ @memcpy(self.flag_buf[0..init_flags.len], init_flags);
return self;
}
+
+pub fn flags(m: *const Multilib) []const []const u8 {
+ return m.flag_buf[0..m.flag_count];
+}
lib/compiler/aro/aro/Parser/Diagnostic.zig
@@ -2304,6 +2304,7 @@ pub const overflow_result_requires_ptr: Diagnostic = .{
pub const attribute_todo: Diagnostic = .{
.fmt = "TODO: implement '{s}' attribute for {s}",
.kind = .warning,
+ .opt = .@"attribute-todo",
};
pub const invalid_type_underlying_enum: Diagnostic = .{
@@ -2395,3 +2396,29 @@ pub const invalid_nullability: Diagnostic = .{
.fmt = "nullability specifier cannot be applied to non-pointer type {qt}",
.kind = .@"error",
};
+
+pub const array_not_assignable: Diagnostic = .{
+ .fmt = "array type {qt} is not assignable",
+ .kind = .@"error",
+};
+
+pub const non_object_not_assignable: Diagnostic = .{
+ .fmt = "non-object type {qt} is not assignable",
+ .kind = .@"error",
+};
+
+pub const const_var_assignment: Diagnostic = .{
+ .fmt = "cannot assign to variable '{s}' with const-qualified type {qt}",
+ .kind = .@"error",
+};
+
+pub const declared_const_here: Diagnostic = .{
+ .fmt = "variable '{s}' declared const here",
+ .kind = .note,
+};
+
+pub const nonnull_not_applicable: Diagnostic = .{
+ .fmt = "'nonnull' attribute only applies to functions, methods, and parameters",
+ .kind = .warning,
+ .opt = .@"ignored-attributes",
+};
lib/compiler/aro/aro/pragmas/gcc.zig
@@ -20,7 +20,7 @@ pragma: Pragma = .{
.preserveTokens = preserveTokens,
},
original_state: Diagnostics.State = .{},
-state_stack: std.ArrayListUnmanaged(Diagnostics.State) = .{},
+state_stack: std.ArrayList(Diagnostics.State) = .empty,
const Directive = enum {
warning,
@@ -138,7 +138,7 @@ fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex
if (pp.defines.get(str) != null) {
try Pragma.err(pp, start_idx + i, .pragma_poison_macro, .{});
}
- try pp.poisoned_identifiers.put(str, {});
+ try pp.poisoned_identifiers.put(pp.comp.gpa, str, {});
}
return;
},
lib/compiler/aro/aro/pragmas/message.zig
@@ -44,7 +44,7 @@ fn preprocessorHandler(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pra
const diagnostic: Pragma.Diagnostic = .pragma_message;
- var sf = std.heap.stackFallback(1024, pp.gpa);
+ var sf = std.heap.stackFallback(1024, pp.comp.gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
lib/compiler/aro/aro/pragmas/once.zig
@@ -17,14 +17,12 @@ pragma: Pragma = .{
.preprocessorHandler = preprocessorHandler,
.preserveTokens = preserveTokens,
},
-pragma_once: std.AutoHashMap(Source.Id, void),
+pragma_once: std.AutoHashMapUnmanaged(Source.Id, void) = .empty,
preprocess_count: u32 = 0,
pub fn init(allocator: mem.Allocator) !*Pragma {
var once = try allocator.create(Once);
- once.* = .{
- .pragma_once = std.AutoHashMap(Source.Id, void).init(allocator),
- };
+ once.* = .{};
return &once.pragma;
}
@@ -35,8 +33,9 @@ fn afterParse(pragma: *Pragma, _: *Compilation) void {
fn deinit(pragma: *Pragma, comp: *Compilation) void {
var self: *Once = @fieldParentPtr("pragma", pragma);
- self.pragma_once.deinit();
+ self.pragma_once.deinit(comp.gpa);
comp.gpa.destroy(self);
+ pragma.* = undefined;
}
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
}, pp.expansionSlice(start_idx + 1), true);
}
const seen = self.preprocess_count == pp.preprocess_count;
- const prev = try self.pragma_once.fetchPut(name_tok.loc.id, {});
+ const prev = try self.pragma_once.fetchPut(pp.comp.gpa, name_tok.loc.id, {});
if (prev != null and !seen) {
return error.StopPreprocessing;
}
lib/compiler/aro/aro/pragmas/pack.zig
@@ -15,7 +15,7 @@ pragma: Pragma = .{
.deinit = deinit,
.parserHandler = parserHandler,
},
-stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{},
+stack: std.ArrayList(struct { label: []const u8, val: u8 }) = .empty,
pub fn init(allocator: mem.Allocator) !*Pragma {
var pack = try allocator.create(Pack);
@@ -82,7 +82,7 @@ fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation
}
}
if (action == .push) {
- try pack.stack.append(p.gpa, .{ .label = label orelse "", .val = p.pragma_pack orelse 8 });
+ try pack.stack.append(p.comp.gpa, .{ .label = label orelse "", .val = p.pragma_pack orelse 8 });
} else {
pack.pop(p, label);
if (new_val != null) {
lib/compiler/aro/aro/Preprocessor/Diagnostic.zig
@@ -10,6 +10,7 @@ fmt: []const u8,
kind: Diagnostics.Message.Kind,
opt: ?Diagnostics.Option = null,
extension: bool = false,
+show_in_system_headers: bool = false,
pub const elif_without_if: Diagnostic = .{
.fmt = "#elif without #if",
@@ -91,6 +92,7 @@ pub const warning_directive: Diagnostic = .{
.fmt = "{s}",
.opt = .@"#warnings",
.kind = .warning,
+ .show_in_system_headers = true,
};
pub const macro_name_missing: Diagnostic = .{
@@ -440,3 +442,10 @@ pub const invalid_source_epoch: Diagnostic = .{
.fmt = "environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799",
.kind = .@"error",
};
+
+pub const date_time: Diagnostic = .{
+ .fmt = "expansion of date or time macro is not reproducible",
+ .kind = .off,
+ .opt = .@"date-time",
+ .show_in_system_headers = true,
+};
lib/compiler/aro/aro/Attribute.zig
@@ -345,6 +345,7 @@ fn diagnoseField(
pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, arg_start: TokenIndex, node: Tree.Node, p: *Parser) !bool {
switch (attr) {
+ .nonnull => return false,
inline else => |tag| {
const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
const max_arg_count = comptime maxArgCount(tag);
@@ -532,10 +533,7 @@ const attributes = struct {
pub const @"noinline" = struct {};
pub const noipa = struct {};
// TODO: arbitrary number of arguments
- // const nonnull = struct {
- // // arg_index: []const u32,
- // };
- // };
+ pub const nonnull = struct {};
pub const nonstring = struct {};
pub const noplt = struct {};
pub const @"noreturn" = struct {};
@@ -802,8 +800,16 @@ fn ignoredAttrErr(p: *Parser, tok: TokenIndex, attr: Attribute.Tag, context: []c
try p.errStr(.ignored_attribute, tok, str);
}
-pub const applyParameterAttributes = applyVariableAttributes;
+pub fn applyParameterAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic) !QualType {
+ return applyVariableOrParameterAttributes(p, qt, attr_buf_start, diagnostic, .parameter);
+}
+
pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic) !QualType {
+ return applyVariableOrParameterAttributes(p, qt, attr_buf_start, diagnostic, .variable);
+}
+
+fn applyVariableOrParameterAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic, context: enum { parameter, variable }) !QualType {
+ const gpa = p.comp.gpa;
const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
const toks = p.attr_buf.items(.tok)[attr_buf_start..];
p.attr_application_buf.items.len = 0;
@@ -814,27 +820,33 @@ pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize,
// zig fmt: off
.alias, .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .weak, .used,
.noinit, .retain, .persistent, .section, .mode, .asm_label, .nullability, .unaligned,
- => try p.attr_application_buf.append(p.gpa, attr),
+ => try p.attr_application_buf.append(gpa, attr),
// zig fmt: on
.common => if (nocommon) {
try p.err(tok, .ignore_common, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
common = true;
},
.nocommon => if (common) {
try p.err(tok, .ignore_nocommon, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
nocommon = true;
},
.vector_size => try attr.applyVectorSize(p, tok, &base_qt),
.aligned => try attr.applyAligned(p, base_qt, diagnostic),
+ .nonnull => {
+ switch (context) {
+ .parameter => try p.err(tok, .attribute_todo, .{ "nonnull", "parameters" }),
+ .variable => try p.err(tok, .nonnull_not_applicable, .{}),
+ }
+ },
.nonstring => {
if (base_qt.get(p.comp, .array)) |array_ty| {
if (array_ty.elem.get(p.comp, .int)) |int_ty| switch (int_ty) {
.char, .uchar, .schar => {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
continue;
},
else => {},
@@ -845,12 +857,12 @@ pub fn applyVariableAttributes(p: *Parser, qt: QualType, attr_buf_start: usize,
.uninitialized => if (p.func.qt == null) {
try p.err(tok, .local_variable_attribute, .{"uninitialized"});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
},
.cleanup => if (p.func.qt == null) {
try p.err(tok, .local_variable_attribute, .{"cleanup"});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
},
.calling_convention => try applyCallingConvention(attr, p, tok, base_qt),
.alloc_size,
@@ -873,7 +885,7 @@ pub fn applyFieldAttributes(p: *Parser, field_qt: *QualType, attr_buf_start: usi
// zig fmt: off
.@"packed", .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned,
.mode, .warn_unused_result, .nodiscard, .nullability, .unaligned,
- => try p.attr_application_buf.append(p.gpa, attr),
+ => try p.attr_application_buf.append(p.comp.gpa, attr),
// zig fmt: on
.vector_size => try attr.applyVectorSize(p, tok, field_qt),
.aligned => try attr.applyAligned(p, field_qt.*, null),
@@ -884,6 +896,7 @@ pub fn applyFieldAttributes(p: *Parser, field_qt: *QualType, attr_buf_start: usi
}
pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diagnostic: ?Parser.Diagnostic) !QualType {
+ const gpa = p.comp.gpa;
const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
const toks = p.attr_buf.items(.tok)[attr_buf_start..];
p.attr_application_buf.items.len = 0;
@@ -891,13 +904,13 @@ pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diag
for (attrs, toks) |attr, tok| switch (attr.tag) {
// zig fmt: off
.@"packed", .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .mode, .nullability, .unaligned,
- => try p.attr_application_buf.append(p.gpa, attr),
+ => try p.attr_application_buf.append(gpa, attr),
// zig fmt: on
.transparent_union => try attr.applyTransparentUnion(p, tok, base_qt),
.vector_size => try attr.applyVectorSize(p, tok, &base_qt),
.aligned => try attr.applyAligned(p, base_qt, diagnostic),
.designated_init => if (base_qt.is(p.comp, .@"struct")) {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
} else {
try p.err(tok, .designated_init_invalid, .{});
},
@@ -913,6 +926,7 @@ pub fn applyTypeAttributes(p: *Parser, qt: QualType, attr_buf_start: usize, diag
}
pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize) !QualType {
+ const gpa = p.comp.gpa;
const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
const toks = p.attr_buf.items(.tok)[attr_buf_start..];
p.attr_application_buf.items.len = 0;
@@ -927,37 +941,37 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
.@"const", .warn_unused_result, .section, .returns_nonnull, .returns_twice, .@"error",
.externally_visible, .retain, .flatten, .gnu_inline, .alias, .asm_label, .nodiscard,
.reproducible, .unsequenced, .nothrow, .nullability, .unaligned,
- => try p.attr_application_buf.append(p.gpa, attr),
+ => try p.attr_application_buf.append(gpa, attr),
// zig fmt: on
.hot => if (cold) {
try p.err(tok, .ignore_hot, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
hot = true;
},
.cold => if (hot) {
try p.err(tok, .ignore_cold, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
cold = true;
},
.always_inline => if (@"noinline") {
try p.err(tok, .ignore_always_inline, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
always_inline = true;
},
.@"noinline" => if (always_inline) {
try p.err(tok, .ignore_noinline, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
@"noinline" = true;
},
.aligned => try attr.applyAligned(p, base_qt, null),
.format => try attr.applyFormat(p, base_qt),
.calling_convention => try applyCallingConvention(attr, p, tok, base_qt),
.fastcall => if (p.comp.target.cpu.arch == .x86) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .fastcall } },
.syntax = attr.syntax,
@@ -966,7 +980,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
try p.err(tok, .callconv_not_supported, .{"fastcall"});
},
.stdcall => if (p.comp.target.cpu.arch == .x86) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .stdcall } },
.syntax = attr.syntax,
@@ -975,7 +989,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
try p.err(tok, .callconv_not_supported, .{"stdcall"});
},
.thiscall => if (p.comp.target.cpu.arch == .x86) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .thiscall } },
.syntax = attr.syntax,
@@ -984,7 +998,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
try p.err(tok, .callconv_not_supported, .{"thiscall"});
},
.vectorcall => if (p.comp.target.cpu.arch == .x86 or p.comp.target.cpu.arch.isAARCH64()) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .vectorcall } },
.syntax = attr.syntax,
@@ -994,7 +1008,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
},
.cdecl => {},
.pcs => if (p.comp.target.cpu.arch.isArm()) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = switch (attr.args.pcs.kind) {
.aapcs => .arm_aapcs,
@@ -1006,7 +1020,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
try p.err(tok, .callconv_not_supported, .{"pcs"});
},
.riscv_vector_cc => if (p.comp.target.cpu.arch.isRISCV()) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .riscv_vector } },
.syntax = attr.syntax,
@@ -1015,7 +1029,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
try p.err(tok, .callconv_not_supported, .{"pcs"});
},
.aarch64_sve_pcs => if (p.comp.target.cpu.arch.isAARCH64()) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .aarch64_sve_pcs } },
.syntax = attr.syntax,
@@ -1024,7 +1038,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
try p.err(tok, .callconv_not_supported, .{"pcs"});
},
.aarch64_vector_pcs => if (p.comp.target.cpu.arch.isAARCH64()) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .aarch64_vector_pcs } },
.syntax = attr.syntax,
@@ -1033,14 +1047,14 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
try p.err(tok, .callconv_not_supported, .{"pcs"});
},
.sysv_abi => if (p.comp.target.cpu.arch == .x86_64 and p.comp.target.os.tag == .windows) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .x86_64_sysv } },
.syntax = attr.syntax,
});
},
.ms_abi => if (p.comp.target.cpu.arch == .x86_64 and p.comp.target.os.tag != .windows) {
- try p.attr_application_buf.append(p.gpa, .{
+ try p.attr_application_buf.append(gpa, .{
.tag = .calling_convention,
.args = .{ .calling_convention = .{ .cc = .x86_64_win } },
.syntax = attr.syntax,
@@ -1048,7 +1062,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
},
.malloc => {
if (base_qt.get(p.comp, .func).?.return_type.isPointer(p.comp)) {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
} else {
try ignoredAttrErr(p, tok, attr.tag, "functions that do not return pointers");
}
@@ -1065,7 +1079,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
if (!arg_sk.isInt() or !arg_sk.isReal()) {
try p.err(tok, .alloc_align_required_int_param, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
}
}
} else {
@@ -1098,7 +1112,7 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
.no_stack_protector,
.noclone,
.noipa,
- // .nonnull,
+ .nonnull,
.noplt,
// .optimize,
.patchable_function_entry,
@@ -1118,23 +1132,24 @@ pub fn applyFunctionAttributes(p: *Parser, qt: QualType, attr_buf_start: usize)
}
pub fn applyLabelAttributes(p: *Parser, attr_buf_start: usize) !QualType {
+ const gpa = p.comp.gpa;
const attrs = p.attr_buf.items(.attr)[attr_buf_start..];
const toks = p.attr_buf.items(.tok)[attr_buf_start..];
p.attr_application_buf.items.len = 0;
var hot = false;
var cold = false;
for (attrs, toks) |attr, tok| switch (attr.tag) {
- .unused => try p.attr_application_buf.append(p.gpa, attr),
+ .unused => try p.attr_application_buf.append(gpa, attr),
.hot => if (cold) {
try p.err(tok, .ignore_hot, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
hot = true;
},
.cold => if (hot) {
try p.err(tok, .ignore_cold, .{});
} else {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(gpa, attr);
cold = true;
},
else => try ignoredAttrErr(p, tok, attr.tag, "labels"),
@@ -1151,7 +1166,7 @@ pub fn applyStatementAttributes(p: *Parser, expr_start: TokenIndex, attr_buf_sta
for (p.tok_ids[p.tok_i..]) |tok_id| {
switch (tok_id) {
.keyword_case, .keyword_default, .eof => {
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(p.comp.gpa, attr);
break;
},
.r_brace => {},
@@ -1172,7 +1187,7 @@ pub fn applyEnumeratorAttributes(p: *Parser, qt: QualType, attr_buf_start: usize
const toks = p.attr_buf.items(.tok)[attr_buf_start..];
p.attr_application_buf.items.len = 0;
for (attrs, toks) |attr, tok| switch (attr.tag) {
- .deprecated, .unavailable => try p.attr_application_buf.append(p.gpa, attr),
+ .deprecated, .unavailable => try p.attr_application_buf.append(p.comp.gpa, attr),
else => try ignoredAttrErr(p, tok, attr.tag, "enums"),
};
return applySelected(qt, p);
@@ -1193,7 +1208,7 @@ fn applyAligned(attr: Attribute, p: *Parser, qt: QualType, diagnostic: ?Parser.D
try p.err(align_tok, .minimum_alignment, .{default_align});
}
}
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(p.comp.gpa, attr);
}
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
return p.err(union_ty.fields[0].name_tok, .transparent_union_size_note, .{first_field_size});
}
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(p.comp.gpa, attr);
}
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)
return p.err(tok, .vec_size_not_multiple, .{});
}
- qt.* = try p.comp.type_store.put(p.gpa, .{ .vector = .{
+ qt.* = try p.comp.type_store.put(p.comp.gpa, .{ .vector = .{
.elem = qt.*,
.len = @intCast(vec_bytes / elem_size),
} });
@@ -1254,7 +1269,7 @@ fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, qt: *QualType)
fn applyFormat(attr: Attribute, p: *Parser, qt: QualType) !void {
// TODO validate
_ = qt;
- try p.attr_application_buf.append(p.gpa, attr);
+ try p.attr_application_buf.append(p.comp.gpa, attr);
}
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
switch (attr.args.calling_convention.cc) {
.c => {},
.stdcall, .thiscall, .fastcall, .regcall => switch (p.comp.target.cpu.arch) {
- .x86 => try p.attr_application_buf.append(p.gpa, attr),
+ .x86 => try p.attr_application_buf.append(p.comp.gpa, attr),
else => try p.err(tok, .callconv_not_supported, .{p.tok_ids[tok].symbol()}),
},
.vectorcall => switch (p.comp.target.cpu.arch) {
- .x86, .aarch64, .aarch64_be => try p.attr_application_buf.append(p.gpa, attr),
+ .x86, .aarch64, .aarch64_be => try p.attr_application_buf.append(p.comp.gpa, attr),
else => try p.err(tok, .callconv_not_supported, .{p.tok_ids[tok].symbol()}),
},
.riscv_vector,
@@ -1285,7 +1300,7 @@ fn applyCallingConvention(attr: Attribute, p: *Parser, tok: TokenIndex, qt: Qual
fn applySelected(qt: QualType, p: *Parser) !QualType {
if (p.attr_application_buf.items.len == 0) return qt;
if (qt.isInvalid()) return qt;
- return (try p.comp.type_store.put(p.gpa, .{ .attributed = .{
+ return (try p.comp.type_store.put(p.comp.gpa, .{ .attributed = .{
.base = qt,
.attributes = p.attr_application_buf.items,
} })).withQualifiers(qt);
lib/compiler/aro/aro/Builtins.zig
@@ -312,12 +312,13 @@ pub const Iterator = struct {
};
test Iterator {
+ const gpa = std.testing.allocator;
var it = Iterator{};
- var seen = std.StringHashMap(Builtin).init(std.testing.allocator);
- defer seen.deinit();
+ var seen: std.StringHashMapUnmanaged(Builtin) = .empty;
+ defer seen.deinit(gpa);
- var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
+ var arena_state = std.heap.ArenaAllocator.init(gpa);
defer arena_state.deinit();
const arena = arena_state.allocator();
@@ -333,7 +334,7 @@ test Iterator {
std.debug.print("previous data: {}\n", .{seen.get(entry.name).?});
return error.TestExpectedUniqueEntries;
}
- try seen.put(try arena.dupe(u8, entry.name), entry.builtin);
+ try seen.put(gpa, try arena.dupe(u8, entry.name), entry.builtin);
}
try std.testing.expectEqual(@as(usize, Builtin.data.len), seen.count());
}
lib/compiler/aro/aro/CodeGen.zig
@@ -40,11 +40,11 @@ tree: *const Tree,
comp: *Compilation,
builder: Builder,
wip_switch: *WipSwitch = undefined,
-symbols: std.ArrayListUnmanaged(Symbol) = .{},
-ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
-phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
-record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{},
-record_cache: std.AutoHashMapUnmanaged(QualType, Interner.Ref) = .{},
+symbols: std.ArrayList(Symbol) = .empty,
+ret_nodes: std.ArrayList(Ir.Inst.Phi.Input) = .empty,
+phi_nodes: std.ArrayList(Ir.Inst.Phi.Input) = .empty,
+record_elem_buf: std.ArrayList(Interner.Ref) = .empty,
+record_cache: std.AutoHashMapUnmanaged(QualType, Interner.Ref) = .empty,
cond_dummy_ty: ?Interner.Ref = null,
bool_invert: bool = false,
bool_end_label: Ir.Ref = .none,
@@ -56,10 +56,11 @@ compound_assign_dummy: ?Ir.Ref = null,
fn fail(c: *CodeGen, comptime fmt: []const u8, args: anytype) error{ FatalError, OutOfMemory } {
var sf = std.heap.stackFallback(1024, c.comp.gpa);
- var buf = std.ArrayList(u8).init(sf.get());
- defer buf.deinit();
+ const allocator = sf.get();
+ var buf: std.ArrayList(u8) = .empty;
+ defer buf.deinit(allocator);
- try buf.print(fmt, args);
+ try buf.print(allocator, fmt, args);
try c.comp.diagnostics.add(.{ .text = buf.items, .kind = .@"fatal error", .location = null });
return error.FatalError;
}
lib/compiler/aro/aro/Compilation.zig
@@ -4,8 +4,9 @@ const EpochSeconds = std.time.epoch.EpochSeconds;
const mem = std.mem;
const Allocator = mem.Allocator;
-const Interner = @import("../backend.zig").Interner;
-const CodeGenOptions = @import("../backend.zig").CodeGenOptions;
+const backend = @import("../backend.zig");
+const Interner = backend.Interner;
+const CodeGenOptions = backend.CodeGenOptions;
const Builtins = @import("Builtins.zig");
const Builtin = Builtins.Builtin;
@@ -127,24 +128,24 @@ diagnostics: *Diagnostics,
code_gen_options: CodeGenOptions = .default,
environment: Environment = .{},
-sources: std.StringArrayHashMapUnmanaged(Source) = .{},
+sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
/// Allocated into `gpa`, but keys are externally managed.
-include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
+include_dirs: std.ArrayList([]const u8) = .empty,
/// Allocated into `gpa`, but keys are externally managed.
-system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
+system_include_dirs: std.ArrayList([]const u8) = .empty,
/// Allocated into `gpa`, but keys are externally managed.
-after_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
+after_include_dirs: std.ArrayList([]const u8) = .empty,
/// Allocated into `gpa`, but keys are externally managed.
-framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
+framework_dirs: std.ArrayList([]const u8) = .empty,
/// Allocated into `gpa`, but keys are externally managed.
-system_framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
+system_framework_dirs: std.ArrayList([]const u8) = .empty,
/// Allocated into `gpa`, but keys are externally managed.
-embed_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
+embed_dirs: std.ArrayList([]const u8) = .empty,
target: std.Target = @import("builtin").target,
cmodel: std.builtin.CodeModel = .default,
-pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{},
+pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
langopts: LangOpts = .{},
-generated_buf: std.ArrayListUnmanaged(u8) = .{},
+generated_buf: std.ArrayList(u8) = .empty,
builtins: Builtins = .{},
string_interner: StringInterner = .{},
interner: Interner = .{},
@@ -245,6 +246,13 @@ fn generateSystemDefines(comp: *Compilation, w: *std.Io.Writer) !void {
try w.print("#define __GNUC_PATCHLEVEL__ {d}\n", .{comp.langopts.gnuc_version % 100});
}
+ if (comp.code_gen_options.optimization_level.hasAnyOptimizations()) {
+ try define(w, "__OPTIMIZE__");
+ }
+ if (comp.code_gen_options.optimization_level.isSizeOptimized()) {
+ try define(w, "__OPTIMIZE_SIZE__");
+ }
+
// os macros
switch (comp.target.os.tag) {
.linux => try defineStd(w, "linux", is_gnu),
@@ -1379,8 +1387,8 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
const duped_path = try comp.gpa.dupe(u8, path);
errdefer comp.gpa.free(duped_path);
- var splice_list = std.array_list.Managed(u32).init(comp.gpa);
- defer splice_list.deinit();
+ var splice_list: std.ArrayList(u32) = .empty;
+ defer splice_list.deinit(comp.gpa);
const source_id: Source.Id = @enumFromInt(comp.sources.count() + 2);
@@ -1413,9 +1421,9 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
},
.back_slash, .trailing_ws, .back_slash_cr => {
i = backslash_loc;
- try splice_list.append(i);
+ try splice_list.append(comp.gpa, i);
if (state == .trailing_ws) {
- try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line);
+ try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line, kind);
}
state = if (state == .back_slash_cr) .cr else .back_slash_cr;
},
@@ -1433,10 +1441,10 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
.back_slash, .trailing_ws => {
i = backslash_loc;
if (state == .back_slash or state == .trailing_ws) {
- try splice_list.append(i);
+ try splice_list.append(comp.gpa, i);
}
if (state == .trailing_ws) {
- try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line);
+ try comp.addNewlineEscapeError(path, buf, splice_list.items, i, line, kind);
}
},
.bom1, .bom2 => break,
@@ -1486,11 +1494,11 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
}
}
- const splice_locs = try splice_list.toOwnedSlice();
+ const splice_locs = try splice_list.toOwnedSlice(comp.gpa);
errdefer comp.gpa.free(splice_locs);
if (i != contents.len) {
- var list: std.ArrayListUnmanaged(u8) = .{
+ var list: std.ArrayList(u8) = .{
.items = contents[0..i],
.capacity = contents.len,
};
@@ -1510,13 +1518,21 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8,
return source;
}
-fn addNewlineEscapeError(comp: *Compilation, path: []const u8, buf: []const u8, splice_locs: []const u32, byte_offset: u32, line: u32) !void {
+fn addNewlineEscapeError(
+ comp: *Compilation,
+ path: []const u8,
+ buf: []const u8,
+ splice_locs: []const u32,
+ byte_offset: u32,
+ line: u32,
+ kind: Source.Kind,
+) !void {
// Temporary source for getting the location for errors.
var tmp_source: Source = .{
.path = path,
.buf = buf,
.id = undefined,
- .kind = undefined,
+ .kind = kind,
.splice_locs = splice_locs,
};
@@ -1566,17 +1582,7 @@ fn addSourceFromPathExtra(comp: *Compilation, path: []const u8, kind: Source.Kin
}
pub fn addSourceFromFile(comp: *Compilation, file: std.fs.File, path: []const u8, kind: Source.Kind) !Source {
- var file_buf: [4096]u8 = undefined;
- var file_reader = file.reader(&file_buf);
- if (try file_reader.getSize() > std.math.maxInt(u32)) return error.FileTooBig;
-
- var allocating: std.Io.Writer.Allocating = .init(comp.gpa);
- _ = allocating.writer.sendFileAll(&file_reader, .limited(std.math.maxInt(u32))) catch |e| switch (e) {
- error.WriteFailed => return error.OutOfMemory,
- error.ReadFailed => return file_reader.err.?,
- };
-
- const contents = try allocating.toOwnedSlice();
+ const contents = try comp.getFileContents(file, .unlimited);
errdefer comp.gpa.free(contents);
return comp.addSourceFromOwnedBuffer(path, contents, kind);
}
@@ -1671,7 +1677,7 @@ const FindInclude = struct {
if (try find.checkFrameworkDir(dir, .system)) |res| return res;
}
for (comp.after_include_dirs.items) |dir| {
- if (try find.checkIncludeDir(dir, .user)) |res| return res;
+ if (try find.checkIncludeDir(dir, .system)) |res| return res;
}
if (comp.ms_cwd_source_id) |source_id| {
if (try find.checkMsCwdIncludeDir(source_id)) |res| return res;
@@ -1766,26 +1772,38 @@ pub const IncludeType = enum {
angle_brackets,
};
-fn getFileContents(comp: *Compilation, path: []const u8, limit: std.Io.Limit) ![]const u8 {
+fn getPathContents(comp: *Compilation, path: []const u8, limit: std.Io.Limit) ![]u8 {
if (mem.indexOfScalar(u8, path, 0) != null) {
return error.FileNotFound;
}
const file = try comp.cwd.openFile(path, .{});
defer file.close();
+ return comp.getFileContents(file, limit);
+}
- var allocating: std.Io.Writer.Allocating = .init(comp.gpa);
- defer allocating.deinit();
-
+fn getFileContents(comp: *Compilation, file: std.fs.File, limit: std.Io.Limit) ![]u8 {
var file_buf: [4096]u8 = undefined;
var file_reader = file.reader(&file_buf);
- if (limit.minInt64(try file_reader.getSize()) > std.math.maxInt(u32)) return error.FileTooBig;
-
- _ = allocating.writer.sendFileAll(&file_reader, limit) catch |err| switch (err) {
- error.WriteFailed => return error.OutOfMemory,
- error.ReadFailed => return file_reader.err.?,
- };
+ var allocating: std.Io.Writer.Allocating = .init(comp.gpa);
+ defer allocating.deinit();
+ if (file_reader.getSize()) |size| {
+ const limited_size = limit.minInt64(size);
+ if (limited_size > std.math.maxInt(u32)) return error.FileTooBig;
+ try allocating.ensureUnusedCapacity(limited_size);
+ } else |_| {}
+
+ var remaining = limit.min(.limited(std.math.maxInt(u32)));
+ while (remaining.nonzero()) {
+ const n = file_reader.interface.stream(&allocating.writer, remaining) catch |err| switch (err) {
+ error.EndOfStream => return allocating.toOwnedSlice(),
+ error.WriteFailed => return error.OutOfMemory,
+ error.ReadFailed => return file_reader.err.?,
+ };
+ remaining = remaining.subtract(n).?;
+ }
+ if (limit == .unlimited) return error.FileTooBig;
return allocating.toOwnedSlice();
}
@@ -1797,9 +1815,10 @@ pub fn findEmbed(
include_type: IncludeType,
limit: std.Io.Limit,
opt_dep_file: ?*DepFile,
-) !?[]const u8 {
+) !?[]u8 {
if (std.fs.path.isAbsolute(filename)) {
- if (comp.getFileContents(filename, limit)) |some| {
+ if (comp.getPathContents(filename, limit)) |some| {
+ errdefer comp.gpa.free(some);
if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
return some;
} else |err| switch (err) {
@@ -1819,7 +1838,8 @@ pub fn findEmbed(
if (comp.langopts.ms_extensions) {
std.mem.replaceScalar(u8, path, '\\', '/');
}
- if (comp.getFileContents(path, limit)) |some| {
+ if (comp.getPathContents(path, limit)) |some| {
+ errdefer comp.gpa.free(some);
if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
return some;
} else |err| switch (err) {
@@ -1835,7 +1855,8 @@ pub fn findEmbed(
if (comp.langopts.ms_extensions) {
std.mem.replaceScalar(u8, path, '\\', '/');
}
- if (comp.getFileContents(path, limit)) |some| {
+ if (comp.getPathContents(path, limit)) |some| {
+ errdefer comp.gpa.free(some);
if (opt_dep_file) |dep_file| try dep_file.addDependencyDupe(comp.gpa, comp.arena, filename);
return some;
} else |err| switch (err) {
lib/compiler/aro/aro/DepFile.zig
@@ -28,7 +28,7 @@ pub fn write(d: *const DepFile, w: *std.Io.Writer) std.Io.Writer.Error!void {
const max_columns = 75;
var columns: usize = 0;
- try w.writeAll(d.target);
+ try writeTarget(d.target, w);
columns += d.target.len;
try w.writeByte(':');
columns += 1;
@@ -48,6 +48,26 @@ pub fn write(d: *const DepFile, w: *std.Io.Writer) std.Io.Writer.Error!void {
try w.flush();
}
+fn writeTarget(path: []const u8, w: *std.Io.Writer) !void {
+ for (path, 0..) |c, i| {
+ switch (c) {
+ ' ', '\t' => {
+ try w.writeByte('\\');
+ var j = i;
+ while (j != 0) {
+ j -= 1;
+ if (path[j] != '\\') break;
+ try w.writeByte('\\');
+ }
+ },
+ '$' => try w.writeByte('$'),
+ '#' => try w.writeByte('\\'),
+ else => {},
+ }
+ try w.writeByte(c);
+ }
+}
+
fn writePath(d: *const DepFile, path: []const u8, w: *std.Io.Writer) !void {
switch (d.format) {
.nmake => {
@@ -58,18 +78,19 @@ fn writePath(d: *const DepFile, path: []const u8, w: *std.Io.Writer) !void {
},
.make => {
for (path, 0..) |c, i| {
- if (c == '#') {
- try w.writeByte('\\');
- } else if (c == '$') {
- try w.writeByte('$');
- } else if (c == ' ') {
- try w.writeByte('\\');
- var j = i;
- while (j != 0) {
- j -= 1;
- if (path[j] != '\\') break;
+ switch (c) {
+ ' ' => {
try w.writeByte('\\');
- }
+ var j = i;
+ while (j != 0) {
+ j -= 1;
+ if (path[j] != '\\') break;
+ try w.writeByte('\\');
+ }
+ },
+ '$' => try w.writeByte('$'),
+ '#' => try w.writeByte('\\'),
+ else => {},
}
try w.writeByte(c);
}
lib/compiler/aro/aro/Diagnostics.zig
@@ -193,6 +193,8 @@ pub const Option = enum {
@"microsoft-flexible-array",
@"microsoft-anon-tag",
@"out-of-scope-function",
+ @"date-time",
+ @"attribute-todo",
/// GNU extensions
pub const gnu = [_]Option{
@@ -278,6 +280,8 @@ pub const State = struct {
extensions: Message.Kind = .off,
/// How to treat individual options, set by -W<name>
options: std.EnumMap(Option, Message.Kind) = .{},
+ /// Should warnings be suppressed in system headers, set by -Wsystem-headers
+ suppress_system_headers: bool = true,
};
const Diagnostics = @This();
@@ -288,7 +292,7 @@ output: union(enum) {
color: std.Io.tty.Config,
},
to_list: struct {
- messages: std.ArrayListUnmanaged(Message) = .empty,
+ messages: std.ArrayList(Message) = .empty,
arena: std.heap.ArenaAllocator,
},
ignore,
@@ -373,6 +377,16 @@ pub fn effectiveKind(d: *Diagnostics, message: anytype) Message.Kind {
return .off;
}
+ if (@hasField(@TypeOf(message), "location")) {
+ if (message.location) |location| {
+ if (location.kind != .user and d.state.suppress_system_headers and
+ (message.kind == .warning or message.kind == .off))
+ {
+ return .off;
+ }
+ }
+ }
+
var kind = message.kind;
// Get explicit kind set by -W<name>=
@@ -418,9 +432,9 @@ pub fn addWithLocation(
note_msg_loc: bool,
) Compilation.Error!void {
var copy = msg;
- copy.effective_kind = d.effectiveKind(msg);
- if (copy.effective_kind == .off) return;
if (expansion_locs.len != 0) copy.location = expansion_locs[expansion_locs.len - 1].expand(comp);
+ copy.effective_kind = d.effectiveKind(copy);
+ if (copy.effective_kind == .off) return;
try d.addMessage(copy);
if (expansion_locs.len != 0) {
lib/compiler/aro/aro/Driver.zig
@@ -45,8 +45,8 @@ const Driver = @This();
comp: *Compilation,
diagnostics: *Diagnostics,
-inputs: std.ArrayListUnmanaged(Source) = .{},
-link_objects: std.ArrayListUnmanaged([]const u8) = .{},
+inputs: std.ArrayList(Source) = .empty,
+link_objects: std.ArrayList([]const u8) = .empty,
output_name: ?[]const u8 = null,
sysroot: ?[]const u8 = null,
resource_dir: ?[]const u8 = null,
@@ -107,7 +107,6 @@ raw_cpu: ?[]const u8 = null,
use_assembly_backend: bool = false,
// linker options
-use_linker: ?[]const u8 = null,
linker_path: ?[]const u8 = null,
nodefaultlibs: bool = false,
nolibc: bool = false,
@@ -270,7 +269,7 @@ pub const usage =
pub fn parseArgs(
d: *Driver,
stdout: *std.Io.Writer,
- macro_buf: *std.ArrayListUnmanaged(u8),
+ macro_buf: *std.ArrayList(u8),
args: []const []const u8,
) (Compilation.Error || std.Io.Writer.Error)!bool {
var i: usize = 1;
@@ -322,7 +321,7 @@ pub fn parseArgs(
}
try macro_buf.print(d.comp.gpa, "#undef {s}\n", .{macro});
} else if (mem.eql(u8, arg, "-O")) {
- d.comp.code_gen_options.optimization_level = .@"0";
+ d.comp.code_gen_options.optimization_level = .@"1";
} else if (mem.startsWith(u8, arg, "-O")) {
d.comp.code_gen_options.optimization_level = backend.CodeGenOptions.OptimizationLevel.fromString(arg["-O".len..]) orelse {
try d.err("invalid optimization level '{s}'", .{arg});
@@ -600,6 +599,10 @@ pub fn parseArgs(
d.diagnostics.state.enable_all_warnings = false;
} else if (mem.eql(u8, arg, "-Weverything")) {
d.diagnostics.state.enable_all_warnings = true;
+ } else if (mem.eql(u8, arg, "-Wno-system-headers")) {
+ d.diagnostics.state.suppress_system_headers = true;
+ } else if (mem.eql(u8, arg, "-Wsystem-headers")) {
+ d.diagnostics.state.suppress_system_headers = false;
} else if (mem.eql(u8, arg, "-Werror")) {
d.diagnostics.state.error_warnings = true;
} else if (mem.eql(u8, arg, "-Wno-error")) {
@@ -644,10 +647,6 @@ pub fn parseArgs(
d.comp.langopts.preserve_comments = true;
d.comp.langopts.preserve_comments_in_macros = true;
comment_arg = arg;
- } else if (option(arg, "-fuse-ld=")) |linker_name| {
- d.use_linker = linker_name;
- } else if (mem.eql(u8, arg, "-fuse-ld=")) {
- d.use_linker = null;
} else if (option(arg, "--ld-path=")) |linker_path| {
d.linker_path = linker_path;
} else if (mem.eql(u8, arg, "-r")) {
@@ -917,13 +916,11 @@ pub fn errorDescription(e: anyerror) []const u8 {
};
}
-var stdout_buffer: [4096]u8 = undefined;
-
/// The entry point of the Aro compiler.
/// **MAY call `exit` if `fast_exit` is set.**
pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8, comptime fast_exit: bool, asm_gen_fn: ?AsmCodeGenFn) Compilation.Error!void {
const user_macros = macros: {
- var macro_buf: std.ArrayListUnmanaged(u8) = .empty;
+ var macro_buf: std.ArrayList(u8) = .empty;
defer macro_buf.deinit(d.comp.gpa);
var stdout_buf: [256]u8 = undefined;
@@ -1107,7 +1104,7 @@ fn processSource(
var name_buf: [std.fs.max_name_bytes]u8 = undefined;
var opt_dep_file = try d.initDepFile(source, &name_buf, false);
- defer if (opt_dep_file) |*dep_file| dep_file.deinit(pp.gpa);
+ defer if (opt_dep_file) |*dep_file| dep_file.deinit(d.comp.gpa);
if (opt_dep_file) |*dep_file| pp.dep_file = dep_file;
@@ -1164,14 +1161,11 @@ fn processSource(
else
std.fs.File.stdout();
defer if (d.output_name != null) file.close();
- var file_buffer: [1024]u8 = undefined;
- var file_writer = file.writer(&file_buffer);
- pp.prettyPrintTokens(&file_writer.interface, dump_mode) catch |er|
- return d.fatal("unable to write result: {s}", .{errorDescription(er)});
+ var file_writer = file.writer(&writer_buf);
+ pp.prettyPrintTokens(&file_writer.interface, dump_mode) catch
+ return d.fatal("unable to write result: {s}", .{errorDescription(file_writer.err.?)});
- file_writer.interface.flush() catch |er|
- return d.fatal("unable to write result: {s}", .{errorDescription(er)});
if (fast_exit) std.process.exit(0); // Not linking, no need for cleanup.
return;
}
@@ -1180,9 +1174,8 @@ fn processSource(
defer tree.deinit();
if (d.verbose_ast) {
- var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer);
- tree.dump(d.detectConfig(.stdout()), &stdout_writer.interface) catch {};
- stdout_writer.interface.flush() catch {};
+ var stdout = std.fs.File.stdout().writer(&writer_buf);
+ tree.dump(d.detectConfig(stdout.file), &stdout.interface) catch {};
}
d.printDiagnosticsStats();
@@ -1299,12 +1292,13 @@ fn dumpLinkerArgs(w: *std.Io.Writer, items: []const []const u8) !void {
/// The entry point of the Aro compiler.
/// **MAY call `exit` if `fast_exit` is set.**
pub fn invokeLinker(d: *Driver, tc: *Toolchain, comptime fast_exit: bool) Compilation.Error!void {
- var argv = std.array_list.Managed([]const u8).init(d.comp.gpa);
- defer argv.deinit();
+ const gpa = d.comp.gpa;
+ var argv: std.ArrayList([]const u8) = .empty;
+ defer argv.deinit(gpa);
var linker_path_buf: [std.fs.max_path_bytes]u8 = undefined;
const linker_path = try tc.getLinkerPath(&linker_path_buf);
- try argv.append(linker_path);
+ try argv.append(gpa, linker_path);
try tc.buildLinkerArgs(&argv);
lib/compiler/aro/aro/InitList.zig
@@ -22,7 +22,7 @@ const Item = struct {
const InitList = @This();
-list: std.ArrayListUnmanaged(Item) = .empty,
+list: std.ArrayList(Item) = .empty,
node: Node.OptIndex = .null,
tok: TokenIndex = 0,
lib/compiler/aro/aro/Parser.zig
@@ -32,12 +32,12 @@ const Type = TypeStore.Type;
const QualType = TypeStore.QualType;
const Value = @import("Value.zig");
-const NodeList = std.array_list.Managed(Node.Index);
+const NodeList = std.ArrayList(Node.Index);
const Switch = struct {
default: ?TokenIndex = null,
- ranges: std.array_list.Managed(Range),
+ ranges: std.ArrayList(Range) = .empty,
qt: QualType,
- comp: *Compilation,
+ comp: *const Compilation,
const Range = struct {
first: Value,
@@ -45,13 +45,13 @@ const Switch = struct {
tok: TokenIndex,
};
- fn add(self: *Switch, first: Value, last: Value, tok: TokenIndex) !?Range {
- for (self.ranges.items) |range| {
- if (last.compare(.gte, range.first, self.comp) and first.compare(.lte, range.last, self.comp)) {
+ fn add(s: *Switch, first: Value, last: Value, tok: TokenIndex) !?Range {
+ for (s.ranges.items) |range| {
+ if (last.compare(.gte, range.first, s.comp) and first.compare(.lte, range.last, s.comp)) {
return range; // They overlap.
}
}
- try self.ranges.append(.{
+ try s.ranges.append(s.comp.gpa, .{
.first = first,
.last = last,
.tok = tok,
@@ -101,7 +101,6 @@ const Parser = @This();
pp: *Preprocessor,
comp: *Compilation,
diagnostics: *Diagnostics,
-gpa: mem.Allocator,
tok_ids: []const Token.Id,
tok_i: TokenIndex = 0,
@@ -110,21 +109,21 @@ tree: Tree,
// buffers used during compilation
syms: SymbolStack = .{},
-strings: std.array_list.Managed(u8),
-labels: std.array_list.Managed(Label),
-list_buf: NodeList,
-decl_buf: NodeList,
+strings: std.array_list.Aligned(u8, .@"4") = .empty,
+labels: std.ArrayList(Label) = .empty,
+list_buf: NodeList = .empty,
+decl_buf: NodeList = .empty,
/// Function type parameters, also used for generic selection association
/// duplicate checking.
-param_buf: std.array_list.Managed(Type.Func.Param),
+param_buf: std.ArrayList(Type.Func.Param) = .empty,
/// Enum type fields.
-enum_buf: std.array_list.Managed(Type.Enum.Field),
+enum_buf: std.ArrayList(Type.Enum.Field) = .empty,
/// Record type fields.
-record_buf: std.array_list.Managed(Type.Record.Field),
+record_buf: std.ArrayList(Type.Record.Field) = .empty,
/// Attributes that have been parsed but not yet validated or applied.
attr_buf: std.MultiArrayList(TentativeAttribute) = .empty,
/// Used to store validated attributes before they are applied to types.
-attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty,
+attr_application_buf: std.ArrayList(Attribute) = .empty,
/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)
/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.
/// The key is the StringId of `Foo` and the value is the TokenIndex of `bar`
@@ -177,7 +176,7 @@ record: struct {
break;
}
}
- try p.record_members.append(p.gpa, .{ .name = name, .tok = tok });
+ try p.record_members.append(p.comp.gpa, .{ .name = name, .tok = tok });
}
fn addFieldsFromAnonymous(r: @This(), p: *Parser, record_ty: Type.Record) Error!void {
@@ -192,7 +191,7 @@ record: struct {
}
}
} = .{},
-record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{},
+record_members: std.ArrayList(struct { tok: TokenIndex, name: StringId }) = .empty,
@"switch": ?*Switch = null,
in_loop: bool = false,
@@ -212,7 +211,7 @@ fn checkIdentifierCodepointWarnings(p: *Parser, codepoint: u21, loc: Source.Loca
assert(codepoint >= 0x80);
const prev_total = p.diagnostics.total;
- var sf = std.heap.stackFallback(1024, p.gpa);
+ var sf = std.heap.stackFallback(1024, p.comp.gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
@@ -425,7 +424,7 @@ pub fn err(p: *Parser, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype)
if (diagnostic.suppress_unless_version) |some| if (!p.comp.langopts.standard.atLeast(some)) return;
if (p.diagnostics.effectiveKind(diagnostic) == .off) return;
- var sf = std.heap.stackFallback(1024, p.gpa);
+ var sf = std.heap.stackFallback(1024, p.comp.gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
@@ -604,7 +603,7 @@ pub fn removeNull(p: *Parser, str: Value) !Value {
defer p.strings.items.len = strings_top;
{
const bytes = p.comp.interner.get(str.ref()).bytes;
- try p.strings.appendSlice(bytes[0 .. bytes.len - 1]);
+ try p.strings.appendSlice(p.comp.gpa, bytes[0 .. bytes.len - 1]);
}
return Value.intern(p.comp, .{ .bytes = p.strings.items[strings_top..] });
}
@@ -799,30 +798,23 @@ fn diagnoseIncompleteDefinitions(p: *Parser) !void {
}
/// root : (decl | assembly ';' | staticAssert)*
-pub fn parse(pp: *Preprocessor) Error!Tree {
+pub fn parse(pp: *Preprocessor) Compilation.Error!Tree {
+ const gpa = pp.comp.gpa;
assert(pp.linemarkers == .none);
pp.comp.pragmaEvent(.before_parse);
const expected_implicit_typedef_max = 7;
- try pp.tokens.ensureUnusedCapacity(pp.gpa, expected_implicit_typedef_max);
+ try pp.tokens.ensureUnusedCapacity(gpa, expected_implicit_typedef_max);
var p: Parser = .{
.pp = pp,
.comp = pp.comp,
.diagnostics = pp.diagnostics,
- .gpa = pp.comp.gpa,
.tree = .{
.comp = pp.comp,
.tokens = undefined, // Set after implicit typedefs
},
.tok_ids = pp.tokens.items(.id),
- .strings = .init(pp.comp.gpa),
- .labels = .init(pp.comp.gpa),
- .list_buf = .init(pp.comp.gpa),
- .decl_buf = .init(pp.comp.gpa),
- .param_buf = .init(pp.comp.gpa),
- .enum_buf = .init(pp.comp.gpa),
- .record_buf = .init(pp.comp.gpa),
.string_ids = .{
.declspec_id = try pp.comp.internString("__declspec"),
.main_id = try pp.comp.internString("main"),
@@ -834,18 +826,18 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
};
errdefer p.tree.deinit();
defer {
- p.labels.deinit();
- p.strings.deinit();
- p.syms.deinit(pp.comp.gpa);
- p.list_buf.deinit();
- p.decl_buf.deinit();
- p.param_buf.deinit();
- p.enum_buf.deinit();
- p.record_buf.deinit();
- p.record_members.deinit(pp.comp.gpa);
- p.attr_buf.deinit(pp.comp.gpa);
- p.attr_application_buf.deinit(pp.comp.gpa);
- p.tentative_defs.deinit(pp.comp.gpa);
+ p.labels.deinit(gpa);
+ p.strings.deinit(gpa);
+ p.syms.deinit(gpa);
+ p.list_buf.deinit(gpa);
+ p.decl_buf.deinit(gpa);
+ p.param_buf.deinit(gpa);
+ p.enum_buf.deinit(gpa);
+ p.record_buf.deinit(gpa);
+ p.record_members.deinit(gpa);
+ p.attr_buf.deinit(gpa);
+ p.attr_application_buf.deinit(gpa);
+ p.tentative_defs.deinit(gpa);
}
try p.syms.pushScope(&p);
@@ -907,7 +899,7 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
},
else => |e| return e,
}) |node| {
- try p.decl_buf.append(node);
+ try p.decl_buf.append(gpa, node);
continue;
}
if (p.eatToken(.semicolon)) |tok| {
@@ -915,7 +907,7 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
const empty = try p.tree.addNode(.{ .empty_decl = .{
.semicolon = tok,
} });
- try p.decl_buf.append(empty);
+ try p.decl_buf.append(gpa, empty);
continue;
}
try p.err(p.tok_i, .expected_external_decl, .{});
@@ -925,7 +917,9 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
try p.diagnoseIncompleteDefinitions();
}
- p.tree.root_decls = p.decl_buf.moveToUnmanaged();
+ p.tree.root_decls = p.decl_buf;
+ p.decl_buf = .empty;
+
if (p.tree.root_decls.items.len == implicit_typedef_count) {
try p.err(p.tok_i - 1, .empty_translation_unit, .{});
}
@@ -937,9 +931,11 @@ pub fn parse(pp: *Preprocessor) Error!Tree {
}
fn addImplicitTypedef(p: *Parser, name: []const u8, qt: QualType) !void {
+ const gpa = p.comp.gpa;
const start = p.comp.generated_buf.items.len;
- try p.comp.generated_buf.appendSlice(p.comp.gpa, name);
- try p.comp.generated_buf.append(p.comp.gpa, '\n');
+ try p.comp.generated_buf.ensureUnusedCapacity(gpa, name.len + 1);
+ p.comp.generated_buf.appendSliceAssumeCapacity(name);
+ p.comp.generated_buf.appendAssumeCapacity('\n');
const name_tok: u32 = @intCast(p.pp.tokens.len);
p.pp.tokens.appendAssumeCapacity(.{ .id = .identifier, .loc = .{
@@ -958,13 +954,13 @@ fn addImplicitTypedef(p: *Parser, name: []const u8, qt: QualType) !void {
});
const interned_name = try p.comp.internString(name);
- const typedef_qt = (try p.comp.type_store.put(p.gpa, .{ .typedef = .{
+ const typedef_qt = (try p.comp.type_store.put(gpa, .{ .typedef = .{
.base = qt,
.name = interned_name,
.decl_node = node,
} })).withQualifiers(qt);
try p.syms.defineTypedef(p, interned_name, typedef_qt, name_tok, node);
- try p.decl_buf.append(node);
+ try p.decl_buf.append(gpa, node);
}
fn skipToPragmaSentinel(p: *Parser) void {
@@ -1082,6 +1078,7 @@ fn typedefDefined(p: *Parser, name: StringId, ty: QualType) void {
/// : declSpec (initDeclarator ( ',' initDeclarator)*)? ';'
/// | declSpec declarator decl* compoundStmt
fn decl(p: *Parser) Error!bool {
+ const gpa = p.comp.gpa;
_ = try p.pragma();
const first_tok = p.tok_i;
const attr_buf_top = p.attr_buf.len;
@@ -1116,7 +1113,7 @@ fn decl(p: *Parser) Error!bool {
};
if (decl_spec.noreturn) |tok| {
const attr = Attribute{ .tag = .noreturn, .args = .{ .noreturn = .{} }, .syntax = .keyword };
- try p.attr_buf.append(p.gpa, .{ .attr = attr, .tok = tok });
+ try p.attr_buf.append(gpa, .{ .attr = attr, .tok = tok });
}
var decl_node = try p.tree.addNode(.{ .empty_decl = .{
@@ -1194,7 +1191,7 @@ fn decl(p: *Parser) Error!bool {
const func_qt = init_d.d.qt.base(p.comp).qt;
const params_len = func_qt.get(p.comp, .func).?.params.len;
- const new_params = try p.param_buf.addManyAsSlice(params_len);
+ const new_params = try p.param_buf.addManyAsSlice(gpa, params_len);
for (new_params) |*new_param| {
new_param.name = .empty;
}
@@ -1280,7 +1277,7 @@ fn decl(p: *Parser) Error!bool {
}
}
// Update the functio type to contain the declared parameters.
- p.func.qt = try p.comp.type_store.put(p.gpa, .{ .func = .{
+ p.func.qt = try p.comp.type_store.put(gpa, .{ .func = .{
.kind = .normal,
.params = new_params,
.return_type = func_ty.return_type,
@@ -1293,7 +1290,7 @@ fn decl(p: *Parser) Error!bool {
}
// bypass redefinition check to avoid duplicate errors
- try p.syms.define(p.gpa, .{
+ try p.syms.define(gpa, .{
.kind = .def,
.name = param.name,
.tok = param.name_tok,
@@ -1334,7 +1331,7 @@ fn decl(p: *Parser) Error!bool {
.definition = null,
} }, @intFromEnum(decl_node));
- try p.decl_buf.append(decl_node);
+ try p.decl_buf.append(gpa, decl_node);
// check gotos
if (func.qt == null) {
@@ -1382,7 +1379,7 @@ fn decl(p: *Parser) Error!bool {
if (node_qt.get(p.comp, .array)) |array_ty| {
if (array_ty.len == .incomplete) {
// Create tentative array node with fixed type.
- node_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ node_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = array_ty.elem,
.len = .{ .fixed = 1 },
} });
@@ -1408,14 +1405,14 @@ fn decl(p: *Parser) Error!bool {
},
}, @intFromEnum(decl_node));
}
- try p.decl_buf.append(decl_node);
+ try p.decl_buf.append(gpa, decl_node);
const interned_name = try p.comp.internString(p.tokSlice(init_d.d.name));
if (decl_spec.storage_class == .typedef) {
const typedef_qt = if (init_d.d.qt.isInvalid())
init_d.d.qt
else
- (try p.comp.type_store.put(p.gpa, .{ .typedef = .{
+ (try p.comp.type_store.put(gpa, .{ .typedef = .{
.base = init_d.d.qt,
.name = interned_name,
.decl_node = decl_node,
@@ -1500,6 +1497,7 @@ fn staticAssertMessage(p: *Parser, cond_node: Node.Index, maybe_message: ?Result
/// : keyword_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';'
/// | keyword_c23_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';'
fn staticAssert(p: *Parser) Error!bool {
+ const gpa = p.comp.gpa;
const static_assert = p.eatToken(.keyword_static_assert) orelse p.eatToken(.keyword_c23_static_assert) orelse return false;
const l_paren = try p.expectToken(.l_paren);
const res_token = p.tok_i;
@@ -1539,7 +1537,7 @@ fn staticAssert(p: *Parser) Error!bool {
}
} else {
if (!res.val.toBool(p.comp)) {
- var sf = std.heap.stackFallback(1024, p.gpa);
+ var sf = std.heap.stackFallback(1024, gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
@@ -1558,7 +1556,7 @@ fn staticAssert(p: *Parser) Error!bool {
.message = if (str) |some| some.node else null,
},
});
- try p.decl_buf.append(node);
+ try p.decl_buf.append(gpa, node);
return true;
}
@@ -1632,6 +1630,7 @@ pub const DeclSpec = struct {
/// : keyword_typeof '(' typeName ')'
/// | keyword_typeof '(' expr ')'
fn typeof(p: *Parser) Error!?QualType {
+ const gpa = p.comp.gpa;
var unqual = false;
switch (p.tok_ids[p.tok_i]) {
.keyword_typeof, .keyword_typeof1, .keyword_typeof2 => p.tok_i += 1,
@@ -1646,7 +1645,7 @@ fn typeof(p: *Parser) Error!?QualType {
try p.expectClosing(l_paren, .r_paren);
if (qt.isInvalid()) return null;
- return (try p.comp.type_store.put(p.gpa, .{ .typeof = .{
+ return (try p.comp.type_store.put(gpa, .{ .typeof = .{
.base = qt,
.expr = null,
} })).withQualifiers(qt);
@@ -1655,7 +1654,7 @@ fn typeof(p: *Parser) Error!?QualType {
try p.expectClosing(l_paren, .r_paren);
if (typeof_expr.qt.isInvalid()) return null;
- const typeof_qt = try p.comp.type_store.put(p.gpa, .{ .typeof = .{
+ const typeof_qt = try p.comp.type_store.put(gpa, .{ .typeof = .{
.base = typeof_expr.qt,
.expr = typeof_expr.node,
} });
@@ -1704,7 +1703,7 @@ fn declSpec(p: *Parser) Error!?DeclSpec {
continue;
},
.keyword_forceinline, .keyword_forceinline2 => {
- try p.attr_buf.append(p.gpa, .{
+ try p.attr_buf.append(p.comp.gpa, .{
.attr = .{ .tag = .always_inline, .args = .{ .always_inline = .{} }, .syntax = .keyword },
.tok = p.tok_i,
});
@@ -1883,11 +1882,12 @@ fn diagnose(p: *Parser, attr: Attribute.Tag, arguments: *Attribute.Arguments, ar
/// attributeList : (attribute (',' attribute)*)?
fn gnuAttributeList(p: *Parser) Error!void {
if (p.tok_ids[p.tok_i] == .r_paren) return;
+ const gpa = p.comp.gpa;
- if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(p.gpa, attr);
+ if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(gpa, attr);
while (p.tok_ids[p.tok_i] != .r_paren) {
_ = try p.expectToken(.comma);
- if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(p.gpa, attr);
+ if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(gpa, attr);
}
}
@@ -1900,14 +1900,14 @@ fn c23AttributeList(p: *Parser) Error!void {
} else {
p.tok_i -= 1;
}
- if (try p.attribute(.c23, namespace)) |attr| try p.attr_buf.append(p.gpa, attr);
+ if (try p.attribute(.c23, namespace)) |attr| try p.attr_buf.append(p.comp.gpa, attr);
_ = p.eatToken(.comma);
}
}
fn msvcAttributeList(p: *Parser) Error!void {
while (p.tok_ids[p.tok_i] != .r_paren) {
- if (try p.attribute(.declspec, null)) |attr| try p.attr_buf.append(p.gpa, attr);
+ if (try p.attribute(.declspec, null)) |attr| try p.attr_buf.append(p.comp.gpa, attr);
_ = p.eatToken(.comma);
}
}
@@ -1979,6 +1979,7 @@ fn attributeSpecifierExtra(p: *Parser, declarator_name: ?TokenIndex) Error!void
fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize, decl_node: Node.Index) Error!?InitDeclarator {
const this_attr_buf_top = p.attr_buf.len;
defer p.attr_buf.len = this_attr_buf_top;
+ const gpa = p.comp.gpa;
var init_d = InitDeclarator{
.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
if (base_array_ty.len == .incomplete) if (init_list_expr.qt.get(p.comp, .array)) |init_array_ty| {
switch (init_array_ty.len) {
.fixed, .static => |len| {
- init_d.d.qt = (try p.comp.type_store.put(p.gpa, .{ .array = .{
+ init_d.d.qt = (try p.comp.type_store.put(gpa, .{ .array = .{
.elem = base_array_ty.elem,
.len = .{ .fixed = len },
} })).withQualifiers(init_d.d.qt);
@@ -2132,11 +2133,11 @@ fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize, decl_no
break :incomplete;
},
.@"struct", .@"union" => |record_ty| {
- _ = try p.tentative_defs.getOrPutValue(p.gpa, record_ty.name, init_d.d.name);
+ _ = try p.tentative_defs.getOrPutValue(gpa, record_ty.name, init_d.d.name);
break :incomplete;
},
.@"enum" => |enum_ty| {
- _ = try p.tentative_defs.getOrPutValue(p.gpa, enum_ty.name, init_d.d.name);
+ _ = try p.tentative_defs.getOrPutValue(gpa, enum_ty.name, init_d.d.name);
break :incomplete;
},
else => {},
@@ -2234,6 +2235,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool {
=> {
const align_tok = p.tok_i;
p.tok_i += 1;
+ const gpa = p.comp.gpa;
const l_paren = try p.expectToken(.l_paren);
const typename_start = p.tok_i;
if (try p.typeName()) |inner_qt| {
@@ -2241,7 +2243,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool {
try p.err(typename_start, .invalid_alignof, .{inner_qt});
}
const alignment = Attribute.Alignment{ .requested = inner_qt.alignof(p.comp) };
- try p.attr_buf.append(p.gpa, .{
+ try p.attr_buf.append(gpa, .{
.attr = .{ .tag = .aligned, .args = .{
.aligned = .{ .alignment = alignment, .__name_tok = align_tok },
}, .syntax = .keyword },
@@ -2257,7 +2259,7 @@ fn typeSpec(p: *Parser, builder: *TypeStore.Builder) Error!bool {
return error.ParsingFailed;
}
args.aligned.alignment.?.node = .pack(res.node);
- try p.attr_buf.append(p.gpa, .{
+ try p.attr_buf.append(gpa, .{
.attr = .{ .tag = .aligned, .args = args, .syntax = .keyword },
.tok = align_tok,
});
@@ -2336,7 +2338,7 @@ fn getAnonymousName(p: *Parser, kind_tok: TokenIndex) !StringId {
else => "record field",
};
- var arena = p.comp.type_store.anon_name_arena.promote(p.gpa);
+ var arena = p.comp.type_store.anon_name_arena.promote(p.comp.gpa);
defer p.comp.type_store.anon_name_arena = arena.state;
const str = try std.fmt.allocPrint(
arena.allocator(),
@@ -2350,6 +2352,7 @@ fn getAnonymousName(p: *Parser, kind_tok: TokenIndex) !StringId {
/// : (keyword_struct | keyword_union) IDENTIFIER? { recordDecls }
/// | (keyword_struct | keyword_union) IDENTIFIER
fn recordSpec(p: *Parser) Error!QualType {
+ const gpa = p.comp.gpa;
const starting_pragma_pack = p.pragma_pack;
const kind_tok = p.tok_i;
const is_struct = p.tok_ids[kind_tok] == .keyword_struct;
@@ -2358,7 +2361,7 @@ fn recordSpec(p: *Parser) Error!QualType {
defer p.attr_buf.len = attr_buf_top;
try p.attributeSpecifier();
- const reserved_index = try p.tree.nodes.addOne(p.gpa);
+ const reserved_index = try p.tree.nodes.addOne(gpa);
const maybe_ident = try p.eatIdentifier();
const l_brace = p.eatToken(.l_brace) orelse {
@@ -2378,13 +2381,13 @@ fn recordSpec(p: *Parser) Error!QualType {
.decl_node = @enumFromInt(reserved_index),
.fields = &.{},
};
- const record_qt = try p.comp.type_store.put(p.gpa, if (is_struct)
+ const record_qt = try p.comp.type_store.put(gpa, if (is_struct)
.{ .@"struct" = record_ty }
else
.{ .@"union" = record_ty });
const attributed_qt = try Attribute.applyTypeAttributes(p, record_qt, attr_buf_top, null);
- try p.syms.define(p.gpa, .{
+ try p.syms.define(gpa, .{
.kind = if (is_struct) .@"struct" else .@"union",
.name = interned_name,
.tok = ident,
@@ -2401,7 +2404,7 @@ fn recordSpec(p: *Parser) Error!QualType {
.{ .struct_forward_decl = fw }
else
.{ .union_forward_decl = fw }, reserved_index);
- try p.decl_buf.append(@enumFromInt(reserved_index));
+ try p.decl_buf.append(gpa, @enumFromInt(reserved_index));
return attributed_qt;
}
};
@@ -2435,7 +2438,7 @@ fn recordSpec(p: *Parser) Error!QualType {
.layout = null,
.fields = &.{},
};
- const record_qt = try p.comp.type_store.put(p.gpa, if (is_struct)
+ const record_qt = try p.comp.type_store.put(gpa, if (is_struct)
.{ .@"struct" = record_ty }
else
.{ .@"union" = record_ty });
@@ -2443,7 +2446,7 @@ fn recordSpec(p: *Parser) Error!QualType {
// declare a symbol for the type
// We need to replace the symbol's type if it has attributes
if (maybe_ident != null) {
- try p.syms.define(p.gpa, .{
+ try p.syms.define(gpa, .{
.kind = if (is_struct) .@"struct" else .@"union",
.name = record_ty.name,
.tok = maybe_ident.?,
@@ -2455,7 +2458,7 @@ fn recordSpec(p: *Parser) Error!QualType {
break :blk .{ record_ty, record_qt };
};
- try p.decl_buf.append(@enumFromInt(reserved_index));
+ try p.decl_buf.append(gpa, @enumFromInt(reserved_index));
const decl_buf_top = p.decl_buf.items.len;
const record_buf_top = p.record_buf.items.len;
errdefer p.decl_buf.items.len = decl_buf_top - 1;
@@ -2512,10 +2515,10 @@ fn recordSpec(p: *Parser) Error!QualType {
const base_type = qt.base(p.comp);
if (is_struct) {
std.debug.assert(base_type.type.@"struct".name == record_ty.name);
- try p.comp.type_store.set(p.gpa, .{ .@"struct" = record_ty }, @intFromEnum(base_type.qt._index));
+ try p.comp.type_store.set(gpa, .{ .@"struct" = record_ty }, @intFromEnum(base_type.qt._index));
} else {
std.debug.assert(base_type.type.@"union".name == record_ty.name);
- try p.comp.type_store.set(p.gpa, .{ .@"union" = record_ty }, @intFromEnum(base_type.qt._index));
+ try p.comp.type_store.set(gpa, .{ .@"union" = record_ty }, @intFromEnum(base_type.qt._index));
}
break :blk false;
};
@@ -2603,6 +2606,7 @@ fn recordDecls(p: *Parser) Error!void {
/// recordDecl : typeSpec+ (recordDeclarator (',' recordDeclarator)*)?
/// recordDeclarator : declarator (':' integerConstExpr)?
fn recordDecl(p: *Parser) Error!bool {
+ const gpa = p.comp.gpa;
const attr_buf_top = p.attr_buf.len;
defer p.attr_buf.len = attr_buf_top;
@@ -2698,7 +2702,7 @@ fn recordDecl(p: *Parser) Error!bool {
const attr_index: u32 = @intCast(p.comp.type_store.attributes.items.len);
const attr_len: u32 = @intCast(to_append.len);
- try p.comp.type_store.attributes.appendSlice(p.gpa, to_append);
+ try p.comp.type_store.attributes.appendSlice(gpa, to_append);
if (name_tok == 0 and bits == null) unnamed: {
var is_typedef = false;
@@ -2717,7 +2721,7 @@ fn recordDecl(p: *Parser) Error!bool {
try p.err(first_tok, .anonymous_struct, .{});
}
// An anonymous record appears as indirect fields on the parent
- try p.record_buf.append(.{
+ try p.record_buf.append(gpa, .{
.name = try p.getAnonymousName(first_tok),
.qt = qt,
._attr_index = attr_index,
@@ -2731,7 +2735,7 @@ fn recordDecl(p: *Parser) Error!bool {
.bit_width = null,
},
});
- try p.decl_buf.append(node);
+ try p.decl_buf.append(gpa, node);
try p.record.addFieldsFromAnonymous(p, record_ty);
break; // must be followed by a semicolon
},
@@ -2746,7 +2750,7 @@ fn recordDecl(p: *Parser) Error!bool {
continue;
} else {
const interned_name = if (name_tok != 0) try p.comp.internString(p.tokSlice(name_tok)) else try p.getAnonymousName(first_tok);
- try p.record_buf.append(.{
+ try p.record_buf.append(gpa, .{
.name = interned_name,
.qt = qt,
.name_tok = name_tok,
@@ -2762,7 +2766,7 @@ fn recordDecl(p: *Parser) Error!bool {
.bit_width = bits_node,
},
});
- try p.decl_buf.append(node);
+ try p.decl_buf.append(gpa, node);
}
if (!qt.isInvalid()) {
@@ -2834,6 +2838,7 @@ fn specQual(p: *Parser) Error!?QualType {
/// : keyword_enum IDENTIFIER? (: typeName)? { enumerator (',' enumerator)? ',') }
/// | keyword_enum IDENTIFIER (: typeName)?
fn enumSpec(p: *Parser) Error!QualType {
+ const gpa = p.comp.gpa;
const enum_tok = p.tok_i;
p.tok_i += 1;
const attr_buf_top = p.attr_buf.len;
@@ -2864,7 +2869,7 @@ fn enumSpec(p: *Parser) Error!QualType {
break :fixed fixed;
} else null;
- const reserved_index = try p.tree.nodes.addOne(p.gpa);
+ const reserved_index = try p.tree.nodes.addOne(gpa);
const l_brace = p.eatToken(.l_brace) orelse {
const ident = maybe_ident orelse {
@@ -2879,7 +2884,7 @@ fn enumSpec(p: *Parser) Error!QualType {
try p.checkEnumFixedTy(fixed_qt, ident, prev);
return prev.qt;
} else {
- const enum_qt = try p.comp.type_store.put(p.gpa, .{ .@"enum" = .{
+ const enum_qt = try p.comp.type_store.put(gpa, .{ .@"enum" = .{
.name = interned_name,
.tag = fixed_qt,
.fixed = fixed_qt != null,
@@ -2889,7 +2894,7 @@ fn enumSpec(p: *Parser) Error!QualType {
} });
const attributed_qt = try Attribute.applyTypeAttributes(p, enum_qt, attr_buf_top, null);
- try p.syms.define(p.gpa, .{
+ try p.syms.define(gpa, .{
.kind = .@"enum",
.name = interned_name,
.tok = ident,
@@ -2897,7 +2902,7 @@ fn enumSpec(p: *Parser) Error!QualType {
.val = .{},
});
- try p.decl_buf.append(try p.addNode(.{ .enum_forward_decl = .{
+ try p.decl_buf.append(gpa, try p.addNode(.{ .enum_forward_decl = .{
.name_or_kind_tok = ident,
.container_qt = attributed_qt,
.definition = null,
@@ -2940,12 +2945,12 @@ fn enumSpec(p: *Parser) Error!QualType {
.fixed = fixed_qt != null,
.fields = &.{},
};
- const enum_qt = try p.comp.type_store.put(p.gpa, .{ .@"enum" = enum_ty });
+ const enum_qt = try p.comp.type_store.put(gpa, .{ .@"enum" = enum_ty });
break :blk .{ enum_ty, enum_qt };
};
// reserve space for this enum
- try p.decl_buf.append(@enumFromInt(reserved_index));
+ try p.decl_buf.append(gpa, @enumFromInt(reserved_index));
const decl_buf_top = p.decl_buf.items.len;
const list_buf_top = p.list_buf.items.len;
const enum_buf_top = p.enum_buf.items.len;
@@ -2958,8 +2963,8 @@ fn enumSpec(p: *Parser) Error!QualType {
var e = Enumerator.init(fixed_qt);
while (try p.enumerator(&e)) |field_and_node| {
- try p.enum_buf.append(field_and_node.field);
- try p.list_buf.append(field_and_node.node);
+ try p.enum_buf.append(gpa, field_and_node.field);
+ try p.list_buf.append(gpa, field_and_node.node);
if (p.eatToken(.comma) == null) break;
}
@@ -2996,7 +3001,7 @@ fn enumSpec(p: *Parser) Error!QualType {
const symbol = p.syms.getPtr(field.name, .vars);
_ = try symbol.val.intCast(dest_ty, p.comp);
- try p.tree.value_map.put(p.gpa, field_node, symbol.val);
+ try p.tree.value_map.put(gpa, field_node, symbol.val);
symbol.qt = dest_ty;
field.qt = dest_ty;
@@ -3022,12 +3027,12 @@ fn enumSpec(p: *Parser) Error!QualType {
enum_ty.decl_node = @enumFromInt(reserved_index);
const base_type = attributed_qt.base(p.comp);
std.debug.assert(base_type.type.@"enum".name == enum_ty.name);
- try p.comp.type_store.set(p.gpa, .{ .@"enum" = enum_ty }, @intFromEnum(base_type.qt._index));
+ try p.comp.type_store.set(gpa, .{ .@"enum" = enum_ty }, @intFromEnum(base_type.qt._index));
}
// declare a symbol for the type
if (maybe_ident != null and !defined) {
- try p.syms.define(p.gpa, .{
+ try p.syms.define(gpa, .{
.kind = .@"enum",
.name = enum_ty.name,
.qt = attributed_qt,
@@ -3231,7 +3236,7 @@ fn enumerator(p: *Parser, e: *Enumerator) Error!?EnumFieldAndNode {
.init = field_init,
},
});
- try p.tree.value_map.put(p.gpa, node, e.val);
+ try p.tree.value_map.put(p.comp.gpa, node, e.val);
const interned_name = try p.comp.internString(p.tokSlice(name_tok));
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 {
} else switch (b.nullability) {
.none => {
b.nullability = new;
- try p.attr_buf.append(p.gpa, .{
+ try p.attr_buf.append(p.comp.gpa, .{
.attr = .{ .tag = .nullability, .args = .{
.nullability = .{ .kind = switch (tok_id) {
.keyword_nonnull => .nonnull,
@@ -3341,7 +3346,7 @@ fn msTypeAttribute(p: *Parser) !bool {
.keyword_cdecl,
.keyword_cdecl2,
=> {
- try p.attr_buf.append(p.gpa, .{
+ try p.attr_buf.append(p.comp.gpa, .{
.attr = .{ .tag = .calling_convention, .args = .{
.calling_convention = .{ .cc = switch (p.tok_ids[p.tok_i]) {
.keyword_stdcall,
@@ -3496,7 +3501,7 @@ fn declarator(
var builder: TypeStore.Builder = .{ .parser = p };
_ = try p.typeQual(&builder, true);
- const pointer_qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
+ const pointer_qt = try p.comp.type_store.put(p.comp.gpa, .{ .pointer = .{
.child = d.qt,
.decayed = null,
} });
@@ -3611,6 +3616,7 @@ fn directDeclarator(
base_declarator: *Declarator,
kind: Declarator.Kind,
) Error!QualType {
+ const gpa = p.comp.gpa;
if (p.eatToken(.l_bracket)) |l_bracket| {
// Check for C23 attribute
if (p.tok_ids[p.tok_i] == .l_bracket) {
@@ -3674,7 +3680,7 @@ fn directDeclarator(
try p.err(base_declarator.name, .variable_len_array_file_scope, .{});
}
- const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = outer,
.len = .{ .variable = size.node },
} });
@@ -3690,7 +3696,7 @@ fn directDeclarator(
}
const len = size.val.toInt(u64, p.comp) orelse std.math.maxInt(u64);
- const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = outer,
.len = if (static != null)
.{ .static = len }
@@ -3700,13 +3706,13 @@ fn directDeclarator(
return builder.finishQuals(array_qt);
}
} else if (star) |_| {
- const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = outer,
.len = .unspecified_variable,
} });
return builder.finishQuals(array_qt);
} else {
- const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = outer,
.len = .incomplete,
} });
@@ -3729,7 +3735,7 @@ fn directDeclarator(
// Set after call to `directDeclarator` since we will return
// a function type from here.
base_declarator.declarator_type = .func;
- return p.comp.type_store.put(p.gpa, .{ .func = func_ty });
+ return p.comp.type_store.put(gpa, .{ .func = func_ty });
}
// Set here so the call to directDeclarator for the return type
@@ -3756,7 +3762,7 @@ fn directDeclarator(
const name_tok = try p.expectIdentifier();
const interned_name = try p.comp.internString(p.tokSlice(name_tok));
try p.syms.defineParam(p, interned_name, undefined, name_tok, null);
- try p.param_buf.append(.{
+ try p.param_buf.append(gpa, .{
.name = interned_name,
.name_tok = name_tok,
.qt = .int,
@@ -3776,7 +3782,7 @@ fn directDeclarator(
// a function type from here.
base_declarator.declarator_type = .func;
- return p.comp.type_store.put(p.gpa, .{ .func = func_ty });
+ return p.comp.type_store.put(gpa, .{ .func = func_ty });
} else return base_declarator.qt;
}
@@ -3789,6 +3795,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param {
// Clearing the param buf is handled in directDeclarator.
const param_buf_top = p.param_buf.items.len;
+ const gpa = p.comp.gpa;
while (true) {
const attr_buf_top = p.attr_buf.len;
@@ -3802,7 +3809,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param {
const identifier = try p.expectIdentifier();
try p.err(identifier, .unknown_type_name, .{p.tokSlice(identifier)});
- try p.param_buf.append(.{
+ try p.param_buf.append(gpa, .{
.name = try p.comp.internString(p.tokSlice(identifier)),
.name_tok = identifier,
.qt = .int,
@@ -3882,7 +3889,7 @@ fn paramDecls(p: *Parser) Error!?[]Type.Func.Param {
try p.syms.defineParam(p, interned_name, param_qt, name_tok, node);
}
- try p.param_buf.append(.{
+ try p.param_buf.append(gpa, .{
.name = interned_name,
.name_tok = if (name_tok == 0) first_tok else name_tok,
.qt = param_qt,
@@ -3932,7 +3939,7 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result {
}
var il: InitList = .{};
- defer il.deinit(p.gpa);
+ defer il.deinit(p.comp.gpa);
try p.initializerItem(&il, final_init_qt, l_brace);
@@ -3944,10 +3951,11 @@ fn initializer(p: *Parser, init_qt: QualType) Error!Result {
};
}
-const IndexList = std.ArrayListUnmanaged(u64);
+const IndexList = std.ArrayList(u64);
/// initializerItems : designation? initializer (',' designation? initializer)* ','?
fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenIndex) Error!void {
+ const gpa = p.comp.gpa;
const is_scalar = !init_qt.isInvalid() and init_qt.scalarKind(p.comp) != .none;
if (p.eatToken(.r_brace)) |_| {
@@ -3962,7 +3970,7 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI
}
var index_list: IndexList = .empty;
- defer index_list.deinit(p.gpa);
+ defer index_list.deinit(gpa);
var seen_any = false;
var warned_excess = init_qt.isInvalid();
@@ -3980,14 +3988,14 @@ fn initializerItem(p: *Parser, il: *InitList, init_qt: QualType, l_brace: TokenI
if (item.il.tok != 0 and !init_qt.isInvalid()) {
try p.err(first_tok, .initializer_overrides, .{});
try p.err(item.il.tok, .previous_initializer, .{});
- item.il.deinit(p.gpa);
+ item.il.deinit(gpa);
item.il.* = .{};
}
try p.initializerItem(item.il, item.qt, inner_l_brace);
} else {
// discard further values
var tmp_il: InitList = .{};
- defer tmp_il.deinit(p.gpa);
+ defer tmp_il.deinit(gpa);
try p.initializerItem(&tmp_il, .invalid, inner_l_brace);
if (!warned_excess) try p.err(first_tok, switch (init_qt.base(p.comp).type) {
.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
.l_bracket, .period => index_list.items.len = 0,
else => return false,
}
+ const gpa = p.comp.gpa;
var cur_qt = init_qt;
var cur_il = il;
@@ -4074,8 +4083,8 @@ fn designation(p: *Parser, il: *InitList, init_qt: QualType, index_list: *IndexL
return error.ParsingFailed;
}
- try index_list.append(p.gpa, index_int);
- cur_il = try cur_il.find(p.gpa, index_int);
+ try index_list.append(gpa, index_int);
+ cur_il = try cur_il.find(gpa, index_int);
cur_qt = array_ty.elem;
} else if (p.eatToken(.period)) |period| {
const field_tok = try p.expectIdentifier();
@@ -4094,16 +4103,16 @@ fn designation(p: *Parser, il: *InitList, init_qt: QualType, index_list: *IndexL
if (field.name_tok == 0) if (field.qt.getRecord(p.comp)) |field_record_ty| {
// Recurse into anonymous field if it has a field by the name.
if (!field_record_ty.hasField(p.comp, target_name)) continue;
- try index_list.append(p.gpa, field_index);
- cur_il = try il.find(p.gpa, field_index);
+ try index_list.append(gpa, field_index);
+ cur_il = try il.find(gpa, field_index);
record_ty = field_record_ty;
field_index = 0;
continue;
};
if (field.name == target_name) {
cur_qt = field.qt;
- try index_list.append(p.gpa, field_index);
- cur_il = try cur_il.find(p.gpa, field_index);
+ try index_list.append(gpa, field_index);
+ cur_il = try cur_il.find(gpa, field_index);
break;
}
field_index += 1;
@@ -4132,7 +4141,8 @@ fn findScalarInitializer(
index_list_top: u32,
) Error!bool {
if (qt.isInvalid()) return false;
- if (index_list.items.len <= index_list_top) try index_list.append(p.gpa, 0);
+ const gpa = p.comp.gpa;
+ if (index_list.items.len <= index_list_top) try index_list.append(gpa, 0);
const index = index_list.items[index_list_top];
switch (qt.base(p.comp).type) {
@@ -4147,7 +4157,7 @@ fn findScalarInitializer(
return true;
}
- const elem_il = try il.find(p.gpa, index);
+ const elem_il = try il.find(gpa, index);
if (try p.setInitializerIfEqual(elem_il, complex_ty, first_tok, res) or
try p.findScalarInitializer(
elem_il,
@@ -4180,7 +4190,7 @@ fn findScalarInitializer(
return true;
}
- const elem_il = try il.find(p.gpa, index);
+ const elem_il = try il.find(gpa, index);
if (try p.setInitializerIfEqual(elem_il, vector_ty.elem, first_tok, res) or
try p.findScalarInitializer(
elem_il,
@@ -4229,7 +4239,7 @@ fn findScalarInitializer(
return true;
}
- const elem_il = try il.find(p.gpa, index);
+ const elem_il = try il.find(gpa, index);
if (try p.setInitializerIfEqual(elem_il, array_ty.elem, first_tok, res) or
try p.findScalarInitializer(
elem_il,
@@ -4262,7 +4272,7 @@ fn findScalarInitializer(
}
const field = struct_ty.fields[@intCast(index)];
- const field_il = try il.find(p.gpa, index);
+ const field_il = try il.find(gpa, index);
if (try p.setInitializerIfEqual(field_il, field.qt, first_tok, res) or
try p.findScalarInitializer(
field_il,
@@ -4297,7 +4307,7 @@ fn findScalarInitializer(
}
const field = union_ty.fields[@intCast(index)];
- const field_il = try il.find(p.gpa, index);
+ const field_il = try il.find(gpa, index);
if (try p.setInitializerIfEqual(field_il, field.qt, first_tok, res) or
try p.findScalarInitializer(
field_il,
@@ -4342,7 +4352,8 @@ fn findBracedInitializer(
if (il.node != .null) return .{ .il = il, .qt = qt };
return null;
}
- if (index_list.items.len == 0) try index_list.append(p.gpa, 0);
+ const gpa = p.comp.gpa;
+ if (index_list.items.len == 0) try index_list.append(gpa, 0);
const index = index_list.items[0];
switch (qt.base(p.comp).type) {
@@ -4352,7 +4363,7 @@ fn findBracedInitializer(
if (index < 2) {
index_list.items[0] = index + 1;
index_list.items.len = 1;
- return .{ .il = try il.find(p.gpa, index), .qt = complex_ty };
+ return .{ .il = try il.find(gpa, index), .qt = complex_ty };
}
},
.vector => |vector_ty| {
@@ -4361,7 +4372,7 @@ fn findBracedInitializer(
if (index < vector_ty.len) {
index_list.items[0] = index + 1;
index_list.items.len = 1;
- return .{ .il = try il.find(p.gpa, index), .qt = vector_ty.elem };
+ return .{ .il = try il.find(gpa, index), .qt = vector_ty.elem };
}
},
.array => |array_ty| {
@@ -4374,7 +4385,7 @@ fn findBracedInitializer(
if (index < max_len) {
index_list.items[0] = index + 1;
index_list.items.len = 1;
- return .{ .il = try il.find(p.gpa, index), .qt = array_ty.elem };
+ return .{ .il = try il.find(gpa, index), .qt = array_ty.elem };
}
},
.@"struct" => |struct_ty| {
@@ -4384,7 +4395,7 @@ fn findBracedInitializer(
index_list.items[0] = index + 1;
index_list.items.len = 1;
const field_qt = struct_ty.fields[@intCast(index)].qt;
- return .{ .il = try il.find(p.gpa, index), .qt = field_qt };
+ return .{ .il = try il.find(gpa, index), .qt = field_qt };
}
},
.@"union" => |union_ty| {
@@ -4395,7 +4406,7 @@ fn findBracedInitializer(
index_list.items[0] = index + 1;
index_list.items.len = 1;
const field_qt = union_ty.fields[@intCast(index)].qt;
- return .{ .il = try il.find(p.gpa, index), .qt = field_qt };
+ return .{ .il = try il.find(gpa, index), .qt = field_qt };
}
},
else => {
@@ -4495,6 +4506,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
if (il.node.unpack()) |some| return some;
+ const gpa = p.comp.gpa;
switch (init_qt.base(p.comp).type) {
.complex => |complex_ty| {
if (il.list.items.len == 0) {
@@ -4535,7 +4547,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
128 => .{ .complex = .{ .cf128 = .{ first_val.toFloat(f128, p.comp), second_val.toFloat(f128, p.comp) } } },
else => unreachable,
});
- try p.tree.value_map.put(p.gpa, node, complex_val);
+ try p.tree.value_map.put(gpa, node, complex_val);
return node;
},
.vector => |vector_ty| {
@@ -4555,12 +4567,12 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
.qt = elem_ty,
},
});
- try p.list_buf.append(elem);
+ try p.list_buf.append(gpa, elem);
}
start = init.index + 1;
const elem = try p.convertInitList(init.list, elem_ty);
- try p.list_buf.append(elem);
+ try p.list_buf.append(gpa, elem);
}
if (start < max_len) {
@@ -4571,7 +4583,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
.qt = elem_ty,
},
});
- try p.list_buf.append(elem);
+ try p.list_buf.append(gpa, elem);
}
return p.addNode(.{ .array_init_expr = .{
@@ -4605,12 +4617,12 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
.qt = elem_ty,
},
});
- try p.list_buf.append(elem);
+ try p.list_buf.append(gpa, elem);
}
start = init.index + 1;
const elem = try p.convertInitList(init.list, elem_ty);
- try p.list_buf.append(elem);
+ try p.list_buf.append(gpa, elem);
}
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
var arr_init_qt = init_qt;
if (array_ty.len == .incomplete) {
- arr_init_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ arr_init_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = array_ty.elem,
.len = .{ .fixed = start },
} });
@@ -4633,7 +4645,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
.qt = elem_ty,
},
});
- try p.list_buf.append(elem);
+ try p.list_buf.append(gpa, elem);
}
return p.addNode(.{ .array_init_expr = .{
@@ -4651,7 +4663,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
for (struct_ty.fields, 0..) |field, i| {
if (init_index < il.list.items.len and il.list.items[init_index].index == i) {
const item = try p.convertInitList(il.list.items[init_index].list, field.qt);
- try p.list_buf.append(item);
+ try p.list_buf.append(gpa, item);
init_index += 1;
} else {
const item = try p.addNode(.{
@@ -4660,7 +4672,7 @@ fn convertInitList(p: *Parser, il: InitList, init_qt: QualType) Error!Node.Index
.qt = field.qt,
},
});
- try p.list_buf.append(item);
+ try p.list_buf.append(gpa, item);
}
}
@@ -4706,19 +4718,20 @@ fn msvcAsmStmt(p: *Parser) Error!?Node.Index {
}
/// asmOperand : ('[' IDENTIFIER ']')? asmStr '(' expr ')'
-fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void {
+fn asmOperand(p: *Parser, names: *std.ArrayList(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void {
+ const gpa = p.comp.gpa;
if (p.eatToken(.l_bracket)) |l_bracket| {
const ident = (try p.eatIdentifier()) orelse {
try p.err(p.tok_i, .expected_identifier, .{});
return error.ParsingFailed;
};
- try names.append(ident);
+ try names.append(gpa, ident);
try p.expectClosing(l_bracket, .r_bracket);
} else {
- try names.append(null);
+ try names.append(gpa, null);
}
const constraint = try p.asmStr();
- try constraints.append(constraint.node);
+ try constraints.append(gpa, constraint.node);
const l_paren = p.eatToken(.l_paren) orelse {
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
const maybe_res = try p.expr();
try p.expectClosing(l_paren, .r_paren);
const res = try p.expectResult(maybe_res);
- try exprs.append(res.node);
+ try exprs.append(gpa, res.node);
}
/// gnuAsmStmt
@@ -4737,6 +4750,7 @@ fn asmOperand(p: *Parser, names: *std.array_list.Managed(?TokenIndex), constrain
/// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)*
/// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)* : IDENTIFIER (',' IDENTIFIER)*
fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex, l_paren: TokenIndex) Error!Node.Index {
+ const gpa = p.comp.gpa;
const asm_str = try p.asmStr();
try p.checkAsmStr(asm_str.val, l_paren);
@@ -4752,18 +4766,22 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
const expected_items = 8; // arbitrarily chosen, most assembly will have fewer than 8 inputs/outputs/constraints/names
const bytes_needed = expected_items * @sizeOf(?TokenIndex) + expected_items * 3 * @sizeOf(Node.Index);
- var stack_fallback = std.heap.stackFallback(bytes_needed, p.gpa);
+ var stack_fallback = std.heap.stackFallback(bytes_needed, gpa);
const allocator = stack_fallback.get();
// TODO: Consider using a TokenIndex of 0 instead of null if we need to store the names in the tree
- var names = std.array_list.Managed(?TokenIndex).initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
- defer names.deinit();
- var constraints = NodeList.initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
- defer constraints.deinit();
- var exprs = NodeList.initCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
- defer exprs.deinit();
- var clobbers = NodeList.initCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
- defer clobbers.deinit();
+ var names: std.ArrayList(?TokenIndex) = .empty;
+ defer names.deinit(allocator);
+ names.ensureUnusedCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
+ var constraints: NodeList = .empty;
+ defer constraints.deinit(allocator);
+ constraints.ensureUnusedCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded
+ var exprs: NodeList = .empty;
+ defer exprs.deinit(allocator);
+ exprs.ensureUnusedCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
+ var clobbers: NodeList = .empty;
+ defer clobbers.deinit(allocator);
+ clobbers.ensureUnusedCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded
// Outputs
var ate_extra_colon = false;
@@ -4813,7 +4831,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
if (!ate_extra_colon and p.tok_ids[p.tok_i].isStringLiteral()) {
while (true) {
const clobber = try p.asmStr();
- try clobbers.append(clobber.node);
+ try clobbers.append(allocator, clobber.node);
if (p.eatToken(.comma) == null) break;
}
}
@@ -4837,10 +4855,10 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
};
const ident_str = p.tokSlice(ident);
const label = p.findLabel(ident_str) orelse blk: {
- try p.labels.append(.{ .unresolved_goto = ident });
+ try p.labels.append(gpa, .{ .unresolved_goto = ident });
break :blk ident;
};
- try names.append(ident);
+ try names.append(allocator, ident);
const label_addr_node = try p.addNode(.{
.addr_of_label = .{
@@ -4848,7 +4866,7 @@ fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, asm_tok: TokenIndex
.qt = .void_pointer,
},
});
- try exprs.append(label_addr_node);
+ try exprs.append(allocator, label_addr_node);
num_labels += 1;
if (p.eatToken(.comma) == null) break;
@@ -4922,7 +4940,7 @@ fn assembly(p: *Parser, kind: enum { global, decl_label, stmt }) Error!?Node.Ind
const str = try p.removeNull(asm_str.val);
const attr = Attribute{ .tag = .asm_label, .args = .{ .asm_label = .{ .name = str } }, .syntax = .keyword };
- try p.attr_buf.append(p.gpa, .{ .attr = attr, .tok = asm_tok });
+ try p.attr_buf.append(p.comp.gpa, .{ .attr = attr, .tok = asm_tok });
},
.global => {
const asm_str = try p.asmStr();
@@ -4985,6 +5003,7 @@ fn asmStr(p: *Parser) Error!Result {
fn stmt(p: *Parser) Error!Node.Index {
if (try p.labeledStmt()) |some| return some;
if (try p.compoundStmt(false, null)) |some| return some;
+ const gpa = p.comp.gpa;
if (p.eatToken(.keyword_if)) |kw_if| {
const l_paren = try p.expectToken(.l_paren);
@@ -5035,14 +5054,13 @@ fn stmt(p: *Parser) Error!Node.Index {
try p.expectClosing(l_paren, .r_paren);
const old_switch = p.@"switch";
- var @"switch" = Switch{
- .ranges = std.array_list.Managed(Switch.Range).init(p.gpa),
+ var @"switch": Switch = .{
.qt = cond.qt,
.comp = p.comp,
};
p.@"switch" = &@"switch";
defer {
- @"switch".ranges.deinit();
+ @"switch".ranges.deinit(gpa);
p.@"switch" = old_switch;
}
@@ -5183,7 +5201,7 @@ fn stmt(p: *Parser) Error!Node.Index {
p.computed_goto_tok = p.computed_goto_tok orelse goto_tok;
if (!goto_expr.qt.isInvalid() and !goto_expr.qt.isPointer(p.comp)) {
- const result_qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
+ const result_qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
.child = .{ .@"const" = true, ._index = .void },
.decayed = null,
} });
@@ -5204,7 +5222,7 @@ fn stmt(p: *Parser) Error!Node.Index {
const name_tok = try p.expectIdentifier();
const str = p.tokSlice(name_tok);
if (p.findLabel(str) == null) {
- try p.labels.append(.{ .unresolved_goto = name_tok });
+ try p.labels.append(gpa, .{ .unresolved_goto = name_tok });
}
_ = try p.expectToken(.semicolon);
return p.addNode(.{ .goto_stmt = .{ .label_tok = name_tok } });
@@ -5259,7 +5277,7 @@ fn labeledStmt(p: *Parser) Error!?Node.Index {
try p.err(some, .previous_label, .{str});
} else {
p.label_count += 1;
- try p.labels.append(.{ .label = name_tok });
+ try p.labels.append(p.comp.gpa, .{ .label = name_tok });
var i: usize = 0;
while (i < p.labels.items.len) {
if (p.labels.items[i] == .unresolved_goto and
@@ -5370,6 +5388,7 @@ const StmtExprState = struct {
fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState) Error!?Node.Index {
const l_brace = p.eatToken(.l_brace) orelse return null;
+ const gpa = p.comp.gpa;
const decl_buf_top = p.decl_buf.items.len;
defer p.decl_buf.items.len = decl_buf_top;
@@ -5406,7 +5425,7 @@ fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState)
.last_expr_qt = s.qt(&p.tree),
};
}
- try p.decl_buf.append(s);
+ try p.decl_buf.append(gpa, s);
if (noreturn_index == null and p.nodeIsNoreturn(s) == .yes) {
noreturn_index = p.tok_i;
@@ -5456,10 +5475,10 @@ fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState)
.return_qt = ret_qt,
.operand = .{ .implicit = return_zero },
} });
- try p.decl_buf.append(implicit_ret);
+ try p.decl_buf.append(gpa, implicit_ret);
}
- if (p.func.ident) |some| try p.decl_buf.insert(decl_buf_top, some.node);
- if (p.func.pretty_ident) |some| try p.decl_buf.insert(decl_buf_top, some.node);
+ if (p.func.ident) |some| try p.decl_buf.insert(gpa, decl_buf_top, some.node);
+ if (p.func.pretty_ident) |some| try p.decl_buf.insert(gpa, decl_buf_top, some.node);
}
return try p.addNode(.{ .compound_stmt = .{
@@ -5988,6 +6007,7 @@ pub const Result = struct {
fn adjustCondExprPtrs(a: *Result, tok: TokenIndex, b: *Result, p: *Parser) !bool {
assert(a.qt.isPointer(p.comp) and b.qt.isPointer(p.comp));
+ const gpa = p.comp.gpa;
const a_elem = a.qt.childType(p.comp);
const b_elem = b.qt.childType(p.comp);
@@ -6014,14 +6034,14 @@ pub const Result = struct {
}
if (!adjusted_elem_qt.eqlQualified(a_elem, p.comp)) {
- a.qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
+ a.qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
.child = adjusted_elem_qt,
.decayed = null,
} });
try a.implicitCast(p, .bitcast, tok);
}
if (!adjusted_elem_qt.eqlQualified(b_elem, p.comp)) {
- b.qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
+ b.qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
.child = adjusted_elem_qt,
.decayed = null,
} });
@@ -6659,7 +6679,7 @@ pub const Result = struct {
/// Saves value without altering the result.
fn putValue(res: *const Result, p: *Parser) !void {
if (res.val.opt_ref == .none or res.val.opt_ref == .null) return;
- if (!p.in_macro) try p.tree.value_map.put(p.gpa, res.node, res.val);
+ if (!p.in_macro) try p.tree.value_map.put(p.comp.gpa, res.node, res.val);
}
fn castType(res: *Result, p: *Parser, dest_qt: QualType, operand_tok: TokenIndex, l_paren: TokenIndex) !void {
@@ -7085,9 +7105,13 @@ pub const Result = struct {
return; // ok
}
} else {
- if (c == .assign and (dest_unqual.is(p.comp, .array) or dest_unqual.is(p.comp, .func))) {
- try p.err(tok, .not_assignable, .{});
- return;
+ if (c == .assign) {
+ const base_type = dest_unqual.base(p.comp);
+ switch (base_type.type) {
+ .array => return p.err(tok, .array_not_assignable, .{base_type.qt}),
+ .func => return p.err(tok, .non_object_not_assignable, .{base_type.qt}),
+ else => {},
+ }
} else if (c == .test_coerce) {
return error.CoercionFailed;
}
@@ -7186,6 +7210,47 @@ fn nonAssignExpr(assign_node: std.meta.Tag(Node)) std.meta.Tag(Node) {
};
}
+fn unwrapNestedOperation(p: *Parser, node_idx: Node.Index) ?Node.DeclRef {
+ return loop: switch (node_idx.get(&p.tree)) {
+ inline .array_access_expr,
+ .member_access_ptr_expr,
+ .member_access_expr,
+ => |memb_or_arr_access| continue :loop memb_or_arr_access.base.get(&p.tree),
+ inline .cast,
+ .paren_expr,
+ .pre_inc_expr,
+ .post_inc_expr,
+ .pre_dec_expr,
+ .post_dec_expr,
+ => |cast_or_unary| continue :loop cast_or_unary.operand.get(&p.tree),
+ .sub_expr,
+ .add_expr,
+ => |bin| continue :loop bin.lhs.get(&p.tree),
+ .call_expr => |call| continue :loop call.callee.get(&p.tree),
+ .decl_ref_expr => |decl_ref| decl_ref,
+ else => null,
+ };
+}
+
+fn issueDeclaredConstHereNote(p: *Parser, decl_ref: Tree.Node.DeclRef, var_name: []const u8) Compilation.Error!void {
+ const location = switch (decl_ref.decl.get(&p.tree)) {
+ .variable => |variable| variable.name_tok,
+ .param => |param| param.name_tok,
+ else => return,
+ };
+ try p.err(location, .declared_const_here, .{var_name});
+}
+
+fn issueConstAssignmetDiagnostics(p: *Parser, node_idx: Node.Index, tok: TokenIndex) Compilation.Error!void {
+ if (p.unwrapNestedOperation(node_idx)) |unwrapped| {
+ const name = p.tokSlice(unwrapped.name_tok);
+ try p.err(tok, .const_var_assignment, .{ name, unwrapped.qt });
+ try p.issueDeclaredConstHereNote(unwrapped, name);
+ } else {
+ try p.err(tok, .not_assignable, .{});
+ }
+}
+
/// assignExpr
/// : condExpr
/// | unExpr ('=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=') assignExpr
@@ -7209,7 +7274,7 @@ fn assignExpr(p: *Parser) Error!?Result {
var is_const: bool = undefined;
if (!p.tree.isLvalExtra(lhs.node, &is_const) or is_const) {
- try p.err(tok, .not_assignable, .{});
+ try p.issueConstAssignmetDiagnostics(lhs.node, tok);
lhs.qt = .invalid;
}
@@ -7702,12 +7767,13 @@ fn shufflevector(p: *Parser, builtin_tok: TokenIndex) Error!Result {
};
const negative_one = try Value.intern(p.comp, .{ .int = .{ .i64 = -1 } });
+ const gpa = p.comp.gpa;
const list_buf_top = p.list_buf.items.len;
defer p.list_buf.items.len = list_buf_top;
while (p.eatToken(.comma)) |_| {
const index_tok = p.tok_i;
const index = try p.integerConstExpr(.gnu_folding_extension);
- try p.list_buf.append(index.node);
+ try p.list_buf.append(gpa, index.node);
if (index.val.compare(.lt, negative_one, p.comp)) {
try p.err(index_tok, .shufflevector_negative_index, .{});
} 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 {
} else if (p.list_buf.items.len == list_buf_top) {
res_qt = lhs.qt;
} else {
- res_qt = try p.comp.type_store.put(p.gpa, .{ .vector = .{
+ res_qt = try p.comp.type_store.put(gpa, .{ .vector = .{
.elem = lhs.qt.childType(p.comp),
.len = @intCast(p.list_buf.items.len - list_buf_top),
} });
@@ -8086,6 +8152,7 @@ fn computeOffset(p: *Parser, res: Result) !Value {
/// | keyword_alignof '(' typeName ')'
/// | keyword_c23_alignof '(' typeName ')'
fn unExpr(p: *Parser) Error!?Result {
+ const gpa = p.comp.gpa;
const tok = p.tok_i;
switch (p.tok_ids[tok]) {
.ampersand_ampersand => {
@@ -8097,7 +8164,7 @@ fn unExpr(p: *Parser) Error!?Result {
const str = p.tokSlice(name_tok);
if (p.findLabel(str) == null) {
- try p.labels.append(.{ .unresolved_goto = name_tok });
+ try p.labels.append(gpa, .{ .unresolved_goto = name_tok });
}
return .{
@@ -8139,7 +8206,7 @@ fn unExpr(p: *Parser) Error!?Result {
}
addr_val = try p.computeOffset(operand);
- operand.qt = try p.comp.type_store.put(p.gpa, .{ .pointer = .{
+ operand.qt = try p.comp.type_store.put(gpa, .{ .pointer = .{
.child = operand.qt,
.decayed = null,
} });
@@ -8845,6 +8912,7 @@ fn checkComplexArg(p: *Parser, builtin_tok: TokenIndex, first_after: TokenIndex,
}
fn callExpr(p: *Parser, lhs: Result) Error!Result {
+ const gpa = p.comp.gpa;
const l_paren = p.tok_i;
p.tok_i += 1;
@@ -8892,7 +8960,7 @@ fn callExpr(p: *Parser, lhs: Result) Error!Result {
try call_expr.checkVarArg(p, first_after, param_tok, &arg, arg_count);
try arg.saveValue(p);
- try p.list_buf.append(arg.node);
+ try p.list_buf.append(gpa, arg.node);
arg_count += 1;
_ = p.eatToken(.comma) orelse {
@@ -8927,7 +8995,7 @@ fn callExpr(p: *Parser, lhs: Result) Error!Result {
}
}
try arg.saveValue(p);
- try p.list_buf.append(arg.node);
+ try p.list_buf.append(gpa, arg.node);
arg_count += 1;
_ = p.eatToken(.comma) orelse {
@@ -9024,6 +9092,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
return grouped_expr;
}
+ const gpa = p.comp.gpa;
switch (p.tok_ids[p.tok_i]) {
.identifier, .extended_identifier => {
const name_tok = try p.expectIdentifier();
@@ -9134,7 +9203,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
else
try p.err(name_tok, .implicit_func_decl, .{name});
- const func_qt = try p.comp.type_store.put(p.gpa, .{ .func = .{
+ const func_qt = try p.comp.type_store.put(gpa, .{ .func = .{
.return_type = .int,
.kind = .old_style,
.params = &.{},
@@ -9150,7 +9219,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
},
});
- try p.decl_buf.append(node);
+ try p.decl_buf.append(gpa, node);
try p.syms.declareSymbol(p, interned_name, func_qt, name_tok, node);
return .{
@@ -9211,8 +9280,11 @@ fn primaryExpr(p: *Parser) Error!?Result {
const strings_top = p.strings.items.len;
defer p.strings.items.len = strings_top;
- try p.strings.appendSlice(p.tokSlice(p.func.name));
- try p.strings.append(0);
+ const name = p.tokSlice(p.func.name);
+ try p.strings.ensureUnusedCapacity(gpa, name.len + 1);
+
+ p.strings.appendSliceAssumeCapacity(name);
+ p.strings.appendAssumeCapacity(0);
const predef = try p.makePredefinedIdentifier(p.strings.items[strings_top..]);
ty = predef.qt;
p.func.ident = predef;
@@ -9220,7 +9292,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
const predef = try p.makePredefinedIdentifier("\x00");
ty = predef.qt;
p.func.ident = predef;
- try p.decl_buf.append(predef.node);
+ try p.decl_buf.append(gpa, predef.node);
}
if (p.func.qt == null) try p.err(p.tok_i, .predefined_top_level, .{});
@@ -9241,7 +9313,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
if (p.func.pretty_ident) |some| {
qt = some.qt;
} else if (p.func.qt) |func_qt| {
- var sf = std.heap.stackFallback(1024, p.gpa);
+ var sf = std.heap.stackFallback(1024, gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
@@ -9255,7 +9327,7 @@ fn primaryExpr(p: *Parser) Error!?Result {
const predef = try p.makePredefinedIdentifier("top level\x00");
qt = predef.qt;
p.func.pretty_ident = predef;
- try p.decl_buf.append(predef.node);
+ try p.decl_buf.append(gpa, predef.node);
}
if (p.func.qt == null) try p.err(p.tok_i, .predefined_top_level, .{});
return .{
@@ -9332,7 +9404,8 @@ fn primaryExpr(p: *Parser) Error!?Result {
}
fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result {
- const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ const gpa = p.comp.gpa;
+ const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = .{ .@"const" = true, ._index = .int_char },
.len = .{ .fixed = slice.len },
} });
@@ -9340,7 +9413,7 @@ fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result {
const val = try Value.intern(p.comp, .{ .bytes = slice });
const str_lit = try p.addNode(.{ .string_literal_expr = .{ .qt = array_qt, .literal_tok = p.tok_i, .kind = .ascii } });
- if (!p.in_macro) try p.tree.value_map.put(p.gpa, str_lit, val);
+ if (!p.in_macro) try p.tree.value_map.put(gpa, str_lit, val);
return .{ .qt = array_qt, .node = try p.addNode(.{
.variable = .{
@@ -9356,6 +9429,7 @@ fn makePredefinedIdentifier(p: *Parser, slice: []const u8) !Result {
}
fn stringLiteral(p: *Parser) Error!Result {
+ const gpa = p.comp.gpa;
const string_start = p.tok_i;
var string_end = p.tok_i;
var string_kind: text_literal.Kind = .char;
@@ -9380,7 +9454,7 @@ fn stringLiteral(p: *Parser) Error!Result {
defer p.strings.items.len = strings_top;
const literal_start = mem.alignForward(usize, strings_top, @intFromEnum(char_width));
- try p.strings.resize(literal_start);
+ try p.strings.resize(gpa, literal_start);
while (p.tok_i < string_end) : (p.tok_i += 1) {
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 {
.incorrect_encoding_is_error = count > 1,
};
- try p.strings.ensureUnusedCapacity((slice.len + 1) * @intFromEnum(char_width)); // +1 for null terminator
+ try p.strings.ensureUnusedCapacity(gpa, (slice.len + 1) * @intFromEnum(char_width)); // +1 for null terminator
while (try char_literal_parser.next()) |item| switch (item) {
.value => |v| {
switch (char_width) {
@@ -9443,7 +9517,7 @@ fn stringLiteral(p: *Parser) Error!Result {
const dest_len = std.mem.alignBackward(usize, capacity_slice.len, 2);
const dest = std.mem.bytesAsSlice(u16, capacity_slice[0..dest_len]);
const words_written = std.unicode.utf8ToUtf16Le(dest, view.bytes) catch unreachable;
- p.strings.resize(p.strings.items.len + words_written * 2) catch unreachable;
+ p.strings.resize(gpa, p.strings.items.len + words_written * 2) catch unreachable;
},
.@"4" => {
var it = view.iterator();
@@ -9465,11 +9539,11 @@ fn stringLiteral(p: *Parser) Error!Result {
p.comp.interner.strings.items.len,
string_kind.internalStorageAlignment(p.comp),
);
- try p.comp.interner.strings.resize(p.gpa, interned_align);
+ try p.comp.interner.strings.resize(gpa, interned_align);
const val = try Value.intern(p.comp, .{ .bytes = slice });
- const array_qt = try p.comp.type_store.put(p.gpa, .{ .array = .{
+ const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{
.elem = string_kind.elementType(p.comp),
.len = .{ .fixed = @divExact(slice.len, @intFromEnum(char_width)) },
} });
@@ -9510,6 +9584,7 @@ fn charLiteral(p: *Parser) Error!?Result {
if (char_kind == .utf_8) try p.err(p.tok_i, .u8_char_lit, .{});
var val: u32 = 0;
+ const gpa = p.comp.gpa;
const slice = char_kind.contentSlice(p.tokSlice(p.tok_i));
var is_multichar = false;
@@ -9528,21 +9603,24 @@ fn charLiteral(p: *Parser) Error!?Result {
};
const max_chars_expected = 4;
- var stack_fallback = std.heap.stackFallback(max_chars_expected * @sizeOf(u32), p.comp.gpa);
- var chars = std.array_list.Managed(u32).initCapacity(stack_fallback.get(), max_chars_expected) catch unreachable; // stack allocation already succeeded
- defer chars.deinit();
+ var sf = std.heap.stackFallback(max_chars_expected * @sizeOf(u32), gpa);
+ const allocator = sf.get();
+ var chars: std.ArrayList(u32) = .empty;
+ defer chars.deinit(allocator);
+
+ chars.ensureUnusedCapacity(allocator, max_chars_expected) catch unreachable; // stack allocation already succeeded
while (try char_literal_parser.next()) |item| switch (item) {
- .value => |v| try chars.append(v),
- .codepoint => |c| try chars.append(c),
+ .value => |v| try chars.append(allocator, v),
+ .codepoint => |c| try chars.append(allocator, c),
.improperly_encoded => |s| {
- try chars.ensureUnusedCapacity(s.len);
+ try chars.ensureUnusedCapacity(allocator, s.len);
for (s) |c| chars.appendAssumeCapacity(c);
},
.utf8_text => |view| {
var it = view.iterator();
var max_codepoint_seen: u21 = 0;
- try chars.ensureUnusedCapacity(view.bytes.len);
+ try chars.ensureUnusedCapacity(allocator, view.bytes.len);
while (it.nextCodepoint()) |c| {
max_codepoint_seen = @max(max_codepoint_seen, c);
chars.appendAssumeCapacity(c);
@@ -9603,7 +9681,7 @@ fn charLiteral(p: *Parser) Error!?Result {
_ = try value.intCast(.char, p.comp);
}
- const res = Result{
+ const res: Result = .{
.qt = if (p.in_macro) macro_qt else char_literal_qt,
.val = value,
.node = try p.addNode(.{ .char_literal = .{
@@ -9618,7 +9696,7 @@ fn charLiteral(p: *Parser) Error!?Result {
},
} }),
};
- if (!p.in_macro) try p.tree.value_map.put(p.gpa, res.node, res.val);
+ if (!p.in_macro) try p.tree.value_map.put(gpa, res.node, res.val);
return res;
}
@@ -9633,7 +9711,7 @@ fn parseFloat(p: *Parser, buf: []const u8, suffix: NumberSuffix, tok_i: TokenInd
else => unreachable,
};
const val = try Value.intern(p.comp, key: {
- try p.strings.ensureUnusedCapacity(buf.len);
+ try p.strings.ensureUnusedCapacity(p.comp.gpa, buf.len);
const strings_top = p.strings.items.len;
defer p.strings.items.len = strings_top;
@@ -9821,14 +9899,15 @@ fn parseInt(p: *Parser, prefix: NumberPrefix, buf: []const u8, suffix: NumberSuf
}
fn bitInt(p: *Parser, base: u8, buf: []const u8, suffix: NumberSuffix, tok_i: TokenIndex) Error!Result {
+ const gpa = p.comp.gpa;
try p.err(tok_i, .pre_c23_compat, .{"'_BitInt' suffix for literals"});
try p.err(tok_i, .bitint_suffix, .{});
- var managed = try big.int.Managed.init(p.gpa);
+ var managed = try big.int.Managed.init(gpa);
defer managed.deinit();
{
- try p.strings.ensureUnusedCapacity(buf.len);
+ try p.strings.ensureUnusedCapacity(gpa, buf.len);
const strings_top = p.strings.items.len;
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
break :blk @intCast(bits_needed);
};
- const int_qt = try p.comp.type_store.put(p.gpa, .{ .bit_int = .{
+ const int_qt = try p.comp.type_store.put(gpa, .{ .bit_int = .{
.bits = bits_needed,
.signedness = suffix.signedness(),
} });
@@ -9986,6 +10065,7 @@ fn parseNoEval(p: *Parser, comptime func: fn (*Parser) Error!?Result) Error!Resu
/// : typeName ':' assignExpr
/// | keyword_default ':' assignExpr
fn genericSelection(p: *Parser) Error!?Result {
+ const gpa = p.comp.gpa;
const kw_generic = p.tok_i;
p.tok_i += 1;
const l_paren = try p.expectToken(.l_paren);
@@ -10030,8 +10110,8 @@ fn genericSelection(p: *Parser) Error!?Result {
.expr = res.node,
},
});
- try p.list_buf.append(res.node);
- try p.param_buf.append(.{ .name = undefined, .qt = qt, .name_tok = start, .node = .null });
+ try p.list_buf.append(gpa, res.node);
+ try p.param_buf.append(gpa, .{ .name = undefined, .qt = qt, .name_tok = start, .node = .null });
if (qt.eql(controlling_qt, p.comp)) {
if (chosen_tok == null) {
@@ -10083,7 +10163,7 @@ fn genericSelection(p: *Parser) Error!?Result {
return error.ParsingFailed;
}
} else if (default_tok != null) {
- try p.list_buf.append(default.node);
+ try p.list_buf.append(gpa, default.node);
}
for (p.list_buf.items[list_buf_top..], list_buf_top..) |item, i| {
lib/compiler/aro/aro/Pragma.zig
@@ -60,7 +60,7 @@ pub fn pasteTokens(pp: *Preprocessor, start_idx: TokenIndex) ![]const u8 {
.string_literal => {
if (rparen_count != 0) return error.ExpectedStringLiteral;
const str = pp.expandedSlice(tok);
- try pp.char_buf.appendSlice(str[1 .. str.len - 1]);
+ try pp.char_buf.appendSlice(pp.comp.gpa, str[1 .. str.len - 1]);
},
else => return error.ExpectedStringLiteral,
}
@@ -194,7 +194,7 @@ pub const Diagnostic = struct {
};
pub fn err(pp: *Preprocessor, tok_i: TokenIndex, diagnostic: Diagnostic, args: anytype) Compilation.Error!void {
- var sf = std.heap.stackFallback(1024, pp.gpa);
+ var sf = std.heap.stackFallback(1024, pp.comp.gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
lib/compiler/aro/aro/Preprocessor.zig
@@ -21,7 +21,7 @@ const Token = Tree.Token;
const TokenWithExpansionLocs = Tree.TokenWithExpansionLocs;
const DefineMap = std.StringArrayHashMapUnmanaged(Macro);
-const RawTokenList = std.array_list.Managed(RawToken);
+const RawTokenList = std.ArrayList(RawToken);
const max_include_depth = 200;
/// Errors that can be returned when expanding a macro.
@@ -115,16 +115,15 @@ const TokenState = struct {
comp: *Compilation,
diagnostics: *Diagnostics,
-gpa: mem.Allocator,
arena: std.heap.ArenaAllocator,
-defines: DefineMap = .{},
+defines: DefineMap = .empty,
/// Do not directly mutate this; use addToken / addTokenAssumeCapacity / ensureTotalTokenCapacity / ensureUnusedTokenCapacity
-tokens: Token.List = .{},
+tokens: Token.List = .empty,
/// Do not directly mutate this; must be kept in sync with `tokens`
-expansion_entries: std.MultiArrayList(ExpansionEntry) = .{},
-token_buf: RawTokenList,
-char_buf: std.array_list.Managed(u8),
+expansion_entries: std.MultiArrayList(ExpansionEntry) = .empty,
+token_buf: RawTokenList = .empty,
+char_buf: std.ArrayList(u8) = .empty,
/// Counter that is incremented each time preprocess() is called
/// Can be used to distinguish multiple preprocessings of the same file
preprocess_count: u32 = 0,
@@ -133,9 +132,9 @@ add_expansion_nl: u32 = 0,
include_depth: u8 = 0,
counter: u32 = 0,
expansion_source_loc: Source.Location = undefined,
-poisoned_identifiers: std.StringHashMap(void),
+poisoned_identifiers: std.StringHashMapUnmanaged(void) = .empty,
/// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any
-include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},
+include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty,
/// Store `keyword_define` and `keyword_undef` tokens.
/// Used to implement preprocessor debug dump options
@@ -143,7 +142,7 @@ include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},
store_macro_tokens: bool = false,
/// Memory is retained to avoid allocation on every single token.
-top_expansion_buf: ExpandBuf,
+top_expansion_buf: ExpandBuf = .empty,
/// Dump current state to stderr.
verbose: bool = false,
@@ -156,7 +155,7 @@ hideset: Hideset,
/// Epoch used for __DATE__, __TIME__, and possibly __TIMESTAMP__
source_epoch: SourceEpoch,
-m_times: std.AutoHashMapUnmanaged(Source.Id, u64) = .{},
+m_times: std.AutoHashMapUnmanaged(Source.Id, u64) = .empty,
/// The dependency file tracking all includes and embeds.
dep_file: ?*DepFile = null,
@@ -176,12 +175,7 @@ pub fn init(comp: *Compilation, source_epoch: SourceEpoch) Preprocessor {
const pp: Preprocessor = .{
.comp = comp,
.diagnostics = comp.diagnostics,
- .gpa = comp.gpa,
- .arena = std.heap.ArenaAllocator.init(comp.gpa),
- .token_buf = RawTokenList.init(comp.gpa),
- .char_buf = std.array_list.Managed(u8).init(comp.gpa),
- .poisoned_identifiers = std.StringHashMap(void).init(comp.gpa),
- .top_expansion_buf = ExpandBuf.init(comp.gpa),
+ .arena = .init(comp.gpa),
.hideset = .{ .comp = comp },
.source_epoch = source_epoch,
};
@@ -207,7 +201,7 @@ pub fn initDefault(comp: *Compilation) !Preprocessor {
// `param_tok_id` is comptime so that the generated `tokens` list is unique for every macro.
fn addBuiltinMacro(pp: *Preprocessor, name: []const u8, is_func: bool, comptime param_tok_id: Token.Id) !void {
- try pp.defines.putNoClobber(pp.gpa, name, .{
+ try pp.defines.putNoClobber(pp.comp.gpa, name, .{
.params = &[1][]const u8{"X"},
.tokens = &[1]RawToken{.{
.id = param_tok_id,
@@ -248,30 +242,33 @@ pub fn addBuiltinMacros(pp: *Preprocessor) !void {
}
pub fn deinit(pp: *Preprocessor) void {
- pp.defines.deinit(pp.gpa);
- pp.tokens.deinit(pp.gpa);
+ const gpa = pp.comp.gpa;
+ pp.defines.deinit(gpa);
+ pp.tokens.deinit(gpa);
pp.arena.deinit();
- pp.token_buf.deinit();
- pp.char_buf.deinit();
- pp.poisoned_identifiers.deinit();
- pp.include_guards.deinit(pp.gpa);
- pp.top_expansion_buf.deinit();
+ pp.token_buf.deinit(gpa);
+ pp.char_buf.deinit(gpa);
+ pp.poisoned_identifiers.deinit(gpa);
+ pp.include_guards.deinit(gpa);
+ pp.top_expansion_buf.deinit(gpa);
pp.hideset.deinit();
- for (pp.expansion_entries.items(.locs)) |locs| TokenWithExpansionLocs.free(locs, pp.gpa);
- pp.expansion_entries.deinit(pp.gpa);
- pp.m_times.deinit(pp.gpa);
+ for (pp.expansion_entries.items(.locs)) |locs| TokenWithExpansionLocs.free(locs, gpa);
+ pp.expansion_entries.deinit(gpa);
+ pp.m_times.deinit(gpa);
+ pp.* = undefined;
}
/// Free buffers that are not needed after preprocessing
fn clearBuffers(pp: *Preprocessor) void {
- pp.token_buf.clearAndFree();
- pp.char_buf.clearAndFree();
- pp.top_expansion_buf.clearAndFree();
+ const gpa = pp.comp.gpa;
+ pp.token_buf.clearAndFree(gpa);
+ pp.char_buf.clearAndFree(gpa);
+ pp.top_expansion_buf.clearAndFree(gpa);
pp.hideset.clearAndFree();
}
fn mTime(pp: *Preprocessor, source_id: Source.Id) !u64 {
- const gop = try pp.m_times.getOrPut(pp.gpa, source_id);
+ const gop = try pp.m_times.getOrPut(pp.comp.gpa, source_id);
if (!gop.found_existing) {
gop.value_ptr.* = pp.comp.getSourceMTimeUncached(source_id) orelse 0;
}
@@ -385,6 +382,7 @@ fn findIncludeGuard(pp: *Preprocessor, source: Source) ?[]const u8 {
}
fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!TokenWithExpansionLocs {
+ const gpa = pp.comp.gpa;
var guard_name = pp.findIncludeGuard(source);
pp.preprocess_count += 1;
@@ -418,7 +416,7 @@ fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!TokenWithExpans
tok = tokenizer.next();
if (tok.id == .nl or tok.id == .eof) break;
if (tok.id == .whitespace) tok.id = .macro_ws;
- try pp.top_expansion_buf.append(tokFromRaw(tok));
+ try pp.top_expansion_buf.append(gpa, tokFromRaw(tok));
}
try pp.stringify(pp.top_expansion_buf.items);
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
try pp.err(tok, .newline_eof, .{});
}
if (guard_name) |name| {
- if (try pp.include_guards.fetchPut(pp.gpa, source.id, name)) |prev| {
+ if (try pp.include_guards.fetchPut(pp.comp.gpa, source.id, name)) |prev| {
assert(mem.eql(u8, name, prev.value));
}
}
@@ -761,8 +759,11 @@ pub const Diagnostic = @import("Preprocessor/Diagnostic.zig");
fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) Compilation.Error!void {
if (pp.diagnostics.effectiveKind(diagnostic) == .off) return;
+ const old_suppress_system = pp.diagnostics.state.suppress_system_headers;
+ defer pp.diagnostics.state.suppress_system_headers = old_suppress_system;
+ if (diagnostic.show_in_system_headers) pp.diagnostics.state.suppress_system_headers = false;
- var sf = std.heap.stackFallback(1024, pp.gpa);
+ var sf = std.heap.stackFallback(1024, pp.comp.gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
@@ -791,7 +792,7 @@ fn err(pp: *Preprocessor, loc: anytype, diagnostic: Diagnostic, args: anytype) C
}
fn fatal(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: anytype) Compilation.Error {
- var sf = std.heap.stackFallback(1024, pp.gpa);
+ var sf = std.heap.stackFallback(1024, pp.comp.gpa);
var allocating: std.Io.Writer.Allocating = .init(sf.get());
defer allocating.deinit();
@@ -813,11 +814,12 @@ fn fatalNotFound(pp: *Preprocessor, tok: TokenWithExpansionLocs, filename: []con
pp.diagnostics.state.fatal_errors = true;
defer pp.diagnostics.state.fatal_errors = old;
- var sf = std.heap.stackFallback(1024, pp.gpa);
- var buf = std.array_list.Managed(u8).init(sf.get());
- defer buf.deinit();
+ var sf = std.heap.stackFallback(1024, pp.comp.gpa);
+ const allocator = sf.get();
+ var buf: std.ArrayList(u8) = .empty;
+ defer buf.deinit(allocator);
- try buf.print("'{s}' not found", .{filename});
+ try buf.print(allocator, "'{s}' not found", .{filename});
try pp.diagnostics.addWithLocation(pp.comp, .{
.kind = .@"fatal error",
.text = buf.items,
@@ -831,14 +833,16 @@ fn verboseLog(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args:
const source = pp.comp.getSource(raw.source);
const line_col = source.lineCol(.{ .id = raw.source, .line = raw.line, .byte_offset = raw.start });
- var stderr_buffer: [64]u8 = undefined;
- var writer = std.debug.lockStderrWriter(&stderr_buffer);
- defer std.debug.unlockStderrWriter();
- writer.print("{s}:{d}:{d}: ", .{ source.path, line_col.line_no, line_col.col }) catch return;
- writer.print(fmt, args) catch return;
- writer.writeByte('\n') catch return;
- writer.writeAll(line_col.line) catch return;
- writer.writeByte('\n') catch return;
+ var stderr_buf: [4096]u8 = undefined;
+ var stderr = std.fs.File.stderr().writer(&stderr_buf);
+ const w = &stderr.interface;
+
+ w.print("{s}:{d}:{d}: ", .{ source.path, line_col.line_no, line_col.col }) catch return;
+ w.print(fmt, args) catch return;
+ w.writeByte('\n') catch return;
+ w.writeAll(line_col.line) catch return;
+ w.writeByte('\n') catch return;
+ w.flush() catch return;
}
/// Consume next token, error if it is not an identifier.
@@ -880,9 +884,10 @@ fn restoreTokenState(pp: *Preprocessor, state: TokenState) void {
/// Consume all tokens until a newline and parse the result into a boolean.
fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
+ const gpa = pp.comp.gpa;
const token_state = pp.getTokenState();
defer {
- for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
+ for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
pp.restoreTokenState(token_state);
}
@@ -894,7 +899,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
.whitespace => if (pp.top_expansion_buf.items.len == 0) continue,
else => {},
}
- try pp.top_expansion_buf.append(tokFromRaw(tok));
+ try pp.top_expansion_buf.append(gpa, tokFromRaw(tok));
} else unreachable;
if (pp.top_expansion_buf.items.len != 0) {
pp.expansion_source_loc = pp.top_expansion_buf.items[0].loc;
@@ -989,11 +994,9 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
.pp = pp,
.comp = pp.comp,
.diagnostics = pp.diagnostics,
- .gpa = pp.gpa,
.tok_ids = pp.tokens.items(.id),
.tok_i = @intCast(token_state.tokens_len),
.in_macro = true,
- .strings = std.array_list.Managed(u8).init(pp.comp.gpa),
.tree = undefined,
.labels = undefined,
@@ -1005,7 +1008,7 @@ fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool {
.attr_buf = undefined,
.string_ids = undefined,
};
- defer parser.strings.deinit();
+ defer parser.strings.deinit(gpa);
return parser.macroExpr();
}
@@ -1140,34 +1143,35 @@ fn skipToNl(tokenizer: *Tokenizer) void {
}
}
-const ExpandBuf = std.array_list.Managed(TokenWithExpansionLocs);
-fn removePlacemarkers(buf: *ExpandBuf) void {
+const ExpandBuf = std.ArrayList(TokenWithExpansionLocs);
+fn removePlacemarkers(gpa: Allocator, buf: *ExpandBuf) void {
var i: usize = buf.items.len -% 1;
while (i < buf.items.len) : (i -%= 1) {
if (buf.items[i].id == .placemarker) {
const placemarker = buf.orderedRemove(i);
- TokenWithExpansionLocs.free(placemarker.expansion_locs, buf.allocator);
+ TokenWithExpansionLocs.free(placemarker.expansion_locs, gpa);
}
}
}
-const MacroArguments = std.array_list.Managed([]const TokenWithExpansionLocs);
-fn deinitMacroArguments(allocator: Allocator, args: *const MacroArguments) void {
+const MacroArguments = std.ArrayList([]const TokenWithExpansionLocs);
+fn deinitMacroArguments(gpa: Allocator, args: *MacroArguments) void {
for (args.items) |item| {
- for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, allocator);
- allocator.free(item);
+ for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
+ gpa.free(item);
}
- args.deinit();
+ args.deinit(gpa);
}
fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf {
- var buf = ExpandBuf.init(pp.gpa);
- errdefer buf.deinit();
+ const gpa = pp.comp.gpa;
+ var buf: ExpandBuf = .empty;
+ errdefer buf.deinit(gpa);
if (simple_macro.tokens.len == 0) {
- try buf.append(.{ .id = .placemarker, .loc = .{ .id = .generated } });
+ try buf.append(gpa, .{ .id = .placemarker, .loc = .{ .id = .generated } });
return buf;
}
- try buf.ensureTotalCapacity(simple_macro.tokens.len);
+ try buf.ensureTotalCapacity(gpa, simple_macro.tokens.len);
// Add all of the simple_macros tokens to the new buffer handling any concats.
var i: usize = 0;
@@ -1193,25 +1197,26 @@ fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf
.macro_file => {
const start = pp.comp.generated_buf.items.len;
const source = pp.comp.getSource(pp.expansion_source_loc.id);
- try pp.comp.generated_buf.print(pp.gpa, "\"{f}\"\n", .{fmtEscapes(source.path)});
+ try pp.comp.generated_buf.print(gpa, "\"{f}\"\n", .{fmtEscapes(source.path)});
buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .string_literal, tok));
},
.macro_line => {
const start = pp.comp.generated_buf.items.len;
const source = pp.comp.getSource(pp.expansion_source_loc.id);
- try pp.comp.generated_buf.print(pp.gpa, "{d}\n", .{source.physicalLine(pp.expansion_source_loc)});
+ try pp.comp.generated_buf.print(gpa, "{d}\n", .{source.physicalLine(pp.expansion_source_loc)});
buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok));
},
.macro_counter => {
defer pp.counter += 1;
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.print(pp.gpa, "{d}\n", .{pp.counter});
+ try pp.comp.generated_buf.print(gpa, "{d}\n", .{pp.counter});
buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok));
},
.macro_date, .macro_time => {
+ try pp.err(pp.expansion_source_loc, .date_time, .{});
const start = pp.comp.generated_buf.items.len;
const timestamp = switch (pp.source_epoch) {
.system, .provided => |ts| ts,
@@ -1220,6 +1225,7 @@ fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf
buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .string_literal, tok));
},
.macro_timestamp => {
+ try pp.err(pp.expansion_source_loc, .date_time, .{});
const start = pp.comp.generated_buf.items.len;
const timestamp = switch (pp.source_epoch) {
.provided => |ts| ts,
@@ -1251,8 +1257,9 @@ const DateTimeStampKind = enum {
}
};
-fn writeDateTimeStamp(pp: *Preprocessor, kind: DateTimeStampKind, timestamp: u64) !void {
+fn writeDateTimeStamp(pp: *const Preprocessor, kind: DateTimeStampKind, timestamp: u64) !void {
std.debug.assert(std.time.epoch.Month.jan.numeric() == 1);
+ const gpa = pp.comp.gpa;
const epoch_seconds = std.time.epoch.EpochSeconds{ .secs = timestamp };
const epoch_day = epoch_seconds.getEpochDay();
@@ -1267,21 +1274,21 @@ fn writeDateTimeStamp(pp: *Preprocessor, kind: DateTimeStampKind, timestamp: u64
switch (kind) {
.date => {
- try pp.comp.generated_buf.print(pp.gpa, "\"{s} {d: >2} {d}\"", .{
+ try pp.comp.generated_buf.print(gpa, "\"{s} {d: >2} {d}\"", .{
month_name,
month_day.day_index + 1,
year_day.year,
});
},
.time => {
- try pp.comp.generated_buf.print(pp.gpa, "\"{d:0>2}:{d:0>2}:{d:0>2}\"", .{
+ try pp.comp.generated_buf.print(gpa, "\"{d:0>2}:{d:0>2}:{d:0>2}\"", .{
day_seconds.getHoursIntoDay(),
day_seconds.getMinutesIntoHour(),
day_seconds.getSecondsIntoMinute(),
});
},
.timestamp => {
- try pp.comp.generated_buf.print(pp.gpa, "\"{s} {s} {d: >2} {d:0>2}:{d:0>2}:{d:0>2} {d}\"", .{
+ try pp.comp.generated_buf.print(gpa, "\"{s} {s} {d: >2} {d:0>2}:{d:0>2}:{d:0>2} {d}\"", .{
day_name,
month_name,
month_day.day_index + 1,
@@ -1312,7 +1319,7 @@ fn pasteStringsUnsafe(pp: *Preprocessor, toks: []const TokenWithExpansionLocs) !
if (tok.id == .macro_ws) continue;
if (tok.id != .string_literal) return error.ExpectedStringLiteral;
const str = pp.expandedSlice(tok);
- try pp.char_buf.appendSlice(str[1 .. str.len - 1]);
+ try pp.char_buf.appendSlice(pp.comp.gpa, str[1 .. str.len - 1]);
}
return pp.char_buf.items[char_top..];
}
@@ -1322,16 +1329,17 @@ fn pragmaOperator(pp: *Preprocessor, arg_tok: TokenWithExpansionLocs, operator_l
const arg_slice = pp.expandedSlice(arg_tok);
const content = arg_slice[1 .. arg_slice.len - 1];
const directive = "#pragma ";
+ const gpa = pp.comp.gpa;
pp.char_buf.clearRetainingCapacity();
const total_len = directive.len + content.len + 1; // destringify can never grow the string, + 1 for newline
- try pp.char_buf.ensureUnusedCapacity(total_len);
+ try pp.char_buf.ensureUnusedCapacity(gpa, total_len);
pp.char_buf.appendSliceAssumeCapacity(directive);
pp.destringify(content);
pp.char_buf.appendAssumeCapacity('\n');
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.appendSlice(pp.gpa, pp.char_buf.items);
+ try pp.comp.generated_buf.appendSlice(gpa, pp.char_buf.items);
var tmp_tokenizer = Tokenizer{
.buf = pp.comp.generated_buf.items,
.langopts = pp.comp.langopts,
@@ -1353,9 +1361,10 @@ fn msPragmaOperator(pp: *Preprocessor, pragma_tok: TokenWithExpansionLocs, args:
try pp.err(pragma_tok, .unknown_pragma, .{});
return;
}
+ const gpa = pp.comp.gpa;
{
- var copy = try pragma_tok.dupe(pp.gpa);
+ var copy = try pragma_tok.dupe(gpa);
copy.id = .keyword_pragma;
try pp.addToken(copy);
}
@@ -1364,7 +1373,7 @@ fn msPragmaOperator(pp: *Preprocessor, pragma_tok: TokenWithExpansionLocs, args:
for (args) |tok| {
switch (tok.id) {
.macro_ws, .comment => continue,
- else => try pp.addToken(try tok.dupe(pp.gpa)),
+ else => try pp.addToken(try tok.dupe(gpa)),
}
}
try pp.addToken(.{ .id = .nl, .loc = .{ .id = .generated } });
@@ -1406,7 +1415,8 @@ fn destringify(pp: *Preprocessor, str: []const u8) void {
/// Stringify `tokens` into pp.char_buf.
/// See https://gcc.gnu.org/onlinedocs/gcc-11.2.0/cpp/Stringizing.html#Stringizing
fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void {
- try pp.char_buf.append('"');
+ const gpa = pp.comp.gpa;
+ try pp.char_buf.append(gpa, '"');
var ws_state: enum { start, need, not_needed } = .start;
for (tokens) |tok| {
if (tok.id == .macro_ws) {
@@ -1414,7 +1424,7 @@ fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void {
ws_state = .need;
continue;
}
- if (ws_state == .need) try pp.char_buf.append(' ');
+ if (ws_state == .need) try pp.char_buf.append(gpa, ' ');
ws_state = .not_needed;
// backslashes not inside strings are not escaped
@@ -1434,14 +1444,14 @@ fn stringify(pp: *Preprocessor, tokens: []const TokenWithExpansionLocs) !void {
for (pp.expandedSlice(tok)) |c| {
if (c == '"')
- try pp.char_buf.appendSlice("\\\"")
+ try pp.char_buf.appendSlice(gpa, "\\\"")
else if (c == '\\' and is_str)
- try pp.char_buf.appendSlice("\\\\")
+ try pp.char_buf.appendSlice(gpa, "\\\\")
else
- try pp.char_buf.append(c);
+ try pp.char_buf.append(gpa, c);
}
}
- try pp.char_buf.ensureUnusedCapacity(2);
+ try pp.char_buf.ensureUnusedCapacity(gpa, 2);
if (pp.char_buf.items[pp.char_buf.items.len - 1] != '\\') {
pp.char_buf.appendSliceAssumeCapacity("\"\n");
return;
@@ -1492,7 +1502,7 @@ fn reconstructIncludeString(pp: *Preprocessor, param_toks: []const TokenWithExpa
for (params, 0..) |tok, i| {
const str = pp.expandedSliceExtra(tok, .preserve_macro_ws);
- try pp.char_buf.appendSlice(str);
+ try pp.char_buf.appendSlice(pp.comp.gpa, str);
if (embed_args) |some| {
if ((i == 0 and tok.id == .string_literal) or tok.id == .angle_bracket_right) {
some.* = params[i + 1 ..];
@@ -1649,25 +1659,26 @@ fn expandFuncMacro(
expanded_args: *const MacroArguments,
hideset_arg: Hideset.Index,
) MacroError!ExpandBuf {
+ const gpa = pp.comp.gpa;
var hideset = hideset_arg;
- var buf = ExpandBuf.init(pp.gpa);
- try buf.ensureTotalCapacity(func_macro.tokens.len);
- errdefer buf.deinit();
+ var buf: ExpandBuf = .empty;
+ errdefer buf.deinit(gpa);
+ try buf.ensureTotalCapacity(gpa, func_macro.tokens.len);
- var expanded_variable_arguments = ExpandBuf.init(pp.gpa);
- defer expanded_variable_arguments.deinit();
- var variable_arguments = ExpandBuf.init(pp.gpa);
- defer variable_arguments.deinit();
+ var expanded_variable_arguments: ExpandBuf = .empty;
+ defer expanded_variable_arguments.deinit(gpa);
+ var variable_arguments: ExpandBuf = .empty;
+ defer variable_arguments.deinit(gpa);
if (func_macro.var_args) {
var i: usize = func_macro.params.len;
while (i < expanded_args.items.len) : (i += 1) {
- try variable_arguments.appendSlice(args.items[i]);
- try expanded_variable_arguments.appendSlice(expanded_args.items[i]);
+ try variable_arguments.appendSlice(gpa, args.items[i]);
+ try expanded_variable_arguments.appendSlice(gpa, expanded_args.items[i]);
if (i != expanded_args.items.len - 1) {
- const comma = TokenWithExpansionLocs{ .id = .comma, .loc = .{ .id = .generated } };
- try variable_arguments.append(comma);
- try expanded_variable_arguments.append(comma);
+ const comma: TokenWithExpansionLocs = .{ .id = .comma, .loc = .{ .id = .generated } };
+ try variable_arguments.append(gpa, comma);
+ try expanded_variable_arguments.append(gpa, comma);
}
}
}
@@ -1681,8 +1692,8 @@ fn expandFuncMacro(
const raw_next = func_macro.tokens[tok_i + 1];
tok_i += 1;
- var va_opt_buf = ExpandBuf.init(pp.gpa);
- defer va_opt_buf.deinit();
+ var va_opt_buf: ExpandBuf = .empty;
+ defer va_opt_buf.deinit(gpa);
const next = switch (raw_next.id) {
.macro_ws => continue,
@@ -1709,7 +1720,7 @@ fn expandFuncMacro(
}
const slice = getPasteArgs(args.items[raw.end]);
const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line };
- try bufCopyTokens(&buf, slice, &.{raw_loc});
+ try bufCopyTokens(gpa, &buf, slice, &.{raw_loc});
},
.macro_param => {
if (tok_i + 1 < func_macro.tokens.len and func_macro.tokens[tok_i + 1].id == .hash_hash) {
@@ -1717,11 +1728,11 @@ fn expandFuncMacro(
}
const arg = expanded_args.items[raw.end];
const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line };
- try bufCopyTokens(&buf, arg, &.{raw_loc});
+ try bufCopyTokens(gpa, &buf, arg, &.{raw_loc});
},
.keyword_va_args => {
const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line };
- try bufCopyTokens(&buf, expanded_variable_arguments.items, &.{raw_loc});
+ try bufCopyTokens(gpa, &buf, expanded_variable_arguments.items, &.{raw_loc});
},
.keyword_va_opt => {
try pp.expandVaOpt(&buf, raw, variable_arguments.items.len != 0);
@@ -1736,9 +1747,9 @@ fn expandFuncMacro(
try pp.stringify(arg);
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.appendSlice(pp.gpa, pp.char_buf.items);
+ try pp.comp.generated_buf.appendSlice(gpa, pp.char_buf.items);
- try buf.append(try pp.makeGeneratedToken(start, .string_literal, tokFromRaw(raw)));
+ try buf.append(gpa, try pp.makeGeneratedToken(start, .string_literal, tokFromRaw(raw)));
},
.macro_param_has_attribute,
.macro_param_has_declspec_attribute,
@@ -1757,8 +1768,8 @@ fn expandFuncMacro(
} else try pp.handleBuiltinMacro(raw.id, arg, macro_tok.loc);
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.print(pp.gpa, "{}\n", .{@intFromBool(result)});
- try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
+ try pp.comp.generated_buf.print(gpa, "{}\n", .{@intFromBool(result)});
+ try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
},
.macro_param_has_c_attribute => {
const arg = expanded_args.items[0];
@@ -1808,8 +1819,8 @@ fn expandFuncMacro(
const exists = Attribute.fromString(.gnu, vendor_str, attr_str) != null;
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.appendSlice(pp.gpa, if (exists) "1\n" else "0\n");
- try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
+ try pp.comp.generated_buf.appendSlice(gpa, if (exists) "1\n" else "0\n");
+ try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
continue;
}
if (!pp.comp.langopts.standard.atLeast(.c23)) break :res not_found;
@@ -1829,8 +1840,8 @@ fn expandFuncMacro(
break :res attrs.get(attr_str) orelse not_found;
};
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.appendSlice(pp.gpa, result);
- try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
+ try pp.comp.generated_buf.appendSlice(gpa, result);
+ try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
},
.macro_param_has_embed => {
const arg = expanded_args.items[0];
@@ -1936,12 +1947,12 @@ fn expandFuncMacro(
const contents = (try pp.comp.findEmbed(filename, arg[0].loc.id, include_type, .limited(1), pp.dep_file)) orelse
break :res not_found;
- defer pp.comp.gpa.free(contents);
+ defer gpa.free(contents);
break :res if (contents.len != 0) "1\n" else "2\n";
};
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.appendSlice(pp.comp.gpa, result);
- try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
+ try pp.comp.generated_buf.appendSlice(gpa, result);
+ try buf.append(gpa, try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw)));
},
.macro_param_pragma_operator => {
// Clang and GCC require exactly one token (so, no parentheses or string pasting)
@@ -1993,7 +2004,7 @@ fn expandFuncMacro(
}
if (ident) |*some| {
some.id = .identifier;
- try buf.append(some.*);
+ try buf.append(gpa, some.*);
} else {
try pp.err(macro_tok, .expected_identifier, .{});
}
@@ -2023,10 +2034,10 @@ fn expandFuncMacro(
try pp.err(hash_hash, .comma_deletion_va_args, .{});
} else {
// C standard, retain the comma
- try buf.append(tokFromRaw(raw));
+ try buf.append(gpa, tokFromRaw(raw));
}
} else {
- try buf.append(tokFromRaw(raw));
+ try buf.append(gpa, tokFromRaw(raw));
if (expanded_variable_arguments.items.len > 0 or variable_arguments.items.len == func_macro.params.len) {
try pp.err(hash_hash, .comma_deletion_va_args, .{});
}
@@ -2035,23 +2046,23 @@ fn expandFuncMacro(
.byte_offset = maybe_va_args.start,
.line = maybe_va_args.line,
};
- try bufCopyTokens(&buf, expanded_variable_arguments.items, &.{raw_loc});
+ try bufCopyTokens(gpa, &buf, expanded_variable_arguments.items, &.{raw_loc});
}
continue;
}
}
// Regular comma, no token pasting with __VA_ARGS__
- try buf.append(tokFromRaw(raw));
+ try buf.append(gpa, tokFromRaw(raw));
},
- else => try buf.append(tokFromRaw(raw)),
+ else => try buf.append(gpa, tokFromRaw(raw)),
}
}
- removePlacemarkers(&buf);
+ removePlacemarkers(gpa, &buf);
const macro_expansion_locs = macro_tok.expansionSlice();
for (buf.items) |*tok| {
- try tok.addExpansionLocation(pp.gpa, &.{macro_tok.loc});
- try tok.addExpansionLocation(pp.gpa, macro_expansion_locs);
+ try tok.addExpansionLocation(gpa, &.{macro_tok.loc});
+ try tok.addExpansionLocation(gpa, macro_expansion_locs);
const tok_hidelist = pp.hideset.get(tok.loc);
const new_hidelist = try pp.hideset.@"union"(tok_hidelist, hideset);
try pp.hideset.put(tok.loc, new_hidelist);
@@ -2078,16 +2089,16 @@ fn expandVaOpt(
};
while (tokenizer.index < raw.end) {
const tok = tokenizer.next();
- try buf.append(tokFromRaw(tok));
+ try buf.append(pp.comp.gpa, tokFromRaw(tok));
}
}
-fn bufCopyTokens(buf: *ExpandBuf, tokens: []const TokenWithExpansionLocs, src: []const Source.Location) !void {
- try buf.ensureUnusedCapacity(tokens.len);
+fn bufCopyTokens(gpa: Allocator, buf: *ExpandBuf, tokens: []const TokenWithExpansionLocs, src: []const Source.Location) !void {
+ try buf.ensureUnusedCapacity(gpa, tokens.len);
for (tokens) |tok| {
- var copy = try tok.dupe(buf.allocator);
- errdefer TokenWithExpansionLocs.free(copy.expansion_locs, buf.allocator);
- try copy.addExpansionLocation(buf.allocator, src);
+ var copy = try tok.dupe(gpa);
+ errdefer TokenWithExpansionLocs.free(copy.expansion_locs, gpa);
+ try copy.addExpansionLocation(gpa, src);
buf.appendAssumeCapacity(copy);
}
}
@@ -2112,10 +2123,10 @@ fn nextBufToken(
const new_tok = tokFromRaw(raw_tok);
end_idx.* += 1;
- try buf.append(new_tok);
+ try buf.append(pp.comp.gpa, new_tok);
return new_tok;
} else {
- return TokenWithExpansionLocs{ .id = .eof, .loc = .{ .id = .generated } };
+ return .{ .id = .eof, .loc = .{ .id = .generated } };
}
} else {
return buf.items[start_idx.*];
@@ -2132,6 +2143,7 @@ fn collectMacroFuncArguments(
is_builtin: bool,
r_paren: *TokenWithExpansionLocs,
) !MacroArguments {
+ const gpa = pp.comp.gpa;
const name_tok = buf.items[start_idx.*];
const saved_tokenizer = tokenizer.*;
const old_end = end_idx.*;
@@ -2155,62 +2167,62 @@ fn collectMacroFuncArguments(
// collect the arguments.
var parens: u32 = 0;
- var args = MacroArguments.init(pp.gpa);
- errdefer deinitMacroArguments(pp.gpa, &args);
- var curArgument = std.array_list.Managed(TokenWithExpansionLocs).init(pp.gpa);
- defer curArgument.deinit();
+ var args: MacroArguments = .empty;
+ errdefer deinitMacroArguments(gpa, &args);
+ var cur_argument: std.ArrayList(TokenWithExpansionLocs) = .empty;
+ defer cur_argument.deinit(gpa);
while (true) {
var tok = try nextBufToken(pp, tokenizer, buf, start_idx, end_idx, extend_buf);
tok.flags.is_macro_arg = true;
switch (tok.id) {
.comma => {
if (parens == 0) {
- const owned = try curArgument.toOwnedSlice();
- errdefer pp.gpa.free(owned);
- try args.append(owned);
+ const owned = try cur_argument.toOwnedSlice(gpa);
+ errdefer gpa.free(owned);
+ try args.append(gpa, owned);
} else {
- const duped = try tok.dupe(pp.gpa);
- errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
- try curArgument.append(duped);
+ const duped = try tok.dupe(gpa);
+ errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
+ try cur_argument.append(gpa, duped);
}
},
.l_paren => {
- const duped = try tok.dupe(pp.gpa);
- errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
- try curArgument.append(duped);
+ const duped = try tok.dupe(gpa);
+ errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
+ try cur_argument.append(gpa, duped);
parens += 1;
},
.r_paren => {
if (parens == 0) {
- const owned = try curArgument.toOwnedSlice();
- errdefer pp.gpa.free(owned);
- try args.append(owned);
+ const owned = try cur_argument.toOwnedSlice(gpa);
+ errdefer gpa.free(owned);
+ try args.append(gpa, owned);
r_paren.* = tok;
break;
} else {
- const duped = try tok.dupe(pp.gpa);
- errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
- try curArgument.append(duped);
+ const duped = try tok.dupe(gpa);
+ errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
+ try cur_argument.append(gpa, duped);
parens -= 1;
}
},
.eof => {
{
- const owned = try curArgument.toOwnedSlice();
- errdefer pp.gpa.free(owned);
- try args.append(owned);
+ const owned = try cur_argument.toOwnedSlice(gpa);
+ errdefer gpa.free(owned);
+ try args.append(gpa, owned);
}
tokenizer.* = saved_tokenizer;
try pp.err(name_tok, .unterminated_macro_arg_list, .{});
return error.Unterminated;
},
.nl, .whitespace => {
- try curArgument.append(.{ .id = .macro_ws, .loc = tok.loc });
+ try cur_argument.append(gpa, .{ .id = .macro_ws, .loc = tok.loc });
},
else => {
- const duped = try tok.dupe(pp.gpa);
- errdefer TokenWithExpansionLocs.free(duped.expansion_locs, pp.gpa);
- try curArgument.append(duped);
+ const duped = try tok.dupe(gpa);
+ errdefer TokenWithExpansionLocs.free(duped.expansion_locs, gpa);
+ try cur_argument.append(gpa, duped);
},
}
}
@@ -2219,8 +2231,9 @@ fn collectMacroFuncArguments(
}
fn removeExpandedTokens(pp: *Preprocessor, buf: *ExpandBuf, start: usize, len: usize, moving_end_idx: *usize) !void {
- for (buf.items[start .. start + len]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
- try buf.replaceRange(start, len, &.{});
+ const gpa = pp.comp.gpa;
+ for (buf.items[start .. start + len]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
+ try buf.replaceRange(gpa, start, len, &.{});
moving_end_idx.* -|= len;
}
@@ -2263,6 +2276,7 @@ fn expandMacroExhaustive(
extend_buf: bool,
eval_ctx: EvalContext,
) MacroError!void {
+ const gpa = pp.comp.gpa;
var moving_end_idx = end_idx;
var advance_index: usize = 0;
// rescan loop
@@ -2309,7 +2323,7 @@ fn expandMacroExhaustive(
var r_paren: TokenWithExpansionLocs = undefined;
var macro_scan_idx = idx;
// to be saved in case this doesn't turn out to be a call
- const args = pp.collectMacroFuncArguments(
+ var args = pp.collectMacroFuncArguments(
tokenizer,
buf,
¯o_scan_idx,
@@ -2334,10 +2348,10 @@ fn expandMacroExhaustive(
var free_arg_expansion_locs = false;
defer {
for (args.items) |item| {
- if (free_arg_expansion_locs) for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
- pp.gpa.free(item);
+ if (free_arg_expansion_locs) for (item) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
+ gpa.free(item);
}
- args.deinit();
+ args.deinit(gpa);
}
const r_paren_hidelist = pp.hideset.get(r_paren.loc);
var hs = try pp.hideset.intersection(macro_hidelist, r_paren_hidelist);
@@ -2370,25 +2384,25 @@ fn expandMacroExhaustive(
try pp.removeExpandedTokens(buf, idx, macro_scan_idx - idx + 1, &moving_end_idx);
continue;
}
- var expanded_args = MacroArguments.init(pp.gpa);
- defer deinitMacroArguments(pp.gpa, &expanded_args);
- try expanded_args.ensureTotalCapacity(args.items.len);
+ var expanded_args: MacroArguments = .empty;
+ defer deinitMacroArguments(gpa, &expanded_args);
+ try expanded_args.ensureTotalCapacity(gpa, args.items.len);
for (args.items) |arg| {
- var expand_buf = ExpandBuf.init(pp.gpa);
- errdefer expand_buf.deinit();
- try expand_buf.appendSlice(arg);
+ var expand_buf: ExpandBuf = .empty;
+ errdefer expand_buf.deinit(gpa);
+ try expand_buf.appendSlice(gpa, arg);
try pp.expandMacroExhaustive(tokenizer, &expand_buf, 0, expand_buf.items.len, false, eval_ctx);
- expanded_args.appendAssumeCapacity(try expand_buf.toOwnedSlice());
+ expanded_args.appendAssumeCapacity(try expand_buf.toOwnedSlice(gpa));
}
var res = try pp.expandFuncMacro(macro_tok, macro, &args, &expanded_args, hs);
- defer res.deinit();
+ defer res.deinit(gpa);
const tokens_added = res.items.len;
const tokens_removed = macro_scan_idx - idx + 1;
- for (buf.items[idx .. idx + tokens_removed]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
- try buf.replaceRange(idx, tokens_removed, res.items);
+ for (buf.items[idx .. idx + tokens_removed]) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
+ try buf.replaceRange(gpa, idx, tokens_removed, res.items);
moving_end_idx += tokens_added;
// Overflow here means that we encountered an unterminated argument list
@@ -2397,8 +2411,8 @@ fn expandMacroExhaustive(
idx += tokens_added;
do_rescan = true;
} else {
- const res = try pp.expandObjMacro(macro);
- defer res.deinit();
+ var res = try pp.expandObjMacro(macro);
+ defer res.deinit(gpa);
const hs = try pp.hideset.prepend(macro_tok.loc, macro_hidelist);
@@ -2406,8 +2420,8 @@ fn expandMacroExhaustive(
var increment_idx_by = res.items.len;
for (res.items, 0..) |*tok, i| {
tok.flags.is_macro_arg = macro_tok.flags.is_macro_arg;
- try tok.addExpansionLocation(pp.gpa, &.{macro_tok.loc});
- try tok.addExpansionLocation(pp.gpa, macro_expansion_locs);
+ try tok.addExpansionLocation(gpa, &.{macro_tok.loc});
+ try tok.addExpansionLocation(gpa, macro_expansion_locs);
const tok_hidelist = pp.hideset.get(tok.loc);
const new_hidelist = try pp.hideset.@"union"(tok_hidelist, hs);
@@ -2426,8 +2440,8 @@ fn expandMacroExhaustive(
}
}
- TokenWithExpansionLocs.free(buf.items[idx].expansion_locs, pp.gpa);
- try buf.replaceRange(idx, 1, res.items);
+ TokenWithExpansionLocs.free(buf.items[idx].expansion_locs, gpa);
+ try buf.replaceRange(gpa, idx, 1, res.items);
idx += increment_idx_by;
moving_end_idx = moving_end_idx + res.items.len - 1;
do_rescan = true;
@@ -2442,7 +2456,7 @@ fn expandMacroExhaustive(
// trim excess buffer
for (buf.items[moving_end_idx..]) |item| {
- TokenWithExpansionLocs.free(item.expansion_locs, pp.gpa);
+ TokenWithExpansionLocs.free(item.expansion_locs, gpa);
}
buf.items.len = moving_end_idx;
}
@@ -2456,10 +2470,11 @@ fn unescapeUcn(pp: *Preprocessor, tok: TokenWithExpansionLocs) !TokenWithExpansi
.extended_identifier => {
@branchHint(.cold);
const identifier = pp.expandedSlice(tok);
+ const gpa = pp.comp.gpa;
if (mem.indexOfScalar(u8, identifier, '\\') != null) {
@branchHint(.cold);
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.ensureUnusedCapacity(pp.gpa, identifier.len + 1);
+ try pp.comp.generated_buf.ensureUnusedCapacity(gpa, identifier.len + 1);
var identifier_parser: text_literal.Parser = .{
.comp = pp.comp,
.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
}
}
pp.comp.generated_buf.appendAssumeCapacity('\n');
- defer TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
+ defer TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
return pp.makeGeneratedToken(start, .extended_identifier, tok);
}
},
@@ -2503,8 +2518,9 @@ fn expandMacro(pp: *Preprocessor, tokenizer: *Tokenizer, raw: RawToken) MacroErr
source_tok.id.simplifyMacroKeyword();
return pp.addToken(source_tok);
}
+ const gpa = pp.comp.gpa;
pp.top_expansion_buf.items.len = 0;
- try pp.top_expansion_buf.append(source_tok);
+ try pp.top_expansion_buf.append(gpa, source_tok);
pp.expansion_source_loc = source_tok.loc;
pp.hideset.clearRetainingCapacity();
@@ -2512,15 +2528,15 @@ fn expandMacro(pp: *Preprocessor, tokenizer: *Tokenizer, raw: RawToken) MacroErr
try pp.ensureUnusedTokenCapacity(pp.top_expansion_buf.items.len);
for (pp.top_expansion_buf.items) |*tok| {
if (tok.id == .macro_ws and !pp.preserve_whitespace) {
- TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
+ TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
continue;
}
if (tok.id == .comment and !pp.comp.langopts.preserve_comments_in_macros) {
- TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
+ TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
continue;
}
if (tok.id == .placemarker) {
- TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
+ TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
continue;
}
tok.id.simplifyMacroKeywordExtra(true);
@@ -2564,14 +2580,15 @@ pub fn expandedSlice(pp: *const Preprocessor, tok: anytype) []const u8 {
/// Concat two tokens and add the result to pp.generated
fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenWithExpansionLocs) Error!void {
+ const gpa = pp.comp.gpa;
const lhs = while (lhs_toks.pop()) |lhs| {
if ((pp.comp.langopts.preserve_comments_in_macros and lhs.id == .comment) or
(lhs.id != .macro_ws and lhs.id != .comment))
break lhs;
- TokenWithExpansionLocs.free(lhs.expansion_locs, pp.gpa);
+ TokenWithExpansionLocs.free(lhs.expansion_locs, gpa);
} else {
- return bufCopyTokens(lhs_toks, rhs_toks, &.{});
+ return bufCopyTokens(gpa, lhs_toks, rhs_toks, &.{});
};
var rhs_rest: u32 = 1;
@@ -2584,11 +2601,11 @@ fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenW
} else {
return lhs_toks.appendAssumeCapacity(lhs);
};
- defer TokenWithExpansionLocs.free(lhs.expansion_locs, pp.gpa);
+ defer TokenWithExpansionLocs.free(lhs.expansion_locs, gpa);
const start = pp.comp.generated_buf.items.len;
const end = start + pp.expandedSlice(lhs).len + pp.expandedSlice(rhs).len;
- try pp.comp.generated_buf.ensureTotalCapacity(pp.gpa, end + 1); // +1 for a newline
+ try pp.comp.generated_buf.ensureTotalCapacity(gpa, end + 1); // +1 for a newline
// We cannot use the same slices here since they might be invalidated by `ensureCapacity`
pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(lhs));
pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(rhs));
@@ -2607,32 +2624,33 @@ fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const TokenW
.placemarker
else
pasted_token.id;
- try lhs_toks.append(try pp.makeGeneratedToken(start, pasted_id, lhs));
+ try lhs_toks.append(gpa, try pp.makeGeneratedToken(start, pasted_id, lhs));
if (next.id != .nl and next.id != .eof) {
try pp.err(lhs, .pasting_formed_invalid, .{pp.comp.generated_buf.items[start..end]});
- try lhs_toks.append(tokFromRaw(next));
+ try lhs_toks.append(gpa, tokFromRaw(next));
}
- try bufCopyTokens(lhs_toks, rhs_toks[rhs_rest..], &.{});
+ try bufCopyTokens(gpa, lhs_toks, rhs_toks[rhs_rest..], &.{});
}
fn makeGeneratedToken(pp: *Preprocessor, start: usize, id: Token.Id, source: TokenWithExpansionLocs) !TokenWithExpansionLocs {
+ const gpa = pp.comp.gpa;
var pasted_token = TokenWithExpansionLocs{ .id = id, .loc = .{
.id = .generated,
.byte_offset = @intCast(start),
.line = pp.generated_line,
} };
pp.generated_line += 1;
- try pasted_token.addExpansionLocation(pp.gpa, &.{source.loc});
- try pasted_token.addExpansionLocation(pp.gpa, source.expansionSlice());
+ try pasted_token.addExpansionLocation(gpa, &.{source.loc});
+ try pasted_token.addExpansionLocation(gpa, source.expansionSlice());
return pasted_token;
}
/// Defines a new macro and warns if it is a duplicate
fn defineMacro(pp: *Preprocessor, define_tok: RawToken, name_tok: TokenWithExpansionLocs, macro: Macro) Error!void {
const name_str = pp.expandedSlice(name_tok);
- const gop = try pp.defines.getOrPut(pp.gpa, name_str);
+ const gop = try pp.defines.getOrPut(pp.comp.gpa, name_str);
if (gop.found_existing and !gop.value_ptr.eql(macro, pp)) {
const loc = name_tok.loc;
const prev_total = pp.diagnostics.total;
@@ -2668,8 +2686,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
try pp.err(escaped_macro_name, .macro_name_must_be_identifier, .{});
return skipToNl(tokenizer);
}
+ const gpa = pp.comp.gpa;
const macro_name = try pp.unescapeUcn(tokFromRaw(escaped_macro_name));
- defer TokenWithExpansionLocs.free(macro_name.expansion_locs, pp.gpa);
+ defer TokenWithExpansionLocs.free(macro_name.expansion_locs, gpa);
var macro_name_token_id = macro_name.id;
macro_name_token_id.simplifyMacroKeyword();
@@ -2724,21 +2743,21 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
},
else => {},
}
- try pp.token_buf.append(tok);
- try pp.token_buf.append(next);
+ try pp.token_buf.append(gpa, tok);
+ try pp.token_buf.append(gpa, next);
},
.nl, .eof => break,
.comment => if (pp.comp.langopts.preserve_comments_in_macros) {
if (need_ws) {
need_ws = false;
- try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
+ try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
}
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
},
.whitespace => need_ws = true,
.unterminated_string_literal, .unterminated_char_literal, .empty_char_literal => |tag| {
try pp.err(tok, invalidTokenDiagnostic(tag), .{});
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
},
.unterminated_comment => try pp.err(tok, .unterminated_comment, .{}),
else => {
@@ -2748,9 +2767,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
}
if (tok.id != .whitespace and need_ws) {
need_ws = false;
- try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
+ try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
}
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
},
}
tok = tokenizer.next();
@@ -2769,8 +2788,9 @@ fn define(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken) Error!
/// Handle a function like #define directive.
fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macro_name: TokenWithExpansionLocs, l_paren: RawToken) Error!void {
assert(macro_name.id.isMacroIdentifier());
- var params = std.array_list.Managed([]const u8).init(pp.gpa);
- defer params.deinit();
+ const gpa = pp.comp.gpa;
+ var params: std.ArrayList([]const u8) = .empty;
+ defer params.deinit(gpa);
// Parse the parameter list.
var gnu_var_args: []const u8 = "";
@@ -2794,7 +2814,7 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
return skipToNl(tokenizer);
}
- try params.append(pp.tokSlice(tok));
+ try params.append(gpa, pp.tokSlice(tok));
tok = tokenizer.nextNoWS();
if (tok.id == .ellipsis) {
@@ -2826,34 +2846,34 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
.comment => if (!pp.comp.langopts.preserve_comments_in_macros) continue else {
if (need_ws) {
need_ws = false;
- try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
+ try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
}
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
},
.hash => {
if (tok.id != .whitespace and need_ws) {
need_ws = false;
- try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
+ try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
}
const param = tokenizer.nextNoWS();
blk: {
if (var_args and param.id == .keyword_va_args) {
tok.id = .stringify_va_args;
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
continue :tok_loop;
}
if (!param.id.isMacroIdentifier()) break :blk;
const s = pp.tokSlice(param);
if (mem.eql(u8, s, gnu_var_args)) {
tok.id = .stringify_va_args;
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
continue :tok_loop;
}
for (params.items, 0..) |p, i| {
if (mem.eql(u8, p, s)) {
tok.id = .stringify_param;
tok.end = @intCast(i);
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
continue :tok_loop;
}
}
@@ -2880,17 +2900,17 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
if (pp.token_buf.items[pp.token_buf.items.len - 1].id == .macro_param) {
pp.token_buf.items[pp.token_buf.items.len - 1].id = .macro_param_no_expand;
}
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
},
.unterminated_string_literal, .unterminated_char_literal, .empty_char_literal => |tag| {
try pp.err(tok, invalidTokenDiagnostic(tag), .{});
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
},
.unterminated_comment => try pp.err(tok, .unterminated_comment, .{}),
else => {
if (tok.id != .whitespace and need_ws) {
need_ws = false;
- try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated });
+ try pp.token_buf.append(gpa, .{ .id = .macro_ws, .source = .generated });
}
if (var_args and tok.id == .keyword_va_args) {
// do nothing
@@ -2937,7 +2957,7 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
}
}
}
- try pp.token_buf.append(tok);
+ try pp.token_buf.append(gpa, tok);
},
}
}
@@ -2957,12 +2977,13 @@ fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, define_tok: RawToken, macr
/// embedDirective : ("FILENAME" | <FILENAME>) embedParam*
/// embedParam : IDENTIFIER (:: IDENTIFIER)? '(' <tokens> ')'
fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
+ const gpa = pp.comp.gpa;
const first = tokenizer.nextNoWS();
const filename_tok = pp.findIncludeFilenameToken(first, tokenizer, .ignore_trailing_tokens) catch |er| switch (er) {
error.InvalidInclude => return,
else => |e| return e,
};
- defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, pp.gpa);
+ defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, gpa);
// Check for empty filename.
const tok_slice = pp.expandedSliceExtra(filename_tok, .single_macro_ws);
@@ -3024,9 +3045,12 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
try pp.err(l_paren, .malformed_embed_param, .{});
continue;
}
- try pp.char_buf.appendSlice(Attribute.normalize(pp.tokSlice(param_first)));
- try pp.char_buf.appendSlice("::");
- try pp.char_buf.appendSlice(Attribute.normalize(pp.tokSlice(param)));
+ const vendor = Attribute.normalize(pp.tokSlice(param_first));
+ const param_name = Attribute.normalize(pp.tokSlice(param));
+ try pp.char_buf.ensureUnusedCapacity(gpa, vendor.len + 2 + param_name.len);
+ pp.char_buf.appendSliceAssumeCapacity(vendor);
+ pp.char_buf.appendSliceAssumeCapacity("::");
+ pp.char_buf.appendSliceAssumeCapacity(param_name);
break :blk pp.char_buf.items;
},
.l_paren => Attribute.normalize(pp.tokSlice(param_first)),
@@ -3044,7 +3068,7 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
try pp.err(maybe_colon, .malformed_embed_param, .{});
break;
}
- try pp.token_buf.append(next);
+ try pp.token_buf.append(gpa, next);
}
const end: u32 = @intCast(pp.token_buf.items.len);
@@ -3093,7 +3117,7 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
const embed_bytes = (try pp.comp.findEmbed(filename, first.source, include_type, limit orelse .unlimited, pp.dep_file)) orelse
return pp.fatalNotFound(filename_tok, filename);
- defer pp.comp.gpa.free(embed_bytes);
+ defer gpa.free(embed_bytes);
try Range.expand(prefix, pp, tokenizer);
@@ -3111,17 +3135,17 @@ fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void {
{
const byte = embed_bytes[0];
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.print(pp.gpa, "{d}", .{byte});
+ try pp.comp.generated_buf.print(gpa, "{d}", .{byte});
pp.addTokenAssumeCapacity(try pp.makeGeneratedToken(start, .embed_byte, filename_tok));
}
for (embed_bytes[1..]) |byte| {
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.print(pp.gpa, ",{d}", .{byte});
+ try pp.comp.generated_buf.print(gpa, ",{d}", .{byte});
pp.addTokenAssumeCapacity(.{ .id = .comma, .loc = .{ .id = .generated, .byte_offset = @intCast(start) } });
pp.addTokenAssumeCapacity(try pp.makeGeneratedToken(start + 1, .embed_byte, filename_tok));
}
- try pp.comp.generated_buf.append(pp.gpa, '\n');
+ try pp.comp.generated_buf.append(gpa, '\n');
try Range.expand(suffix, pp, tokenizer);
}
@@ -3133,6 +3157,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
error.InvalidInclude => return,
else => |e| return e,
};
+ const gpa = pp.comp.gpa;
// Prevent stack overflow
pp.include_depth += 1;
@@ -3147,7 +3172,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
if (pp.defines.contains(guard)) return;
}
- if (pp.dep_file) |dep| try dep.addDependency(pp.gpa, new_source.path);
+ if (pp.dep_file) |dep| try dep.addDependency(gpa, new_source.path);
if (pp.verbose) {
pp.verboseLog(first, "include file {s}", .{new_source.path});
}
@@ -3156,7 +3181,7 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
try pp.addIncludeStart(new_source);
const eof = pp.preprocessExtra(new_source) catch |er| switch (er) {
error.StopPreprocessing => {
- for (pp.expansion_entries.items(.locs)[token_state.expansion_entries_len..]) |loc| TokenWithExpansionLocs.free(loc, pp.gpa);
+ for (pp.expansion_entries.items(.locs)[token_state.expansion_entries_len..]) |loc| TokenWithExpansionLocs.free(loc, gpa);
pp.restoreTokenState(token_state);
return;
},
@@ -3187,20 +3212,22 @@ fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInc
/// operator_loc: Location of `_Pragma`; null if this is from #pragma
/// arg_locs: expansion locations of the argument to _Pragma. empty if #pragma or a raw string literal was used
fn makePragmaToken(pp: *Preprocessor, raw: RawToken, operator_loc: ?Source.Location, arg_locs: []const Source.Location) !TokenWithExpansionLocs {
+ const gpa = pp.comp.gpa;
var tok = tokFromRaw(raw);
if (operator_loc) |loc| {
- try tok.addExpansionLocation(pp.gpa, &.{loc});
+ try tok.addExpansionLocation(gpa, &.{loc});
}
- try tok.addExpansionLocation(pp.gpa, arg_locs);
+ try tok.addExpansionLocation(gpa, arg_locs);
return tok;
}
pub fn addToken(pp: *Preprocessor, tok_arg: TokenWithExpansionLocs) !void {
+ const gpa = pp.comp.gpa;
const tok = try pp.unescapeUcn(tok_arg);
if (tok.expansion_locs) |expansion_locs| {
- try pp.expansion_entries.append(pp.gpa, .{ .idx = @intCast(pp.tokens.len), .locs = expansion_locs });
+ try pp.expansion_entries.append(gpa, .{ .idx = @intCast(pp.tokens.len), .locs = expansion_locs });
}
- try pp.tokens.append(pp.gpa, .{ .id = tok.id, .loc = tok.loc });
+ try pp.tokens.append(gpa, .{ .id = tok.id, .loc = tok.loc });
}
pub fn addTokenAssumeCapacity(pp: *Preprocessor, tok: TokenWithExpansionLocs) void {
@@ -3211,13 +3238,15 @@ pub fn addTokenAssumeCapacity(pp: *Preprocessor, tok: TokenWithExpansionLocs) vo
}
pub fn ensureTotalTokenCapacity(pp: *Preprocessor, capacity: usize) !void {
- try pp.tokens.ensureTotalCapacity(pp.gpa, capacity);
- try pp.expansion_entries.ensureTotalCapacity(pp.gpa, capacity);
+ const gpa = pp.comp.gpa;
+ try pp.tokens.ensureTotalCapacity(gpa, capacity);
+ try pp.expansion_entries.ensureTotalCapacity(gpa, capacity);
}
pub fn ensureUnusedTokenCapacity(pp: *Preprocessor, capacity: usize) !void {
- try pp.tokens.ensureUnusedCapacity(pp.gpa, capacity);
- try pp.expansion_entries.ensureUnusedCapacity(pp.gpa, capacity);
+ const gpa = pp.comp.gpa;
+ try pp.tokens.ensureUnusedCapacity(gpa, capacity);
+ try pp.expansion_entries.ensureUnusedCapacity(gpa, capacity);
}
/// Handle a pragma directive
@@ -3285,10 +3314,11 @@ fn findIncludeFilenameToken(
const filename_tok, const expanded_trailing = switch (source_tok.id) {
.string_literal, .macro_string => .{ source_tok, false },
else => expanded: {
+ const gpa = pp.comp.gpa;
// Try to expand if the argument is a macro.
pp.top_expansion_buf.items.len = 0;
- defer for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, pp.gpa);
- try pp.top_expansion_buf.append(source_tok);
+ defer for (pp.top_expansion_buf.items) |tok| TokenWithExpansionLocs.free(tok.expansion_locs, gpa);
+ try pp.top_expansion_buf.append(gpa, source_tok);
pp.expansion_source_loc = source_tok.loc;
try pp.expandMacroExhaustive(tokenizer, &pp.top_expansion_buf, 0, 1, true, .non_expr);
@@ -3298,7 +3328,7 @@ fn findIncludeFilenameToken(
return error.InvalidInclude;
};
const start = pp.comp.generated_buf.items.len;
- try pp.comp.generated_buf.appendSlice(pp.gpa, include_str);
+ try pp.comp.generated_buf.appendSlice(gpa, include_str);
break :expanded .{ try pp.makeGeneratedToken(start, switch (include_str[0]) {
'"' => .string_literal,
@@ -3326,7 +3356,7 @@ fn findIncludeFilenameToken(
fn findIncludeSource(pp: *Preprocessor, tokenizer: *Tokenizer, first: RawToken, which: Compilation.WhichInclude) !Source {
const filename_tok = try pp.findIncludeFilenameToken(first, tokenizer, .expect_nl_eof);
- defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, pp.gpa);
+ defer TokenWithExpansionLocs.free(filename_tok.expansion_locs, pp.comp.gpa);
// Check for empty filename.
const tok_slice = pp.expandedSliceExtra(filename_tok, .single_macro_ws);
@@ -3650,7 +3680,7 @@ test "destringify" {
const Test = struct {
fn testDestringify(pp: *Preprocessor, stringified: []const u8, destringified: []const u8) !void {
pp.char_buf.clearRetainingCapacity();
- try pp.char_buf.ensureUnusedCapacity(stringified.len);
+ try pp.char_buf.ensureUnusedCapacity(gpa, stringified.len);
pp.destringify(stringified);
try std.testing.expectEqualStrings(destringified, pp.char_buf.items);
}
@@ -3730,18 +3760,18 @@ test "Include guards" {
_ = try comp.addSourceFromBuffer(path, "int bar = 5;\n");
- var buf = std.array_list.Managed(u8).init(gpa);
- defer buf.deinit();
+ var buf: std.ArrayList(u8) = .empty;
+ defer buf.deinit(gpa);
switch (tok_id) {
- .keyword_include, .keyword_include_next => try buf.print(template, .{ tok_id.lexeme().?, " \"bar.h\"" }),
- .keyword_define, .keyword_undef => try buf.print(template, .{ tok_id.lexeme().?, " BAR" }),
+ .keyword_include, .keyword_include_next => try buf.print(gpa, template, .{ tok_id.lexeme().?, " \"bar.h\"" }),
+ .keyword_define, .keyword_undef => try buf.print(gpa, template, .{ tok_id.lexeme().?, " BAR" }),
.keyword_ifndef,
.keyword_ifdef,
.keyword_elifdef,
.keyword_elifndef,
- => try buf.print(template, .{ tok_id.lexeme().?, " BAR\n#endif" }),
- else => try buf.print(template, .{ tok_id.lexeme().?, "" }),
+ => try buf.print(gpa, template, .{ tok_id.lexeme().?, " BAR\n#endif" }),
+ else => try buf.print(gpa, template, .{ tok_id.lexeme().?, "" }),
}
const source = try comp.addSourceFromBuffer("test.h", buf.items);
_ = try pp.preprocess(source);
lib/compiler/aro/aro/Source.zig
@@ -38,6 +38,7 @@ pub const ExpandedLocation = struct {
col: u32,
width: u32,
end_with_splice: bool,
+ kind: Kind,
};
const Source = @This();
@@ -120,6 +121,7 @@ pub fn lineCol(source: Source, loc: Location) ExpandedLocation {
.col = col,
.width = width,
.end_with_splice = end_with_splice,
+ .kind = source.kind,
};
}
lib/compiler/aro/aro/SymbolStack.zig
@@ -35,14 +35,14 @@ pub const Kind = enum {
constexpr,
};
-scopes: std.ArrayListUnmanaged(Scope) = .{},
+scopes: std.ArrayList(Scope) = .empty,
/// allocations from nested scopes are retained after popping; `active_len` is the number
/// of currently-active items in `scopes`.
active_len: usize = 0,
const Scope = struct {
- vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
- tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
+ vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
+ tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
fn deinit(self: *Scope, allocator: Allocator) void {
self.vars.deinit(allocator);
@@ -66,7 +66,7 @@ pub fn deinit(s: *SymbolStack, gpa: Allocator) void {
pub fn pushScope(s: *SymbolStack, p: *Parser) !void {
if (s.active_len + 1 > s.scopes.items.len) {
- try s.scopes.append(p.gpa, .{});
+ try s.scopes.append(p.comp.gpa, .{});
s.active_len = s.scopes.items.len;
} else {
s.scopes.items[s.active_len].clearRetainingCapacity();
@@ -195,7 +195,7 @@ pub fn defineTypedef(
else => unreachable,
}
}
- try s.define(p.gpa, .{
+ try s.define(p.comp.gpa, .{
.kind = .typedef,
.name = name,
.tok = tok,
@@ -245,7 +245,7 @@ pub fn defineSymbol(
}
}
- try s.define(p.gpa, .{
+ try s.define(p.comp.gpa, .{
.kind = if (constexpr) .constexpr else .def,
.name = name,
.tok = tok,
@@ -306,7 +306,7 @@ pub fn declareSymbol(
else => unreachable,
}
}
- try s.define(p.gpa, .{
+ try s.define(p.comp.gpa, .{
.kind = .decl,
.name = name,
.tok = tok,
@@ -317,7 +317,7 @@ pub fn declareSymbol(
// Declare out of scope symbol for functions declared in functions.
if (s.active_len > 1 and !p.comp.langopts.standard.atLeast(.c23) and qt.is(p.comp, .func)) {
- try s.scopes.items[0].vars.put(p.gpa, name, .{
+ try s.scopes.items[0].vars.put(p.comp.gpa, name, .{
.kind = .decl,
.name = name,
.tok = tok,
@@ -352,7 +352,7 @@ pub fn defineParam(
else => unreachable,
}
}
- try s.define(p.gpa, .{
+ try s.define(p.comp.gpa, .{
.kind = .def,
.name = name,
.tok = tok,
@@ -424,7 +424,7 @@ pub fn defineEnumeration(
else => unreachable,
}
}
- try s.define(p.gpa, .{
+ try s.define(p.comp.gpa, .{
.kind = .enumeration,
.name = name,
.tok = tok,
lib/compiler/aro/aro/Toolchain.zig
@@ -9,7 +9,7 @@ const Filesystem = @import("Driver/Filesystem.zig").Filesystem;
const Multilib = @import("Driver/Multilib.zig");
const target_util = @import("target.zig");
-pub const PathList = std.ArrayListUnmanaged([]const u8);
+pub const PathList = std.ArrayList([]const u8);
pub const RuntimeLibKind = enum {
compiler_rt,
@@ -64,7 +64,6 @@ pub fn getTarget(tc: *const Toolchain) std.Target {
fn getDefaultLinker(tc: *const Toolchain) []const u8 {
return switch (tc.inner) {
.uninitialized => unreachable,
- .linux => |linux| linux.getDefaultLinker(tc.getTarget()),
.unknown => "ld",
};
}
@@ -72,6 +71,7 @@ fn getDefaultLinker(tc: *const Toolchain) []const u8 {
/// Call this after driver has finished parsing command line arguments to find the toolchain
pub fn discover(tc: *Toolchain) !void {
if (tc.inner != .uninitialized) return;
+
tc.inner = .unknown;
return switch (tc.inner) {
.uninitialized => unreachable,
@@ -143,8 +143,11 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 {
return use_linker;
}
} else {
- var linker_name = try std.array_list.Managed(u8).initCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker
- defer linker_name.deinit();
+ const gpa = tc.driver.comp.gpa;
+ var linker_name: std.ArrayList(u8) = .empty;
+ defer linker_name.deinit(gpa);
+ try linker_name.ensureUnusedCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker
+
if (tc.getTarget().os.tag.isDarwin()) {
linker_name.appendSliceAssumeCapacity("ld64.");
} else {
@@ -171,20 +174,27 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 {
/// TODO: this isn't exactly right since our target names don't necessarily match up
/// with GCC's.
/// For example the Zig target `arm-freestanding-eabi` would need the `arm-none-eabi` tools
-fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8, possible_names: *std.ArrayListUnmanaged([]const u8)) void {
+fn possibleProgramNames(
+ raw_triple: ?[]const u8,
+ name: []const u8,
+ buf: *[64]u8,
+ possible_name_buf: *[2][]const u8,
+) []const []const u8 {
+ var i: u32 = 0;
if (raw_triple) |triple| {
if (std.fmt.bufPrint(buf, "{s}-{s}", .{ triple, name })) |res| {
- possible_names.appendAssumeCapacity(res);
+ possible_name_buf[i] = res;
+ i += 1;
} else |_| {}
}
- possible_names.appendAssumeCapacity(name);
+ possible_name_buf[i] = name;
- return possible_names;
+ return possible_name_buf[0..i];
}
/// Add toolchain `file_paths` to argv as `-L` arguments
-pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
- try argv.ensureUnusedCapacity(tc.file_paths.items.len);
+pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
+ try argv.ensureUnusedCapacity(tc.driver.comp.gpa, tc.file_paths.items.len);
var bytes_needed: usize = 0;
for (tc.file_paths.items) |path| {
@@ -208,11 +218,10 @@ fn getProgramPath(tc: *const Toolchain, name: []const u8, buf: []u8) []const u8
var fib = std.heap.FixedBufferAllocator.init(&path_buf);
var tool_specific_buf: [64]u8 = undefined;
- var possible_names_buffer: [2][]const u8 = undefined;
- var possible_names = std.ArrayListUnmanaged.initBuffer(&possible_names_buffer);
- possibleProgramNames(tc.driver.raw_target_triple, name, &tool_specific_buf, &possible_names);
+ var possible_name_buf: [2][]const u8 = undefined;
+ const possible_names = possibleProgramNames(tc.driver.raw_target_triple, name, &tool_specific_buf, &possible_name_buf);
- for (possible_names.items) |tool_name| {
+ for (possible_names) |tool_name| {
for (tc.program_paths.items) |program_path| {
defer fib.reset();
@@ -318,16 +327,6 @@ pub fn addPathFromComponents(tc: *Toolchain, components: []const []const u8, des
try dest.append(tc.driver.comp.gpa, full_path);
}
-/// Add linker args to `argv`. Does not add path to linker executable as first item; that must be handled separately
-/// Items added to `argv` will be string literals or owned by `tc.driver.comp.arena` so they must not be individually freed
-pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
- return switch (tc.inner) {
- .uninitialized => unreachable,
- .linux => |*linux| linux.buildLinkerArgs(tc, argv),
- .unknown => @panic("This toolchain does not support linking yet"),
- };
-}
-
fn getDefaultRuntimeLibKind(tc: *const Toolchain) RuntimeLibKind {
if (tc.getTarget().abi.isAndroid()) {
return .compiler_rt;
@@ -400,7 +399,7 @@ fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 {
}
}
-fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
+fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
const unw = try tc.getUnwindLibKind();
const target = tc.getTarget();
if ((target.abi.isAndroid() and unw == .libgcc) or
@@ -410,46 +409,49 @@ fn addUnwindLibrary(tc: *const Toolchain, argv: *std.array_list.Managed([]const
const lgk = tc.getLibGCCKind();
const as_needed = lgk == .unspecified and !target.abi.isAndroid() and !target_util.isCygwinMinGW(target) and target.os.tag != .aix;
+
+ try argv.ensureUnusedCapacity(tc.driver.comp.gpa, 3);
if (as_needed) {
- try argv.append(getAsNeededOption(target.os.tag == .solaris, true));
+ argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, true));
}
switch (unw) {
.none => return,
- .libgcc => if (lgk == .static) try argv.append("-lgcc_eh") else try argv.append("-lgcc_s"),
+ .libgcc => argv.appendAssumeCapacity(if (lgk == .static) "-lgcc_eh" else "-lgcc_s"),
.compiler_rt => if (target.os.tag == .aix) {
if (lgk != .static) {
- try argv.append("-lunwind");
+ argv.appendAssumeCapacity("-lunwind");
}
} else if (lgk == .static) {
- try argv.append("-l:libunwind.a");
+ argv.appendAssumeCapacity("-l:libunwind.a");
} else if (lgk == .shared) {
if (target_util.isCygwinMinGW(target)) {
- try argv.append("-l:libunwind.dll.a");
+ argv.appendAssumeCapacity("-l:libunwind.dll.a");
} else {
- try argv.append("-l:libunwind.so");
+ argv.appendAssumeCapacity("-l:libunwind.so");
}
} else {
- try argv.append("-lunwind");
+ argv.appendAssumeCapacity("-lunwind");
},
}
if (as_needed) {
- try argv.append(getAsNeededOption(target.os.tag == .solaris, false));
+ argv.appendAssumeCapacity(getAsNeededOption(target.os.tag == .solaris, false));
}
}
-fn addLibGCC(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
+fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
+ const gpa = tc.driver.comp.gpa;
const libgcc_kind = tc.getLibGCCKind();
if (libgcc_kind == .static or libgcc_kind == .unspecified) {
- try argv.append("-lgcc");
+ try argv.append(gpa, "-lgcc");
}
try tc.addUnwindLibrary(argv);
if (libgcc_kind == .shared) {
- try argv.append("-lgcc");
+ try argv.append(gpa, "-lgcc");
}
}
-pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]const u8)) !void {
+pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void {
const target = tc.getTarget();
const rlt = tc.getRuntimeLibKind();
switch (rlt) {
@@ -469,7 +471,7 @@ pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.array_list.Managed([]cons
}
if (target.abi.isAndroid() and !tc.driver.static and !tc.driver.static_pie) {
- try argv.append("-ldl");
+ try argv.append(tc.driver.comp.gpa, "-ldl");
}
}
lib/compiler/aro/aro/Tree.zig
@@ -42,7 +42,7 @@ pub const TokenWithExpansionLocs = struct {
pub fn addExpansionLocation(tok: *TokenWithExpansionLocs, gpa: std.mem.Allocator, new: []const Source.Location) !void {
if (new.len == 0 or tok.id == .whitespace or tok.id == .macro_ws or tok.id == .placemarker) return;
- var list = std.array_list.Managed(Source.Location).init(gpa);
+ var list: std.ArrayList(Source.Location) = .empty;
defer {
@memset(list.items.ptr[list.items.len..list.capacity], .{});
// Add a sentinel to indicate the end of the list since
@@ -65,7 +65,7 @@ pub const TokenWithExpansionLocs = struct {
const min_len = @max(list.items.len + new.len + 1, 4);
const wanted_len = std.math.ceilPowerOfTwo(usize, min_len) catch
return error.OutOfMemory;
- try list.ensureTotalCapacity(wanted_len);
+ try list.ensureTotalCapacity(gpa, wanted_len);
for (new) |new_loc| {
if (new_loc.id == .generated) continue;
@@ -119,8 +119,8 @@ tokens: Token.List.Slice,
// Values owned by this Tree
nodes: std.MultiArrayList(Node.Repr) = .empty,
-extra: std.ArrayListUnmanaged(u32) = .empty,
-root_decls: std.ArrayListUnmanaged(Node.Index) = .empty,
+extra: std.ArrayList(u32) = .empty,
+root_decls: std.ArrayList(Node.Index) = .empty,
value_map: ValueMap = .empty,
pub const genIr = CodeGen.genIr;
lib/compiler/aro/aro/TypeStore.zig
@@ -1216,6 +1216,13 @@ pub const QualType = packed struct(u32) {
return false;
},
.array => |array| {
+ if (qt.@"const") {
+ try w.writeAll("const ");
+ }
+ if (qt.@"volatile") {
+ try w.writeAll("volatile");
+ }
+
const simple = try array.elem.printPrologue(comp, desugar, w);
if (simple) try w.writeByte(' ');
return false;
@@ -1341,14 +1348,6 @@ pub const QualType = packed struct(u32) {
const static = array.len == .static;
if (static) try w.writeAll("static");
- if (qt.@"const") {
- if (static) try w.writeByte(' ');
- try w.writeAll("const");
- }
- if (qt.@"volatile") {
- if (static or qt.@"const") try w.writeByte(' ');
- try w.writeAll("volatile");
- }
if (qt.restrict) {
if (static or qt.@"const" or qt.@"volatile") try w.writeByte(' ');
try w.writeAll("restrict");
@@ -1694,8 +1693,8 @@ pub const Type = union(enum) {
};
types: std.MultiArrayList(Repr) = .empty,
-extra: std.ArrayListUnmanaged(u32) = .empty,
-attributes: std.ArrayListUnmanaged(Attribute) = .empty,
+extra: std.ArrayList(u32) = .empty,
+attributes: std.ArrayList(Attribute) = .empty,
anon_name_arena: std.heap.ArenaAllocator.State = .{},
wchar: QualType = .invalid,
@@ -2435,7 +2434,7 @@ pub const Builder = struct {
}
if (b.complex_tok) |tok| try b.parser.err(tok, .complex_int, .{});
- const qt = try b.parser.comp.type_store.put(b.parser.gpa, .{ .bit_int = .{
+ const qt = try b.parser.comp.type_store.put(b.parser.comp.gpa, .{ .bit_int = .{
.signedness = if (unsigned) .unsigned else .signed,
.bits = @intCast(bits),
} });
@@ -2476,6 +2475,7 @@ pub const Builder = struct {
pub fn finishQuals(b: Builder, qt: QualType) !QualType {
if (qt.isInvalid()) return .invalid;
+ const gpa = b.parser.comp.gpa;
var result_qt = qt;
if (b.atomic_type orelse b.atomic) |atomic_tok| {
if (result_qt.isAutoType()) return b.parser.todo("_Atomic __auto_type");
@@ -2505,7 +2505,7 @@ pub const Builder = struct {
return .invalid;
},
else => {
- result_qt = try b.parser.comp.type_store.put(b.parser.gpa, .{ .atomic = result_qt });
+ result_qt = try b.parser.comp.type_store.put(gpa, .{ .atomic = result_qt });
},
}
}
@@ -2514,7 +2514,7 @@ pub const Builder = struct {
const is_pointer = qt.isAutoType() or qt.isC23Auto() or qt.base(b.parser.comp).type == .pointer;
if (b.unaligned != null and !is_pointer) {
- result_qt = (try b.parser.comp.type_store.put(b.parser.gpa, .{ .attributed = .{
+ result_qt = (try b.parser.comp.type_store.put(gpa, .{ .attributed = .{
.base = result_qt,
.attributes = &.{.{ .tag = .unaligned, .args = .{ .unaligned = .{} }, .syntax = .keyword }},
} })).withQualifiers(result_qt);
lib/compiler/aro/assembly_backend/x86_64.zig
@@ -70,10 +70,11 @@ pub fn todo(c: *AsmCodeGen, msg: []const u8, tok: Tree.TokenIndex) Error {
const loc: Source.Location = c.tree.tokens.items(.loc)[tok];
var sf = std.heap.stackFallback(1024, c.comp.gpa);
- var buf = std.ArrayList(u8).init(sf.get());
- defer buf.deinit();
+ const allocator = sf.get();
+ var buf: std.ArrayList(u8) = .empty;
+ defer buf.deinit(allocator);
- try buf.print("TODO: {s}", .{msg});
+ try buf.print(allocator, "TODO: {s}", .{msg});
try c.comp.diagnostics.add(.{
.text = buf.items,
.kind = .@"error",
@@ -163,7 +164,7 @@ pub fn genAsm(tree: *const Tree) Error!Assembly {
}
fn genDecls(c: *AsmCodeGen) !void {
- if (c.tree.comp.code_gen_options.debug) {
+ if (c.tree.comp.code_gen_options.debug != .strip) {
const sources = c.tree.comp.sources.values();
for (sources) |source| {
try c.data.print(" .file {d} \"{s}\"\n", .{ @intFromEnum(source.id) - 1, source.path });
lib/compiler/aro/backend/Object/Elf.zig
@@ -4,8 +4,8 @@ const Target = std.Target;
const Object = @import("../Object.zig");
const Section = struct {
- data: std.array_list.Managed(u8),
- relocations: std.ArrayListUnmanaged(Relocation) = .{},
+ data: std.ArrayList(u8) = .empty,
+ relocations: std.ArrayList(Relocation) = .empty,
flags: u64,
type: u32,
index: u16 = undefined,
@@ -37,9 +37,9 @@ const Elf = @This();
obj: Object,
/// The keys are owned by the Codegen.tree
-sections: std.StringHashMapUnmanaged(*Section) = .{},
-local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
-global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
+sections: std.StringHashMapUnmanaged(*Section) = .empty,
+local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
+global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
unnamed_symbol_mangle: u32 = 0,
strtab_len: u64 = strtab_default.len,
arena: std.heap.ArenaAllocator,
@@ -58,7 +58,7 @@ pub fn deinit(elf: *Elf) void {
{
var it = elf.sections.valueIterator();
while (it.next()) |sect| {
- sect.*.data.deinit();
+ sect.*.data.deinit(gpa);
sect.*.relocations.deinit(gpa);
}
}
@@ -80,12 +80,12 @@ fn sectionString(sec: Object.Section) []const u8 {
};
}
-pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.array_list.Managed(u8) {
+pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.ArrayList(u8) {
const section_name = sectionString(section_kind);
const section = elf.sections.get(section_name) orelse blk: {
const section = try elf.arena.allocator().create(Section);
section.* = .{
- .data = std.array_list.Managed(u8).init(elf.arena.child_allocator),
+ .data = std.ArrayList(u8).init(elf.arena.child_allocator),
.type = std.elf.SHT_PROGBITS,
.flags = switch (section_kind) {
.func, .custom => std.elf.SHF_ALLOC + std.elf.SHF_EXECINSTR,
lib/compiler/aro/backend/CodeGenOptions.zig
@@ -66,6 +66,20 @@ pub const OptimizationLevel = enum {
pub fn fromString(str: []const u8) ?OptimizationLevel {
return level_map.get(str);
}
+
+ pub fn isSizeOptimized(self: OptimizationLevel) bool {
+ return switch (self) {
+ .s, .z => true,
+ .@"0", .@"1", .@"2", .@"3", .fast, .g => false,
+ };
+ }
+
+ pub fn hasAnyOptimizations(self: OptimizationLevel) bool {
+ return switch (self) {
+ .@"0" => false,
+ .@"1", .@"2", .@"3", .s, .fast, .g, .z => true,
+ };
+ }
};
pub const default: @This() = .{
lib/compiler/aro/backend/Interner.zig
@@ -8,14 +8,14 @@ const Limb = std.math.big.Limb;
const Interner = @This();
-map: std.AutoArrayHashMapUnmanaged(void, void) = .{},
+map: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
items: std.MultiArrayList(struct {
tag: Tag,
data: u32,
-}) = .{},
-extra: std.ArrayListUnmanaged(u32) = .{},
-limbs: std.ArrayListUnmanaged(Limb) = .{},
-strings: std.ArrayListUnmanaged(u8) = .{},
+}) = .empty,
+extra: std.ArrayList(u32) = .empty,
+limbs: std.ArrayList(Limb) = .empty,
+strings: std.ArrayList(u8) = .empty,
const KeyAdapter = struct {
interner: *const Interner,
lib/compiler/aro/backend/Ir.zig
@@ -11,7 +11,7 @@ decls: std.StringArrayHashMapUnmanaged(Decl),
pub const Decl = struct {
instructions: std.MultiArrayList(Inst),
- body: std.ArrayListUnmanaged(Ref),
+ body: std.ArrayList(Ref),
arena: std.heap.ArenaAllocator.State,
pub fn deinit(decl: *Decl, gpa: Allocator) void {
@@ -26,9 +26,9 @@ pub const Builder = struct {
arena: std.heap.ArenaAllocator,
interner: *Interner,
- decls: std.StringArrayHashMapUnmanaged(Decl) = .{},
- instructions: std.MultiArrayList(Ir.Inst) = .{},
- body: std.ArrayListUnmanaged(Ref) = .{},
+ decls: std.StringArrayHashMapUnmanaged(Decl) = .empty,
+ instructions: std.MultiArrayList(Ir.Inst) = .empty,
+ body: std.ArrayList(Ref) = .empty,
alloc_count: u32 = 0,
arg_count: u32 = 0,
current_label: Ref = undefined,
@@ -380,7 +380,7 @@ const REF = std.Io.tty.Color.bright_blue;
const LITERAL = std.Io.tty.Color.bright_green;
const ATTRIBUTE = std.Io.tty.Color.bright_yellow;
-const RefMap = std.AutoArrayHashMap(Ref, void);
+const RefMap = std.AutoArrayHashMapUnmanaged(Ref, void);
pub fn dump(ir: *const Ir, gpa: Allocator, config: std.Io.tty.Config, w: *std.Io.Writer) !void {
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,
const tags = decl.instructions.items(.tag);
const data = decl.instructions.items(.data);
- var ref_map = RefMap.init(gpa);
- defer ref_map.deinit();
+ var ref_map: RefMap = .empty;
+ defer ref_map.deinit(gpa);
- var label_map = RefMap.init(gpa);
- defer label_map.deinit();
+ var label_map: RefMap = .empty;
+ defer label_map.deinit(gpa);
const ret_inst = decl.body.items[decl.body.items.len - 1];
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,
const ref = decl.body.items[arg_count];
if (tags[@intFromEnum(ref)] != .arg) break;
if (arg_count != 0) try w.writeAll(", ");
- try ref_map.put(ref, {});
+ try ref_map.put(gpa, ref, {});
try ir.writeRef(decl, &ref_map, ref, config, w);
try config.setColor(w, .reset);
}
try w.writeAll(") {\n");
for (decl.body.items[arg_count..]) |ref| {
switch (tags[@intFromEnum(ref)]) {
- .label => try label_map.put(ref, {}),
+ .label => try label_map.put(gpa, ref, {}),
else => {},
}
}
@@ -461,7 +461,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
},
.select => {
const br = data[i].branch;
- try ir.writeNewRef(decl, &ref_map, ref, config, w);
+ try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
try w.writeAll("select ");
try ir.writeRef(decl, &ref_map, br.cond, config, w);
try config.setColor(w, .reset);
@@ -501,7 +501,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
},
.call => {
const call = data[i].call;
- try ir.writeNewRef(decl, &ref_map, ref, config, w);
+ try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
try w.writeAll("call ");
try ir.writeRef(decl, &ref_map, call.func, config, w);
try config.setColor(w, .reset);
@@ -515,7 +515,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
},
.alloc => {
const alloc = data[i].alloc;
- try ir.writeNewRef(decl, &ref_map, ref, config, w);
+ try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
try w.writeAll("alloc ");
try config.setColor(w, ATTRIBUTE);
try w.writeAll("size ");
@@ -528,7 +528,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
try w.writeByte('\n');
},
.phi => {
- try ir.writeNewRef(decl, &ref_map, ref, config, w);
+ try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
try w.writeAll("phi");
try config.setColor(w, .reset);
try w.writeAll(" {");
@@ -560,7 +560,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
try w.writeByte('\n');
},
.load => {
- try ir.writeNewRef(decl, &ref_map, ref, config, w);
+ try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
try w.writeAll("load ");
try ir.writeRef(decl, &ref_map, data[i].un, config, w);
try w.writeByte('\n');
@@ -583,7 +583,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
.mod,
=> {
const bin = data[i].bin;
- try ir.writeNewRef(decl, &ref_map, ref, config, w);
+ try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
try w.print("{s} ", .{@tagName(tag)});
try ir.writeRef(decl, &ref_map, bin.lhs, config, w);
try config.setColor(w, .reset);
@@ -598,7 +598,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8,
.sext,
=> {
const un = data[i].un;
- try ir.writeNewRef(decl, &ref_map, ref, config, w);
+ try ir.writeNewRef(gpa, decl, &ref_map, ref, config, w);
try w.print("{s} ", .{@tagName(tag)});
try ir.writeRef(decl, &ref_map, un, config, w);
try w.writeByte('\n');
@@ -679,8 +679,8 @@ fn writeRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, config: std.I
try w.print(" %{d}", .{ref_index});
}
-fn writeNewRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, config: std.Io.tty.Config, w: *std.Io.Writer) !void {
- try ref_map.put(ref, {});
+fn writeNewRef(ir: Ir, gpa: Allocator, decl: *const Decl, ref_map: *RefMap, ref: Ref, config: std.Io.tty.Config, w: *std.Io.Writer) !void {
+ try ref_map.put(gpa, ref, {});
try w.writeAll(" ");
try ir.writeRef(decl, ref_map, ref, config, w);
try config.setColor(w, .reset);
lib/compiler/aro/backend/Object.zig
@@ -30,7 +30,7 @@ pub const Section = union(enum) {
custom: []const u8,
};
-pub fn getSection(obj: *Object, section: Section) !*std.array_list.Managed(u8) {
+pub fn getSection(obj: *Object, section: Section) !*std.ArrayList(u8) {
switch (obj.format) {
.elf => return @as(*Elf, @alignCast(@fieldParentPtr("obj", obj))).getSection(section),
else => unreachable,
lib/compiler/translate-c/main.zig
@@ -150,7 +150,7 @@ fn translate(d: *aro.Driver, tc: *aro.Toolchain, args: [][:0]u8) !void {
// be written to a tmp file then renamed into place, meaning the path will be
// wrong as soon as the work is done.
var opt_dep_file = try d.initDepFile(source, &name_buf, true);
- defer if (opt_dep_file) |*dep_file| dep_file.deinit(pp.gpa);
+ defer if (opt_dep_file) |*dep_file| dep_file.deinit(gpa);
if (opt_dep_file) |*dep_file| pp.dep_file = dep_file;