mirror of
https://github.com/ziglang/zig.git
synced 2025-02-15 09:00:16 +00:00
Merge pull request #20380 from tau-dev/master
llvm: Nest debug info correctly
This commit is contained in:
commit
397be0c9cc
@ -2459,13 +2459,24 @@ pub const ModuleDebugInfo = switch (native_os) {
|
||||
module,
|
||||
relocated_address - coff_section.virtual_address,
|
||||
) orelse "???";
|
||||
// While DWARF gets us just the function's own name, the PDB
|
||||
// stores it qualified with its namespace by the C++ `::`
|
||||
// operator. We can strip that for consistency; the
|
||||
// SymbolInfo will contain the line number, which is a more
|
||||
// language-neutral way of distinguishing same-named symbols
|
||||
// anyway.
|
||||
const symbol_simple_name = if (mem.indexOf(u8, symbol_name, "::")) |cpp_namespace|
|
||||
symbol_name[cpp_namespace + 2 ..]
|
||||
else
|
||||
symbol_name;
|
||||
|
||||
const opt_line_info = try self.pdb.?.getLineNumberInfo(
|
||||
module,
|
||||
relocated_address - coff_section.virtual_address,
|
||||
);
|
||||
|
||||
return SymbolInfo{
|
||||
.symbol_name = symbol_name,
|
||||
.symbol_name = symbol_simple_name,
|
||||
.compile_unit_name = obj_basename,
|
||||
.line_info = opt_line_info,
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7651,6 +7651,8 @@ pub const Metadata = enum(u32) {
|
||||
composite_vector_type,
|
||||
derived_pointer_type,
|
||||
derived_member_type,
|
||||
derived_typedef,
|
||||
imported_declaration,
|
||||
subroutine_type,
|
||||
enumerator_unsigned,
|
||||
enumerator_signed_positive,
|
||||
@ -7696,6 +7698,8 @@ pub const Metadata = enum(u32) {
|
||||
.composite_vector_type,
|
||||
.derived_pointer_type,
|
||||
.derived_member_type,
|
||||
.derived_typedef,
|
||||
.imported_declaration,
|
||||
.subroutine_type,
|
||||
.enumerator_unsigned,
|
||||
.enumerator_signed_positive,
|
||||
@ -7812,6 +7816,7 @@ pub const Metadata = enum(u32) {
|
||||
producer: MetadataString,
|
||||
enums: Metadata,
|
||||
globals: Metadata,
|
||||
imports: Metadata,
|
||||
};
|
||||
|
||||
pub const Subprogram = struct {
|
||||
@ -7860,6 +7865,7 @@ pub const Metadata = enum(u32) {
|
||||
}
|
||||
};
|
||||
|
||||
scope: Metadata,
|
||||
file: Metadata,
|
||||
name: MetadataString,
|
||||
linkage_name: MetadataString,
|
||||
@ -7905,6 +7911,10 @@ pub const Metadata = enum(u32) {
|
||||
align_in_bits_lo: u32,
|
||||
align_in_bits_hi: u32,
|
||||
fields_tuple: Metadata,
|
||||
flags: packed struct(u32) {
|
||||
is_byref: bool,
|
||||
pad: u31 = 0,
|
||||
},
|
||||
|
||||
pub fn bitSize(self: CompositeType) u64 {
|
||||
return @as(u64, self.size_in_bits_hi) << 32 | self.size_in_bits_lo;
|
||||
@ -7938,6 +7948,14 @@ pub const Metadata = enum(u32) {
|
||||
}
|
||||
};
|
||||
|
||||
pub const ImportedEntity = struct {
|
||||
name: MetadataString,
|
||||
file: Metadata,
|
||||
scope: Metadata,
|
||||
line: u32,
|
||||
entity: Metadata,
|
||||
};
|
||||
|
||||
pub const SubroutineType = struct {
|
||||
types_tuple: Metadata,
|
||||
};
|
||||
@ -7990,10 +8008,6 @@ pub const Metadata = enum(u32) {
|
||||
};
|
||||
|
||||
pub const GlobalVar = struct {
|
||||
pub const Options = struct {
|
||||
local: bool,
|
||||
};
|
||||
|
||||
name: MetadataString,
|
||||
linkage_name: MetadataString,
|
||||
file: Metadata,
|
||||
@ -8224,6 +8238,7 @@ pub const Metadata = enum(u32) {
|
||||
DIBasicType,
|
||||
DICompositeType,
|
||||
DIDerivedType,
|
||||
DIImportedEntity,
|
||||
DISubroutineType,
|
||||
DIEnumerator,
|
||||
DISubrange,
|
||||
@ -9961,7 +9976,7 @@ pub fn printUnbuffered(
|
||||
.enums = extra.enums,
|
||||
.retainedTypes = null,
|
||||
.globals = extra.globals,
|
||||
.imports = null,
|
||||
.imports = extra.imports,
|
||||
.macros = null,
|
||||
.dwoId = null,
|
||||
.splitDebugInlining = false,
|
||||
@ -9985,7 +10000,7 @@ pub fn printUnbuffered(
|
||||
try metadata_formatter.specialized(.@"distinct !", .DISubprogram, .{
|
||||
.name = extra.name,
|
||||
.linkageName = extra.linkage_name,
|
||||
.scope = extra.file,
|
||||
.scope = extra.scope,
|
||||
.file = extra.file,
|
||||
.line = extra.line,
|
||||
.type = extra.ty,
|
||||
@ -10079,8 +10094,8 @@ pub fn printUnbuffered(
|
||||
else => extra.name,
|
||||
},
|
||||
.scope = extra.scope,
|
||||
.file = null,
|
||||
.line = null,
|
||||
.file = extra.file,
|
||||
.line = extra.line,
|
||||
.baseType = extra.underlying_type,
|
||||
.size = extra.bitSize(),
|
||||
.@"align" = extra.bitAlign(),
|
||||
@ -10101,15 +10116,18 @@ pub fn printUnbuffered(
|
||||
},
|
||||
.derived_pointer_type,
|
||||
.derived_member_type,
|
||||
.derived_typedef,
|
||||
=> |kind| {
|
||||
const extra = self.metadataExtraData(Metadata.DerivedType, metadata_item.data);
|
||||
try metadata_formatter.specialized(.@"!", .DIDerivedType, .{
|
||||
.tag = @as(enum {
|
||||
DW_TAG_pointer_type,
|
||||
DW_TAG_member,
|
||||
DW_TAG_typedef,
|
||||
}, switch (kind) {
|
||||
.derived_pointer_type => .DW_TAG_pointer_type,
|
||||
.derived_member_type => .DW_TAG_member,
|
||||
.derived_typedef => .DW_TAG_typedef,
|
||||
else => unreachable,
|
||||
}),
|
||||
.name = switch (extra.name) {
|
||||
@ -10132,6 +10150,22 @@ pub fn printUnbuffered(
|
||||
.annotations = null,
|
||||
}, writer);
|
||||
},
|
||||
.imported_declaration => {
|
||||
const extra = self.metadataExtraData(Metadata.ImportedEntity, metadata_item.data);
|
||||
|
||||
try metadata_formatter.specialized(.@"!", .DIImportedEntity, .{
|
||||
.tag = .DW_TAG_imported_declaration,
|
||||
.scope = extra.scope,
|
||||
.entity = extra.entity,
|
||||
.file = extra.file,
|
||||
.line = extra.line,
|
||||
.name = switch (extra.name) {
|
||||
.none => null,
|
||||
else => extra.name,
|
||||
},
|
||||
.elements = null,
|
||||
}, writer);
|
||||
},
|
||||
.subroutine_type => {
|
||||
const extra = self.metadataExtraData(Metadata.SubroutineType, metadata_item.data);
|
||||
try metadata_formatter.specialized(.@"!", .DISubroutineType, .{
|
||||
@ -10255,11 +10289,7 @@ pub fn printUnbuffered(
|
||||
.file = extra.file,
|
||||
.line = extra.line,
|
||||
.type = extra.ty,
|
||||
.isLocal = switch (kind) {
|
||||
.global_var => false,
|
||||
.@"global_var local" => true,
|
||||
else => unreachable,
|
||||
},
|
||||
.isLocal = kind != .global_var,
|
||||
.isDefinition = true,
|
||||
.declaration = null,
|
||||
.templateParams = null,
|
||||
@ -11612,7 +11642,17 @@ fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item.
|
||||
u32 => value,
|
||||
MetadataString, Metadata, Variable.Index, Value => @intFromEnum(value),
|
||||
Metadata.DIFlags => @bitCast(value),
|
||||
else => @compileError("bad field type: " ++ @typeName(field.type)),
|
||||
else => blk: {
|
||||
switch (@typeInfo(field.type)) {
|
||||
.Struct => |s| {
|
||||
if (s.backing_integer == u32)
|
||||
break :blk @bitCast(value);
|
||||
@compileLog(s.layout, s.backing_integer);
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
@compileError("bad field type: " ++ @typeName(field.type));
|
||||
},
|
||||
});
|
||||
}
|
||||
return result;
|
||||
@ -11651,7 +11691,7 @@ fn metadataExtraDataTrail(
|
||||
u32 => value,
|
||||
MetadataString, Metadata, Variable.Index, Value => @enumFromInt(value),
|
||||
Metadata.DIFlags => @bitCast(value),
|
||||
else => @compileError("bad field type: " ++ @typeName(field.type)),
|
||||
else => @bitCast(value),
|
||||
};
|
||||
return .{
|
||||
.data = result,
|
||||
@ -11740,15 +11780,17 @@ pub fn debugCompileUnit(
|
||||
producer: MetadataString,
|
||||
enums: Metadata,
|
||||
globals: Metadata,
|
||||
imports: Metadata,
|
||||
options: Metadata.CompileUnit.Options,
|
||||
) Allocator.Error!Metadata {
|
||||
try self.ensureUnusedMetadataCapacity(1, Metadata.CompileUnit, 0);
|
||||
return self.debugCompileUnitAssumeCapacity(file, producer, enums, globals, options);
|
||||
return self.debugCompileUnitAssumeCapacity(file, producer, enums, globals, imports, options);
|
||||
}
|
||||
|
||||
pub fn debugSubprogram(
|
||||
self: *Builder,
|
||||
file: Metadata,
|
||||
scope: Metadata,
|
||||
name: MetadataString,
|
||||
linkage_name: MetadataString,
|
||||
line: u32,
|
||||
@ -11760,6 +11802,7 @@ pub fn debugSubprogram(
|
||||
try self.ensureUnusedMetadataCapacity(1, Metadata.Subprogram, 0);
|
||||
return self.debugSubprogramAssumeCapacity(
|
||||
file,
|
||||
scope,
|
||||
name,
|
||||
linkage_name,
|
||||
line,
|
||||
@ -11815,6 +11858,7 @@ pub fn debugStructType(
|
||||
size_in_bits: u64,
|
||||
align_in_bits: u64,
|
||||
fields_tuple: Metadata,
|
||||
is_byref: bool,
|
||||
) Allocator.Error!Metadata {
|
||||
try self.ensureUnusedMetadataCapacity(1, Metadata.CompositeType, 0);
|
||||
return self.debugStructTypeAssumeCapacity(
|
||||
@ -11826,6 +11870,7 @@ pub fn debugStructType(
|
||||
size_in_bits,
|
||||
align_in_bits,
|
||||
fields_tuple,
|
||||
is_byref,
|
||||
);
|
||||
}
|
||||
|
||||
@ -11839,6 +11884,7 @@ pub fn debugUnionType(
|
||||
size_in_bits: u64,
|
||||
align_in_bits: u64,
|
||||
fields_tuple: Metadata,
|
||||
is_byref: bool,
|
||||
) Allocator.Error!Metadata {
|
||||
try self.ensureUnusedMetadataCapacity(1, Metadata.CompositeType, 0);
|
||||
return self.debugUnionTypeAssumeCapacity(
|
||||
@ -11850,6 +11896,7 @@ pub fn debugUnionType(
|
||||
size_in_bits,
|
||||
align_in_bits,
|
||||
fields_tuple,
|
||||
is_byref,
|
||||
);
|
||||
}
|
||||
|
||||
@ -11973,6 +12020,53 @@ pub fn debugMemberType(
|
||||
);
|
||||
}
|
||||
|
||||
pub fn debugTypedef(
|
||||
self: *Builder,
|
||||
name: MetadataString,
|
||||
file: Metadata,
|
||||
scope: Metadata,
|
||||
line: u32,
|
||||
underlying_type: Metadata,
|
||||
align_in_bits: u64,
|
||||
) Allocator.Error!Metadata {
|
||||
try self.ensureUnusedMetadataCapacity(1, Metadata.DerivedType, 0);
|
||||
|
||||
assert(!self.strip);
|
||||
return self.metadataSimpleAssumeCapacity(.derived_typedef, Metadata.DerivedType{
|
||||
.name = name,
|
||||
.file = file,
|
||||
.scope = scope,
|
||||
.line = line,
|
||||
.underlying_type = underlying_type,
|
||||
.size_in_bits_lo = 0,
|
||||
.size_in_bits_hi = 0,
|
||||
.align_in_bits_lo = @truncate(align_in_bits),
|
||||
.align_in_bits_hi = @truncate(align_in_bits >> 32),
|
||||
.offset_in_bits_lo = 0,
|
||||
.offset_in_bits_hi = 0,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn debugImportDeclaration(
|
||||
self: *Builder,
|
||||
name: MetadataString,
|
||||
file: Metadata,
|
||||
scope: Metadata,
|
||||
line: u32,
|
||||
entity: Metadata,
|
||||
) Allocator.Error!Metadata {
|
||||
try self.ensureUnusedMetadataCapacity(1, Metadata.ImportedEntity, 0);
|
||||
|
||||
assert(!self.strip);
|
||||
return self.metadataSimpleAssumeCapacity(.imported_declaration, Metadata.ImportedEntity{
|
||||
.name = name,
|
||||
.file = file,
|
||||
.scope = scope,
|
||||
.line = line,
|
||||
.entity = entity,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn debugSubroutineType(
|
||||
self: *Builder,
|
||||
types_tuple: Metadata,
|
||||
@ -12063,7 +12157,7 @@ pub fn debugGlobalVar(
|
||||
line: u32,
|
||||
ty: Metadata,
|
||||
variable: Variable.Index,
|
||||
options: Metadata.GlobalVar.Options,
|
||||
internal: bool,
|
||||
) Allocator.Error!Metadata {
|
||||
try self.ensureUnusedMetadataCapacity(1, Metadata.GlobalVar, 0);
|
||||
return self.debugGlobalVarAssumeCapacity(
|
||||
@ -12074,7 +12168,7 @@ pub fn debugGlobalVar(
|
||||
line,
|
||||
ty,
|
||||
variable,
|
||||
options,
|
||||
internal,
|
||||
);
|
||||
}
|
||||
|
||||
@ -12207,6 +12301,7 @@ pub fn debugCompileUnitAssumeCapacity(
|
||||
producer: MetadataString,
|
||||
enums: Metadata,
|
||||
globals: Metadata,
|
||||
imports: Metadata,
|
||||
options: Metadata.CompileUnit.Options,
|
||||
) Metadata {
|
||||
assert(!self.strip);
|
||||
@ -12217,6 +12312,7 @@ pub fn debugCompileUnitAssumeCapacity(
|
||||
.producer = producer,
|
||||
.enums = enums,
|
||||
.globals = globals,
|
||||
.imports = imports,
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -12224,6 +12320,7 @@ pub fn debugCompileUnitAssumeCapacity(
|
||||
fn debugSubprogramAssumeCapacity(
|
||||
self: *Builder,
|
||||
file: Metadata,
|
||||
scope: Metadata,
|
||||
name: MetadataString,
|
||||
linkage_name: MetadataString,
|
||||
line: u32,
|
||||
@ -12237,6 +12334,7 @@ fn debugSubprogramAssumeCapacity(
|
||||
@as(u3, @truncate(@as(u32, @bitCast(options.sp_flags)) >> 2)));
|
||||
return self.metadataDistinctAssumeCapacity(tag, Metadata.Subprogram{
|
||||
.file = file,
|
||||
.scope = scope,
|
||||
.name = name,
|
||||
.linkage_name = linkage_name,
|
||||
.line = line,
|
||||
@ -12320,6 +12418,7 @@ fn debugStructTypeAssumeCapacity(
|
||||
size_in_bits: u64,
|
||||
align_in_bits: u64,
|
||||
fields_tuple: Metadata,
|
||||
is_byref: bool,
|
||||
) Metadata {
|
||||
assert(!self.strip);
|
||||
return self.debugCompositeTypeAssumeCapacity(
|
||||
@ -12332,6 +12431,7 @@ fn debugStructTypeAssumeCapacity(
|
||||
size_in_bits,
|
||||
align_in_bits,
|
||||
fields_tuple,
|
||||
is_byref,
|
||||
);
|
||||
}
|
||||
|
||||
@ -12345,6 +12445,7 @@ fn debugUnionTypeAssumeCapacity(
|
||||
size_in_bits: u64,
|
||||
align_in_bits: u64,
|
||||
fields_tuple: Metadata,
|
||||
is_byref: bool,
|
||||
) Metadata {
|
||||
assert(!self.strip);
|
||||
return self.debugCompositeTypeAssumeCapacity(
|
||||
@ -12357,6 +12458,7 @@ fn debugUnionTypeAssumeCapacity(
|
||||
size_in_bits,
|
||||
align_in_bits,
|
||||
fields_tuple,
|
||||
is_byref,
|
||||
);
|
||||
}
|
||||
|
||||
@ -12382,6 +12484,7 @@ fn debugEnumerationTypeAssumeCapacity(
|
||||
size_in_bits,
|
||||
align_in_bits,
|
||||
fields_tuple,
|
||||
false, // is_byref
|
||||
);
|
||||
}
|
||||
|
||||
@ -12407,6 +12510,7 @@ fn debugArrayTypeAssumeCapacity(
|
||||
size_in_bits,
|
||||
align_in_bits,
|
||||
fields_tuple,
|
||||
size_in_bits > 0, // is_byref
|
||||
);
|
||||
}
|
||||
|
||||
@ -12432,6 +12536,7 @@ fn debugVectorTypeAssumeCapacity(
|
||||
size_in_bits,
|
||||
align_in_bits,
|
||||
fields_tuple,
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@ -12446,6 +12551,7 @@ fn debugCompositeTypeAssumeCapacity(
|
||||
size_in_bits: u64,
|
||||
align_in_bits: u64,
|
||||
fields_tuple: Metadata,
|
||||
is_byref: bool,
|
||||
) Metadata {
|
||||
assert(!self.strip);
|
||||
return self.metadataSimpleAssumeCapacity(tag, Metadata.CompositeType{
|
||||
@ -12459,6 +12565,7 @@ fn debugCompositeTypeAssumeCapacity(
|
||||
.align_in_bits_lo = @truncate(align_in_bits),
|
||||
.align_in_bits_hi = @truncate(align_in_bits >> 32),
|
||||
.fields_tuple = fields_tuple,
|
||||
.flags = .{ .is_byref = is_byref },
|
||||
});
|
||||
}
|
||||
|
||||
@ -12769,11 +12876,11 @@ fn debugGlobalVarAssumeCapacity(
|
||||
line: u32,
|
||||
ty: Metadata,
|
||||
variable: Variable.Index,
|
||||
options: Metadata.GlobalVar.Options,
|
||||
internal: bool,
|
||||
) Metadata {
|
||||
assert(!self.strip);
|
||||
return self.metadataDistinctAssumeCapacity(
|
||||
if (options.local) .@"global_var local" else .global_var,
|
||||
if (internal) .@"global_var local" else .global_var,
|
||||
Metadata.GlobalVar{
|
||||
.name = name,
|
||||
.linkage_name = linkage_name,
|
||||
@ -13804,6 +13911,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
|
||||
},
|
||||
.enums = extra.enums,
|
||||
.globals = extra.globals,
|
||||
.imports = extra.imports,
|
||||
}, metadata_adapter);
|
||||
},
|
||||
.subprogram,
|
||||
@ -13818,7 +13926,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
|
||||
const extra = self.metadataExtraData(Metadata.Subprogram, data);
|
||||
|
||||
try metadata_block.writeAbbrevAdapted(MetadataBlock.Subprogram{
|
||||
.scope = extra.file,
|
||||
.scope = extra.scope,
|
||||
.name = extra.name,
|
||||
.linkage_name = extra.linkage_name,
|
||||
.file = extra.file,
|
||||
@ -13892,18 +14000,24 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
|
||||
.underlying_type = extra.underlying_type,
|
||||
.size_in_bits = extra.bitSize(),
|
||||
.align_in_bits = extra.bitAlign(),
|
||||
.flags = if (kind == .composite_vector_type) .{ .Vector = true } else .{},
|
||||
.flags = .{
|
||||
.Vector = kind == .composite_vector_type,
|
||||
.EnumClass = kind == .composite_enumeration_type,
|
||||
.TypePassbyReference = extra.flags.is_byref,
|
||||
},
|
||||
.elements = extra.fields_tuple,
|
||||
}, metadata_adapter);
|
||||
},
|
||||
.derived_pointer_type,
|
||||
.derived_member_type,
|
||||
.derived_typedef,
|
||||
=> |kind| {
|
||||
const extra = self.metadataExtraData(Metadata.DerivedType, data);
|
||||
try metadata_block.writeAbbrevAdapted(MetadataBlock.DerivedType{
|
||||
.tag = switch (kind) {
|
||||
.derived_pointer_type => DW.TAG.pointer_type,
|
||||
.derived_member_type => DW.TAG.member,
|
||||
.derived_typedef => DW.TAG.typedef,
|
||||
else => unreachable,
|
||||
},
|
||||
.name = extra.name,
|
||||
@ -13914,6 +14028,20 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
|
||||
.size_in_bits = extra.bitSize(),
|
||||
.align_in_bits = extra.bitAlign(),
|
||||
.offset_in_bits = extra.bitOffset(),
|
||||
.flags = .{
|
||||
.StaticMember = false,
|
||||
},
|
||||
}, metadata_adapter);
|
||||
},
|
||||
.imported_declaration => {
|
||||
const extra = self.metadataExtraData(Metadata.ImportedEntity, data);
|
||||
try metadata_block.writeAbbrevAdapted(MetadataBlock.ImportedEntity{
|
||||
.tag = DW.TAG.imported_declaration,
|
||||
.scope = extra.scope,
|
||||
.entity = extra.entity,
|
||||
.line = extra.line,
|
||||
.name = extra.name,
|
||||
.file = extra.file,
|
||||
}, metadata_adapter);
|
||||
},
|
||||
.subroutine_type => {
|
||||
|
@ -649,6 +649,7 @@ pub const MetadataBlock = struct {
|
||||
BasicType,
|
||||
CompositeType,
|
||||
DerivedType,
|
||||
ImportedEntity,
|
||||
SubroutineType,
|
||||
Enumerator,
|
||||
Subrange,
|
||||
@ -694,7 +695,7 @@ pub const MetadataBlock = struct {
|
||||
pub const ops = [_]AbbrevOp{
|
||||
.{ .literal = 20 },
|
||||
.{ .literal = 1 }, // is distinct
|
||||
.{ .literal = std.dwarf.LANG.C99 }, // source language
|
||||
.{ .literal = std.dwarf.LANG.C_plus_plus_11 }, // source language
|
||||
MetadataAbbrev, // file
|
||||
MetadataAbbrev, // producer
|
||||
.{ .fixed = 1 }, // isOptimized
|
||||
@ -706,7 +707,7 @@ pub const MetadataBlock = struct {
|
||||
.{ .literal = 0 }, // retained types
|
||||
.{ .literal = 0 }, // subprograms
|
||||
MetadataAbbrev, // globals
|
||||
.{ .literal = 0 }, // imported entities
|
||||
MetadataAbbrev, // imported entities
|
||||
.{ .literal = 0 }, // DWO ID
|
||||
.{ .literal = 0 }, // macros
|
||||
.{ .literal = 0 }, // split debug inlining
|
||||
@ -722,6 +723,7 @@ pub const MetadataBlock = struct {
|
||||
is_optimized: bool,
|
||||
enums: Builder.Metadata,
|
||||
globals: Builder.Metadata,
|
||||
imports: Builder.Metadata,
|
||||
};
|
||||
|
||||
pub const Subprogram = struct {
|
||||
@ -863,7 +865,7 @@ pub const MetadataBlock = struct {
|
||||
.{ .vbr = 6 }, // size in bits
|
||||
.{ .vbr = 6 }, // align in bits
|
||||
.{ .vbr = 6 }, // offset in bits
|
||||
.{ .literal = 0 }, // flags
|
||||
.{ .fixed = 32 }, // flags
|
||||
.{ .literal = 0 }, // extra data
|
||||
};
|
||||
|
||||
@ -876,6 +878,28 @@ pub const MetadataBlock = struct {
|
||||
size_in_bits: u64,
|
||||
align_in_bits: u64,
|
||||
offset_in_bits: u64,
|
||||
flags: Builder.Metadata.DIFlags,
|
||||
};
|
||||
|
||||
pub const ImportedEntity = struct {
|
||||
pub const ops = [_]AbbrevOp{
|
||||
.{ .literal = 31 },
|
||||
.{ .literal = 0 }, // is distinct
|
||||
.{ .fixed = 32 }, // tag
|
||||
MetadataAbbrev, // scope
|
||||
MetadataAbbrev, // entity
|
||||
LineAbbrev, // line
|
||||
MetadataAbbrev, // name
|
||||
MetadataAbbrev, // file
|
||||
.{ .literal = 0 }, // elements
|
||||
};
|
||||
|
||||
tag: u32,
|
||||
scope: Builder.Metadata,
|
||||
entity: Builder.Metadata,
|
||||
line: u32,
|
||||
name: Builder.MetadataString,
|
||||
file: Builder.Metadata,
|
||||
};
|
||||
|
||||
pub const SubroutineType = struct {
|
||||
|
23
test/cases/llvm/debug_types.zig
Normal file
23
test/cases/llvm/debug_types.zig
Normal file
@ -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
|
||||
//
|
Loading…
Reference in New Issue
Block a user