| ... | ... | @@ -121,21 +121,6 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 121 | 121 | try self.types.append( |
| 122 | 122 | self.arena, |
| 123 | 123 | switch (ip_index) { |
| 124 | | else => blk: { |
| 125 | | // TODO: map the remaining refs to a correct type |
| 126 | | // instead of just assinging "array" to them. |
| 127 | | break :blk .{ |
| 128 | | .Array = .{ |
| 129 | | .len = .{ |
| 130 | | .int = .{ |
| 131 | | .value = 1, |
| 132 | | .negated = false, |
| 133 | | }, |
| 134 | | }, |
| 135 | | .child = .{ .type = 0 }, |
| 136 | | }, |
| 137 | | }; |
| 138 | | }, |
| 139 | 124 | .u0_type, |
| 140 | 125 | .i0_type, |
| 141 | 126 | .u1_type, |
| ... | ... | @@ -153,6 +138,7 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 153 | 138 | .i128_type, |
| 154 | 139 | .usize_type, |
| 155 | 140 | .isize_type, |
| 141 | .c_char_type, |
| 156 | 142 | .c_short_type, |
| 157 | 143 | .c_ushort_type, |
| 158 | 144 | .c_int_type, |
| ... | ... | @@ -183,10 +169,10 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 183 | 169 | .anyopaque_type => .{ |
| 184 | 170 | .ComptimeExpr = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 185 | 171 | }, |
| 172 | |
| 186 | 173 | .bool_type => .{ |
| 187 | 174 | .Bool = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 188 | 175 | }, |
| 189 | | |
| 190 | 176 | .noreturn_type => .{ |
| 191 | 177 | .NoReturn = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 192 | 178 | }, |
| ... | ... | @@ -203,10 +189,103 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 203 | 189 | .ErrorSet = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 204 | 190 | }, |
| 205 | 191 | // should be an Enum but if we don't analyze std we don't get the ast node |
| 206 | | // since it's std.builtin.CallingConvention |
| 207 | | .calling_convention_type => .{ |
| 192 | // since it's defined in std.builtin |
| 193 | .calling_convention_type, |
| 194 | .atomic_order_type, |
| 195 | .atomic_rmw_op_type, |
| 196 | .address_space_type, |
| 197 | .float_mode_type, |
| 198 | .reduce_op_type, |
| 199 | .call_modifier_type, |
| 200 | .prefetch_options_type, |
| 201 | .export_options_type, |
| 202 | .extern_options_type, |
| 203 | => .{ |
| 204 | .Type = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 205 | }, |
| 206 | .manyptr_u8_type => .{ |
| 207 | .Pointer = .{ |
| 208 | .size = .Many, |
| 209 | .child = .{ .type = @intFromEnum(InternPool.Index.u8_type) }, |
| 210 | .is_mutable = true, |
| 211 | }, |
| 212 | }, |
| 213 | .manyptr_const_u8_type => .{ |
| 214 | .Pointer = .{ |
| 215 | .size = .Many, |
| 216 | .child = .{ .type = @intFromEnum(InternPool.Index.u8_type) }, |
| 217 | }, |
| 218 | }, |
| 219 | .manyptr_const_u8_sentinel_0_type => .{ |
| 220 | .Pointer = .{ |
| 221 | .size = .Many, |
| 222 | .child = .{ .type = @intFromEnum(InternPool.Index.u8_type) }, |
| 223 | .sentinel = .{ .int = .{ .value = 0 } }, |
| 224 | }, |
| 225 | }, |
| 226 | .single_const_pointer_to_comptime_int_type => .{ |
| 227 | .Pointer = .{ |
| 228 | .size = .One, |
| 229 | .child = .{ .type = @intFromEnum(InternPool.Index.comptime_int_type) }, |
| 230 | }, |
| 231 | }, |
| 232 | .slice_const_u8_type => .{ |
| 233 | .Pointer = .{ |
| 234 | .size = .Slice, |
| 235 | .child = .{ .type = @intFromEnum(InternPool.Index.u8_type) }, |
| 236 | }, |
| 237 | }, |
| 238 | .slice_const_u8_sentinel_0_type => .{ |
| 239 | .Pointer = .{ |
| 240 | .size = .Slice, |
| 241 | .child = .{ .type = @intFromEnum(InternPool.Index.u8_type) }, |
| 242 | .sentinel = .{ .int = .{ .value = 0 } }, |
| 243 | }, |
| 244 | }, |
| 245 | // Not fully correct |
| 246 | // since it actually has no src or line_number |
| 247 | .empty_struct_type => .{ |
| 248 | .Struct = .{ |
| 249 | .name = "", |
| 250 | .src = 0, |
| 251 | .is_tuple = false, |
| 252 | .line_number = 0, |
| 253 | .parent_container = null, |
| 254 | .layout = null, |
| 255 | }, |
| 256 | }, |
| 257 | .anyerror_void_error_union_type => .{ |
| 258 | .ErrorUnion = .{ |
| 259 | .lhs = .{ .type = @intFromEnum(InternPool.Index.anyerror_type) }, |
| 260 | .rhs = .{ .type = @intFromEnum(InternPool.Index.void_type) }, |
| 261 | }, |
| 262 | }, |
| 263 | .anyframe_type => .{ |
| 264 | .AnyFrame = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 265 | }, |
| 266 | .enum_literal_type => .{ |
| 267 | .EnumLiteral = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 268 | }, |
| 269 | .undefined_type => .{ |
| 270 | .Undefined = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 271 | }, |
| 272 | .null_type => .{ |
| 273 | .Null = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 274 | }, |
| 275 | .optional_noreturn_type => .{ |
| 276 | .Optional = .{ |
| 277 | .name = try tmpbuf.toOwnedSlice(), |
| 278 | .child = .{ .type = @intFromEnum(InternPool.Index.noreturn_type) }, |
| 279 | }, |
| 280 | }, |
| 281 | // Poison and special tag |
| 282 | .generic_poison_type, |
| 283 | .var_args_param_type, |
| 284 | => .{ |
| 208 | 285 | .Type = .{ .name = try tmpbuf.toOwnedSlice() }, |
| 209 | 286 | }, |
| 287 | // We want to catch new types added to InternPool.Index |
| 288 | else => unreachable, |
| 210 | 289 | }, |
| 211 | 290 | ); |
| 212 | 291 | } |