Correct typo in soa data type debug information generation

This commit is contained in:
gingerBill
2021-11-01 23:00:42 +00:00
parent 4f0a3eec24
commit b01e0fbbc2
2 changed files with 10 additions and 7 deletions
+2 -2
View File
@@ -2440,14 +2440,14 @@ main :: proc() {
range_statements_with_multiple_return_values() range_statements_with_multiple_return_values()
threading_example() threading_example()
when !ODIN_DEBUG { // when !ODIN_DEBUG {
/* /*
This test causes the following error when compiled with -`debug`: This test causes the following error when compiled with -`debug`:
`Kernel32.lib(KERNEL32.dll) : fatal error LNK1103: debugging information corrupt; recompile module` `Kernel32.lib(KERNEL32.dll) : fatal error LNK1103: debugging information corrupt; recompile module`
Only compile when not running under debug for now to not hold up CI for other commits. Only compile when not running under debug for now to not hold up CI for other commits.
*/ */
soa_struct_layout() soa_struct_layout()
} // }
constant_literal_expressions() constant_literal_expressions()
union_maybe() union_maybe()
+8 -5
View File
@@ -684,6 +684,9 @@ void lb_debug_complete_types(lbModule *m) {
} }
element_count = cast(unsigned)(bt->Struct.fields.count + element_offset); element_count = cast(unsigned)(bt->Struct.fields.count + element_offset);
elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count); elements = gb_alloc_array(temporary_allocator(), LLVMMetadataRef, element_count);
isize field_size_bits = 8*type_size_of(bt) - element_offset*word_bits;
switch (bt->Struct.soa_kind) { switch (bt->Struct.soa_kind) {
case StructSoa_Slice: case StructSoa_Slice:
elements[0] = LLVMDIBuilderCreateMemberType( elements[0] = LLVMDIBuilderCreateMemberType(
@@ -691,7 +694,7 @@ void lb_debug_complete_types(lbModule *m) {
".len", 4, ".len", 4,
file, 0, file, 0,
8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int),
8*type_size_of(bt)-word_bits, field_size_bits,
LLVMDIFlagZero, lb_debug_type(m, t_int) LLVMDIFlagZero, lb_debug_type(m, t_int)
); );
break; break;
@@ -701,7 +704,7 @@ void lb_debug_complete_types(lbModule *m) {
".len", 4, ".len", 4,
file, 0, file, 0,
8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int),
8*type_size_of(bt)-word_bits + 0*word_bits, field_size_bits + 0*word_bits,
LLVMDIFlagZero, lb_debug_type(m, t_int) LLVMDIFlagZero, lb_debug_type(m, t_int)
); );
elements[1] = LLVMDIBuilderCreateMemberType( elements[1] = LLVMDIBuilderCreateMemberType(
@@ -709,15 +712,15 @@ void lb_debug_complete_types(lbModule *m) {
".cap", 4, ".cap", 4,
file, 0, file, 0,
8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int),
8*type_size_of(bt)-word_bits + 1*word_bits, field_size_bits + 1*word_bits,
LLVMDIFlagZero, lb_debug_type(m, t_int) LLVMDIFlagZero, lb_debug_type(m, t_int)
); );
elements[2] = LLVMDIBuilderCreateMemberType( elements[2] = LLVMDIBuilderCreateMemberType(
m->debug_builder, record_scope, m->debug_builder, record_scope,
".allocator", 12, ".allocator", 10,
file, 0, file, 0,
8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int), 8*cast(u64)type_size_of(t_int), 8*cast(u32)type_align_of(t_int),
8*type_size_of(bt)-word_bits + 2*word_bits, field_size_bits + 2*word_bits,
LLVMDIFlagZero, lb_debug_type(m, t_allocator) LLVMDIFlagZero, lb_debug_type(m, t_allocator)
); );
break; break;