diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 1b0abafdb1ea..2635a72e41c1 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -2024,7 +2024,6 @@ pub const Object = struct { }, .Int => { const info = ty.intInfo(mod); - assert(info.bits != 0); const int_name = try o.allocTypeName(ty); defer gpa.free(int_name); const builder_name = try o.builder.metadataString(int_name); @@ -2206,7 +2205,6 @@ pub const Object = struct { const debug_elem_type = switch (elem_ty.zigTypeTag(mod)) { .Int => blk: { const info = elem_ty.intInfo(mod); - assert(info.bits != 0); const vec_name = try o.allocTypeName(ty); defer gpa.free(vec_name); const builder_name = try o.builder.metadataString(vec_name); @@ -2530,6 +2528,15 @@ pub const Object = struct { if (owner == decl_id) continue; } + switch (nested_type.zigTypeTag(mod)) { + // We still may want these for a Zig expression + // evaluator in debuggers, but for now they are + // completely useless. + .ComptimeInt, .ComptimeFloat, + .Type, .Undefined, .Null, .EnumLiteral => continue, + else => {}, + } + fields.appendAssumeCapacity(try o.builder.debugTypedef( try o.builder.metadataString(decl_name), try o.getDebugFile(namespace.file_scope), diff --git a/test/cases/llvm/debug_types.zig b/test/cases/llvm/debug_types.zig new file mode 100644 index 000000000000..27bd1b3c61a9 --- /dev/null +++ b/test/cases/llvm/debug_types.zig @@ -0,0 +1,23 @@ +const Ty = struct { + pub const A = void; + pub const B = @Vector(2, u0); + pub const C = u0; + pub const D = enum (u0) {}; + pub const E = type; + pub const F = 1; + pub const G = 1.0; + pub const H = undefined; + pub const I = null; + pub const J = .foo; +}; +pub fn main() void { + inline for (@typeInfo(Ty).Struct.decls) |d|{ + _ = @field(Ty, d.name); + } +} + +// compile +// output_mode=Exe +// backend=llvm +// target=x86_64-linux,x86_64-macos +// \ No newline at end of file