| author | |
| committer | |
| log | 8e109aec6b9e508e46f3d016065ad4ada0a2fd36 |
| tree | 8f3e12d11e47b56e6765bbf5cec1789f020afdaa |
| parent | 3eca5a42e650878922437a854a352300052c878a |
| parent | 80cd142c96c421b50f26a7227066530a2a5d5978 |
| signature |
Small changes to debug info emitter4 files changed, 70 insertions(+), 36 deletions(-)
src/analyze.cpp+25-20| ... | @@ -6388,12 +6388,14 @@ static void resolve_llvm_types_slice(CodeGen *g, ZigType *type, ResolveStatus wa | ... | @@ -6388,12 +6388,14 @@ static void resolve_llvm_types_slice(CodeGen *g, ZigType *type, ResolveStatus wa |
| 6388 | len_debug_size_in_bits, | 6388 | len_debug_size_in_bits, |
| 6389 | len_debug_align_in_bits, | 6389 | len_debug_align_in_bits, |
| 6390 | len_offset_in_bits, | 6390 | len_offset_in_bits, |
| 6391 | 0, usize_llvm_di_type), | 6391 | ZigLLVM_DIFlags_Zero, |
| 6392 | usize_llvm_di_type), | ||
| 6392 | }; | 6393 | }; |
| 6393 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | 6394 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, |
| 6394 | compile_unit_scope, | 6395 | compile_unit_scope, |
| 6395 | buf_ptr(&type->name), | 6396 | buf_ptr(&type->name), |
| 6396 | di_file, line, debug_size_in_bits, debug_align_in_bits, 0, | 6397 | di_file, line, debug_size_in_bits, debug_align_in_bits, |
| 6398 | ZigLLVM_DIFlags_Zero, | ||
| 6397 | nullptr, di_element_types, 1, 0, nullptr, ""); | 6399 | nullptr, di_element_types, 1, 0, nullptr, ""); |
| 6398 | 6400 | ||
| 6399 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); | 6401 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); |
| ... | @@ -6425,18 +6427,19 @@ static void resolve_llvm_types_slice(CodeGen *g, ZigType *type, ResolveStatus wa | ... | @@ -6425,18 +6427,19 @@ static void resolve_llvm_types_slice(CodeGen *g, ZigType *type, ResolveStatus wa |
| 6425 | ptr_debug_size_in_bits, | 6427 | ptr_debug_size_in_bits, |
| 6426 | ptr_debug_align_in_bits, | 6428 | ptr_debug_align_in_bits, |
| 6427 | ptr_offset_in_bits, | 6429 | ptr_offset_in_bits, |
| 6428 | 0, get_llvm_di_type(g, ptr_type)), | 6430 | ZigLLVM_DIFlags_Zero, get_llvm_di_type(g, ptr_type)), |
| 6429 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type), | 6431 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type), |
| 6430 | "len", di_file, line, | 6432 | "len", di_file, line, |
| 6431 | len_debug_size_in_bits, | 6433 | len_debug_size_in_bits, |
| 6432 | len_debug_align_in_bits, | 6434 | len_debug_align_in_bits, |
| 6433 | len_offset_in_bits, | 6435 | len_offset_in_bits, |
| 6434 | 0, usize_llvm_di_type), | 6436 | ZigLLVM_DIFlags_Zero, usize_llvm_di_type), |
| 6435 | }; | 6437 | }; |
| 6436 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | 6438 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, |
| 6437 | compile_unit_scope, | 6439 | compile_unit_scope, |
| 6438 | buf_ptr(&type->name), | 6440 | buf_ptr(&type->name), |
| 6439 | di_file, line, debug_size_in_bits, debug_align_in_bits, 0, | 6441 | di_file, line, debug_size_in_bits, debug_align_in_bits, |
| 6442 | ZigLLVM_DIFlags_Zero, | ||
| 6440 | nullptr, di_element_types, 2, 0, nullptr, ""); | 6443 | nullptr, di_element_types, 2, 0, nullptr, ""); |
| 6441 | 6444 | ||
| 6442 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); | 6445 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); |
| ... | @@ -6597,7 +6600,7 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS | ... | @@ -6597,7 +6600,7 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS |
| 6597 | debug_size_in_bits, | 6600 | debug_size_in_bits, |
| 6598 | debug_align_in_bits, | 6601 | debug_align_in_bits, |
| 6599 | debug_offset_in_bits, | 6602 | debug_offset_in_bits, |
| 6600 | 0, field_di_type); | 6603 | ZigLLVM_DIFlags_Zero, field_di_type); |
| 6601 | assert(di_element_types[debug_field_index]); | 6604 | assert(di_element_types[debug_field_index]); |
| 6602 | debug_field_index += 1; | 6605 | debug_field_index += 1; |
| 6603 | } | 6606 | } |
| ... | @@ -6610,7 +6613,8 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS | ... | @@ -6610,7 +6613,8 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS |
| 6610 | di_file, line, | 6613 | di_file, line, |
| 6611 | debug_size_in_bits, | 6614 | debug_size_in_bits, |
| 6612 | debug_align_in_bits, | 6615 | debug_align_in_bits, |
| 6613 | 0, nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); | 6616 | ZigLLVM_DIFlags_Zero, |
| 6617 | nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); | ||
| 6614 | 6618 | ||
| 6615 | ZigLLVMReplaceTemporary(g->dbuilder, struct_type->llvm_di_type, replacement_di_type); | 6619 | ZigLLVMReplaceTemporary(g->dbuilder, struct_type->llvm_di_type, replacement_di_type); |
| 6616 | struct_type->llvm_di_type = replacement_di_type; | 6620 | struct_type->llvm_di_type = replacement_di_type; |
| ... | @@ -6639,7 +6643,8 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type) { | ... | @@ -6639,7 +6643,8 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type) { |
| 6639 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), | 6643 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), |
| 6640 | debug_size_in_bits, | 6644 | debug_size_in_bits, |
| 6641 | debug_align_in_bits, | 6645 | debug_align_in_bits, |
| 6642 | 0, nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); | 6646 | ZigLLVM_DIFlags_Zero, |
| 6647 | nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); | ||
| 6643 | return; | 6648 | return; |
| 6644 | } | 6649 | } |
| 6645 | 6650 | ||
| ... | @@ -6723,7 +6728,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta | ... | @@ -6723,7 +6728,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 6723 | store_size_in_bits, | 6728 | store_size_in_bits, |
| 6724 | abi_align_in_bits, | 6729 | abi_align_in_bits, |
| 6725 | 0, | 6730 | 0, |
| 6726 | 0, field_di_type); | 6731 | ZigLLVM_DIFlags_Zero, field_di_type); |
| 6727 | 6732 | ||
| 6728 | } | 6733 | } |
| 6729 | 6734 | ||
| ... | @@ -6752,7 +6757,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta | ... | @@ -6752,7 +6757,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 6752 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), | 6757 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), |
| 6753 | union_type->data.unionation.union_abi_size * 8, | 6758 | union_type->data.unionation.union_abi_size * 8, |
| 6754 | most_aligned_union_member->abi_align * 8, | 6759 | most_aligned_union_member->abi_align * 8, |
| 6755 | 0, union_inner_di_types, | 6760 | ZigLLVM_DIFlags_Zero, union_inner_di_types, |
| 6756 | gen_field_count, 0, ""); | 6761 | gen_field_count, 0, ""); |
| 6757 | 6762 | ||
| 6758 | ZigLLVMReplaceTemporary(g->dbuilder, union_type->llvm_di_type, replacement_di_type); | 6763 | ZigLLVMReplaceTemporary(g->dbuilder, union_type->llvm_di_type, replacement_di_type); |
| ... | @@ -6786,7 +6791,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta | ... | @@ -6786,7 +6791,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 6786 | ZigLLVMTypeToScope(union_type->llvm_di_type), "AnonUnion", | 6791 | ZigLLVMTypeToScope(union_type->llvm_di_type), "AnonUnion", |
| 6787 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), | 6792 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), |
| 6788 | most_aligned_union_member->size_in_bits, 8*most_aligned_union_member->abi_align, | 6793 | most_aligned_union_member->size_in_bits, 8*most_aligned_union_member->abi_align, |
| 6789 | 0, union_inner_di_types, gen_field_count, 0, ""); | 6794 | ZigLLVM_DIFlags_Zero, union_inner_di_types, gen_field_count, 0, ""); |
| 6790 | 6795 | ||
| 6791 | uint64_t union_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, union_type->llvm_type, | 6796 | uint64_t union_offset_in_bits = 8*LLVMOffsetOfElement(g->target_data_ref, union_type->llvm_type, |
| 6792 | union_type->data.unionation.gen_union_index); | 6797 | union_type->data.unionation.gen_union_index); |
| ... | @@ -6799,7 +6804,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta | ... | @@ -6799,7 +6804,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 6799 | most_aligned_union_member->size_in_bits, | 6804 | most_aligned_union_member->size_in_bits, |
| 6800 | 8*most_aligned_union_member->abi_align, | 6805 | 8*most_aligned_union_member->abi_align, |
| 6801 | union_offset_in_bits, | 6806 | union_offset_in_bits, |
| 6802 | 0, union_di_type); | 6807 | ZigLLVM_DIFlags_Zero, union_di_type); |
| 6803 | 6808 | ||
| 6804 | uint64_t tag_debug_size_in_bits = tag_type->size_in_bits; | 6809 | uint64_t tag_debug_size_in_bits = tag_type->size_in_bits; |
| 6805 | uint64_t tag_debug_align_in_bits = 8*tag_type->abi_align; | 6810 | uint64_t tag_debug_align_in_bits = 8*tag_type->abi_align; |
| ... | @@ -6810,7 +6815,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta | ... | @@ -6810,7 +6815,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 6810 | tag_debug_size_in_bits, | 6815 | tag_debug_size_in_bits, |
| 6811 | tag_debug_align_in_bits, | 6816 | tag_debug_align_in_bits, |
| 6812 | tag_offset_in_bits, | 6817 | tag_offset_in_bits, |
| 6813 | 0, get_llvm_di_type(g, tag_type)); | 6818 | ZigLLVM_DIFlags_Zero, get_llvm_di_type(g, tag_type)); |
| 6814 | 6819 | ||
| 6815 | ZigLLVMDIType *di_root_members[2]; | 6820 | ZigLLVMDIType *di_root_members[2]; |
| 6816 | di_root_members[union_type->data.unionation.gen_tag_index] = tag_member_di_type; | 6821 | di_root_members[union_type->data.unionation.gen_tag_index] = tag_member_di_type; |
| ... | @@ -6824,7 +6829,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta | ... | @@ -6824,7 +6829,7 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 6824 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), | 6829 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), |
| 6825 | debug_size_in_bits, | 6830 | debug_size_in_bits, |
| 6826 | debug_align_in_bits, | 6831 | debug_align_in_bits, |
| 6827 | 0, nullptr, di_root_members, 2, 0, nullptr, ""); | 6832 | ZigLLVM_DIFlags_Zero, nullptr, di_root_members, 2, 0, nullptr, ""); |
| 6828 | 6833 | ||
| 6829 | ZigLLVMReplaceTemporary(g->dbuilder, union_type->llvm_di_type, replacement_di_type); | 6834 | ZigLLVMReplaceTemporary(g->dbuilder, union_type->llvm_di_type, replacement_di_type); |
| 6830 | union_type->llvm_di_type = replacement_di_type; | 6835 | union_type->llvm_di_type = replacement_di_type; |
| ... | @@ -6952,18 +6957,18 @@ static void resolve_llvm_types_optional(CodeGen *g, ZigType *type) { | ... | @@ -6952,18 +6957,18 @@ static void resolve_llvm_types_optional(CodeGen *g, ZigType *type) { |
| 6952 | val_debug_size_in_bits, | 6957 | val_debug_size_in_bits, |
| 6953 | val_debug_align_in_bits, | 6958 | val_debug_align_in_bits, |
| 6954 | val_offset_in_bits, | 6959 | val_offset_in_bits, |
| 6955 | 0, child_llvm_di_type), | 6960 | ZigLLVM_DIFlags_Zero, child_llvm_di_type), |
| 6956 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type), | 6961 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type), |
| 6957 | "maybe", di_file, line, | 6962 | "maybe", di_file, line, |
| 6958 | maybe_debug_size_in_bits, | 6963 | maybe_debug_size_in_bits, |
| 6959 | maybe_debug_align_in_bits, | 6964 | maybe_debug_align_in_bits, |
| 6960 | maybe_offset_in_bits, | 6965 | maybe_offset_in_bits, |
| 6961 | 0, bool_llvm_di_type), | 6966 | ZigLLVM_DIFlags_Zero, bool_llvm_di_type), |
| 6962 | }; | 6967 | }; |
| 6963 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | 6968 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, |
| 6964 | compile_unit_scope, | 6969 | compile_unit_scope, |
| 6965 | buf_ptr(&type->name), | 6970 | buf_ptr(&type->name), |
| 6966 | di_file, line, debug_size_in_bits, debug_align_in_bits, 0, | 6971 | di_file, line, debug_size_in_bits, debug_align_in_bits, ZigLLVM_DIFlags_Zero, |
| 6967 | nullptr, di_element_types, 2, 0, nullptr, ""); | 6972 | nullptr, di_element_types, 2, 0, nullptr, ""); |
| 6968 | 6973 | ||
| 6969 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); | 6974 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); |
| ... | @@ -7016,13 +7021,13 @@ static void resolve_llvm_types_error_union(CodeGen *g, ZigType *type) { | ... | @@ -7016,13 +7021,13 @@ static void resolve_llvm_types_error_union(CodeGen *g, ZigType *type) { |
| 7016 | tag_debug_size_in_bits, | 7021 | tag_debug_size_in_bits, |
| 7017 | tag_debug_align_in_bits, | 7022 | tag_debug_align_in_bits, |
| 7018 | tag_offset_in_bits, | 7023 | tag_offset_in_bits, |
| 7019 | 0, get_llvm_di_type(g, err_set_type)), | 7024 | ZigLLVM_DIFlags_Zero, get_llvm_di_type(g, err_set_type)), |
| 7020 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type), | 7025 | ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type), |
| 7021 | "value", di_file, line, | 7026 | "value", di_file, line, |
| 7022 | value_debug_size_in_bits, | 7027 | value_debug_size_in_bits, |
| 7023 | value_debug_align_in_bits, | 7028 | value_debug_align_in_bits, |
| 7024 | value_offset_in_bits, | 7029 | value_offset_in_bits, |
| 7025 | 0, get_llvm_di_type(g, payload_type)), | 7030 | ZigLLVM_DIFlags_Zero, get_llvm_di_type(g, payload_type)), |
| 7026 | }; | 7031 | }; |
| 7027 | 7032 | ||
| 7028 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, | 7033 | ZigLLVMDIType *replacement_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, |
| ... | @@ -7031,7 +7036,7 @@ static void resolve_llvm_types_error_union(CodeGen *g, ZigType *type) { | ... | @@ -7031,7 +7036,7 @@ static void resolve_llvm_types_error_union(CodeGen *g, ZigType *type) { |
| 7031 | di_file, line, | 7036 | di_file, line, |
| 7032 | debug_size_in_bits, | 7037 | debug_size_in_bits, |
| 7033 | debug_align_in_bits, | 7038 | debug_align_in_bits, |
| 7034 | 0, | 7039 | ZigLLVM_DIFlags_Zero, |
| 7035 | nullptr, di_element_types, 2, 0, nullptr, ""); | 7040 | nullptr, di_element_types, 2, 0, nullptr, ""); |
| 7036 | 7041 | ||
| 7037 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); | 7042 | ZigLLVMReplaceTemporary(g->dbuilder, type->llvm_di_type, replacement_di_type); |
src/codegen.cpp+2-2| ... | @@ -674,7 +674,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { | ... | @@ -674,7 +674,7 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { |
| 674 | bool is_optimized = g->build_mode != BuildModeDebug; | 674 | bool is_optimized = g->build_mode != BuildModeDebug; |
| 675 | bool is_internal_linkage = (fn_table_entry->body_node != nullptr && | 675 | bool is_internal_linkage = (fn_table_entry->body_node != nullptr && |
| 676 | fn_table_entry->export_list.length == 0); | 676 | fn_table_entry->export_list.length == 0); |
| 677 | unsigned flags = 0; | 677 | unsigned flags = ZigLLVM_DIFlags_StaticMember; |
| 678 | ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent); | 678 | ZigLLVMDIScope *fn_di_scope = get_di_scope(g, scope->parent); |
| 679 | assert(fn_di_scope != nullptr); | 679 | assert(fn_di_scope != nullptr); |
| 680 | ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder, | 680 | ZigLLVMDISubprogram *subprogram = ZigLLVMCreateFunction(g->dbuilder, |
| ... | @@ -7243,7 +7243,7 @@ static void define_builtin_types(CodeGen *g) { | ... | @@ -7243,7 +7243,7 @@ static void define_builtin_types(CodeGen *g) { |
| 7243 | buf_init_from_str(&entry->name, "void"); | 7243 | buf_init_from_str(&entry->name, "void"); |
| 7244 | entry->llvm_di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), | 7244 | entry->llvm_di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&entry->name), |
| 7245 | 0, | 7245 | 0, |
| 7246 | ZigLLVMEncoding_DW_ATE_unsigned()); | 7246 | ZigLLVMEncoding_DW_ATE_signed()); |
| 7247 | g->builtin_types.entry_void = entry; | 7247 | g->builtin_types.entry_void = entry; |
| 7248 | g->primitive_type_table.put(&entry->name, entry); | 7248 | g->primitive_type_table.put(&entry->name, entry); |
| 7249 | } | 7249 | } |
src/zig_llvm.cpp+10-14| ... | @@ -318,12 +318,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugMemberType(ZigLLVMDIBuilder *dibuilder, ZigLLVM | ... | @@ -318,12 +318,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugMemberType(ZigLLVMDIBuilder *dibuilder, ZigLLVM |
| 318 | const char *name, ZigLLVMDIFile *file, unsigned line, uint64_t size_in_bits, | 318 | const char *name, ZigLLVMDIFile *file, unsigned line, uint64_t size_in_bits, |
| 319 | uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, ZigLLVMDIType *type) | 319 | uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, ZigLLVMDIType *type) |
| 320 | { | 320 | { |
| 321 | assert(flags == 0); | ||
| 322 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createMemberType( | 321 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createMemberType( |
| 323 | reinterpret_cast<DIScope*>(scope), | 322 | reinterpret_cast<DIScope*>(scope), |
| 324 | name, | 323 | name, |
| 325 | reinterpret_cast<DIFile*>(file), | 324 | reinterpret_cast<DIFile*>(file), |
| 326 | line, size_in_bits, align_in_bits, offset_in_bits, DINode::FlagZero, | 325 | line, size_in_bits, align_in_bits, offset_in_bits, |
| 326 | static_cast<DINode::DIFlags>(flags), | ||
| 327 | reinterpret_cast<DIType*>(type)); | 327 | reinterpret_cast<DIType*>(type)); |
| 328 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | 328 | return reinterpret_cast<ZigLLVMDIType*>(di_type); |
| 329 | } | 329 | } |
| ... | @@ -338,12 +338,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugUnionType(ZigLLVMDIBuilder *dibuilder, ZigLLVMD | ... | @@ -338,12 +338,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugUnionType(ZigLLVMDIBuilder *dibuilder, ZigLLVMD |
| 338 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); | 338 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); |
| 339 | fields.push_back(ditype); | 339 | fields.push_back(ditype); |
| 340 | } | 340 | } |
| 341 | assert(flags == 0); | ||
| 342 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createUnionType( | 341 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createUnionType( |
| 343 | reinterpret_cast<DIScope*>(scope), | 342 | reinterpret_cast<DIScope*>(scope), |
| 344 | name, | 343 | name, |
| 345 | reinterpret_cast<DIFile*>(file), | 344 | reinterpret_cast<DIFile*>(file), |
| 346 | line_number, size_in_bits, align_in_bits, DINode::FlagZero, | 345 | line_number, size_in_bits, align_in_bits, |
| 346 | static_cast<DINode::DIFlags>(flags), | ||
| 347 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), | 347 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), |
| 348 | run_time_lang, unique_id); | 348 | run_time_lang, unique_id); |
| 349 | return reinterpret_cast<ZigLLVMDIType*>(di_type); | 349 | return reinterpret_cast<ZigLLVMDIType*>(di_type); |
| ... | @@ -360,12 +360,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugStructType(ZigLLVMDIBuilder *dibuilder, ZigLLVM | ... | @@ -360,12 +360,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugStructType(ZigLLVMDIBuilder *dibuilder, ZigLLVM |
| 360 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); | 360 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); |
| 361 | fields.push_back(ditype); | 361 | fields.push_back(ditype); |
| 362 | } | 362 | } |
| 363 | assert(flags == 0); | ||
| 364 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createStructType( | 363 | DIType *di_type = reinterpret_cast<DIBuilder*>(dibuilder)->createStructType( |
| 365 | reinterpret_cast<DIScope*>(scope), | 364 | reinterpret_cast<DIScope*>(scope), |
| 366 | name, | 365 | name, |
| 367 | reinterpret_cast<DIFile*>(file), | 366 | reinterpret_cast<DIFile*>(file), |
| 368 | line_number, size_in_bits, align_in_bits, DINode::FlagZero, | 367 | line_number, size_in_bits, align_in_bits, |
| 368 | static_cast<DINode::DIFlags>(flags), | ||
| 369 | reinterpret_cast<DIType*>(derived_from), | 369 | reinterpret_cast<DIType*>(derived_from), |
| 370 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), | 370 | reinterpret_cast<DIBuilder*>(dibuilder)->getOrCreateArray(fields), |
| 371 | run_time_lang, | 371 | run_time_lang, |
| ... | @@ -426,11 +426,10 @@ ZigLLVMDIType *ZigLLVMCreateSubroutineType(ZigLLVMDIBuilder *dibuilder_wrapped, | ... | @@ -426,11 +426,10 @@ ZigLLVMDIType *ZigLLVMCreateSubroutineType(ZigLLVMDIBuilder *dibuilder_wrapped, |
| 426 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); | 426 | DIType *ditype = reinterpret_cast<DIType*>(types_array[i]); |
| 427 | types.push_back(ditype); | 427 | types.push_back(ditype); |
| 428 | } | 428 | } |
| 429 | assert(flags == 0); | ||
| 430 | DIBuilder *dibuilder = reinterpret_cast<DIBuilder*>(dibuilder_wrapped); | 429 | DIBuilder *dibuilder = reinterpret_cast<DIBuilder*>(dibuilder_wrapped); |
| 431 | DISubroutineType *subroutine_type = dibuilder->createSubroutineType( | 430 | DISubroutineType *subroutine_type = dibuilder->createSubroutineType( |
| 432 | dibuilder->getOrCreateTypeArray(types), | 431 | dibuilder->getOrCreateTypeArray(types), |
| 433 | DINode::FlagZero); | 432 | static_cast<DINode::DIFlags>(flags)); |
| 434 | DIType *ditype = subroutine_type; | 433 | DIType *ditype = subroutine_type; |
| 435 | return reinterpret_cast<ZigLLVMDIType*>(ditype); | 434 | return reinterpret_cast<ZigLLVMDIType*>(ditype); |
| 436 | } | 435 | } |
| ... | @@ -516,7 +515,6 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, | ... | @@ -516,7 +515,6 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, |
| 516 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | 515 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, |
| 517 | ZigLLVMDIType *type, bool always_preserve, unsigned flags) | 516 | ZigLLVMDIType *type, bool always_preserve, unsigned flags) |
| 518 | { | 517 | { |
| 519 | assert(flags == 0); | ||
| 520 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createAutoVariable( | 518 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createAutoVariable( |
| 521 | reinterpret_cast<DIScope*>(scope), | 519 | reinterpret_cast<DIScope*>(scope), |
| 522 | name, | 520 | name, |
| ... | @@ -524,7 +522,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, | ... | @@ -524,7 +522,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, |
| 524 | line_no, | 522 | line_no, |
| 525 | reinterpret_cast<DIType*>(type), | 523 | reinterpret_cast<DIType*>(type), |
| 526 | always_preserve, | 524 | always_preserve, |
| 527 | DINode::FlagZero); | 525 | static_cast<DINode::DIFlags>(flags)); |
| 528 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); | 526 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); |
| 529 | } | 527 | } |
| 530 | 528 | ||
| ... | @@ -547,7 +545,6 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde | ... | @@ -547,7 +545,6 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde |
| 547 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, | 545 | ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, |
| 548 | ZigLLVMDIType *type, bool always_preserve, unsigned flags, unsigned arg_no) | 546 | ZigLLVMDIType *type, bool always_preserve, unsigned flags, unsigned arg_no) |
| 549 | { | 547 | { |
| 550 | assert(flags == 0); | ||
| 551 | assert(arg_no != 0); | 548 | assert(arg_no != 0); |
| 552 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createParameterVariable( | 549 | DILocalVariable *result = reinterpret_cast<DIBuilder*>(dbuilder)->createParameterVariable( |
| 553 | reinterpret_cast<DIScope*>(scope), | 550 | reinterpret_cast<DIScope*>(scope), |
| ... | @@ -557,7 +554,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde | ... | @@ -557,7 +554,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde |
| 557 | line_no, | 554 | line_no, |
| 558 | reinterpret_cast<DIType*>(type), | 555 | reinterpret_cast<DIType*>(type), |
| 559 | always_preserve, | 556 | always_preserve, |
| 560 | DINode::FlagZero); | 557 | static_cast<DINode::DIFlags>(flags)); |
| 561 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); | 558 | return reinterpret_cast<ZigLLVMDILocalVariable*>(result); |
| 562 | } | 559 | } |
| 563 | 560 | ||
| ... | @@ -612,7 +609,6 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD | ... | @@ -612,7 +609,6 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD |
| 612 | unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram) | 609 | unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram) |
| 613 | { | 610 | { |
| 614 | DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type)); | 611 | DISubroutineType *di_sub_type = static_cast<DISubroutineType*>(reinterpret_cast<DIType*>(fn_di_type)); |
| 615 | assert(flags == 0); | ||
| 616 | DISubprogram *result = reinterpret_cast<DIBuilder*>(dibuilder)->createFunction( | 612 | DISubprogram *result = reinterpret_cast<DIBuilder*>(dibuilder)->createFunction( |
| 617 | reinterpret_cast<DIScope*>(scope), | 613 | reinterpret_cast<DIScope*>(scope), |
| 618 | name, linkage_name, | 614 | name, linkage_name, |
| ... | @@ -620,7 +616,7 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD | ... | @@ -620,7 +616,7 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD |
| 620 | lineno, | 616 | lineno, |
| 621 | di_sub_type, | 617 | di_sub_type, |
| 622 | scope_line, | 618 | scope_line, |
| 623 | DINode::FlagStaticMember, | 619 | static_cast<DINode::DIFlags>(flags), |
| 624 | DISubprogram::toSPFlags(is_local_to_unit, is_definition, is_optimized), | 620 | DISubprogram::toSPFlags(is_local_to_unit, is_definition, is_optimized), |
| 625 | nullptr, | 621 | nullptr, |
| 626 | reinterpret_cast<DISubprogram *>(decl_subprogram), | 622 | reinterpret_cast<DISubprogram *>(decl_subprogram), |
src/zig_llvm.h+33| ... | @@ -406,6 +406,39 @@ enum ZigLLVM_ObjectFormatType { | ... | @@ -406,6 +406,39 @@ enum ZigLLVM_ObjectFormatType { |
| 406 | ZigLLVM_Wasm, | 406 | ZigLLVM_Wasm, |
| 407 | }; | 407 | }; |
| 408 | 408 | ||
| 409 | #define ZigLLVM_DIFlags_Zero 0U | ||
| 410 | #define ZigLLVM_DIFlags_Private 1U | ||
| 411 | #define ZigLLVM_DIFlags_Protected 2U | ||
| 412 | #define ZigLLVM_DIFlags_Public 3U | ||
| 413 | #define ZigLLVM_DIFlags_FwdDecl (1U << 2) | ||
| 414 | #define ZigLLVM_DIFlags_AppleBlock (1U << 3) | ||
| 415 | #define ZigLLVM_DIFlags_BlockByrefStruct (1U << 4) | ||
| 416 | #define ZigLLVM_DIFlags_Virtual (1U << 5) | ||
| 417 | #define ZigLLVM_DIFlags_Artificial (1U << 6) | ||
| 418 | #define ZigLLVM_DIFlags_Explicit (1U << 7) | ||
| 419 | #define ZigLLVM_DIFlags_Prototyped (1U << 8) | ||
| 420 | #define ZigLLVM_DIFlags_ObjcClassComplete (1U << 9) | ||
| 421 | #define ZigLLVM_DIFlags_ObjectPointer (1U << 10) | ||
| 422 | #define ZigLLVM_DIFlags_Vector (1U << 11) | ||
| 423 | #define ZigLLVM_DIFlags_StaticMember (1U << 12) | ||
| 424 | #define ZigLLVM_DIFlags_LValueReference (1U << 13) | ||
| 425 | #define ZigLLVM_DIFlags_RValueReference (1U << 14) | ||
| 426 | #define ZigLLVM_DIFlags_Reserved (1U << 15) | ||
| 427 | #define ZigLLVM_DIFlags_SingleInheritance (1U << 16) | ||
| 428 | #define ZigLLVM_DIFlags_MultipleInheritance (2 << 16) | ||
| 429 | #define ZigLLVM_DIFlags_VirtualInheritance (3 << 16) | ||
| 430 | #define ZigLLVM_DIFlags_IntroducedVirtual (1U << 18) | ||
| 431 | #define ZigLLVM_DIFlags_BitField (1U << 19) | ||
| 432 | #define ZigLLVM_DIFlags_NoReturn (1U << 20) | ||
| 433 | #define ZigLLVM_DIFlags_TypePassByValue (1U << 22) | ||
| 434 | #define ZigLLVM_DIFlags_TypePassByReference (1U << 23) | ||
| 435 | #define ZigLLVM_DIFlags_EnumClass (1U << 24) | ||
| 436 | #define ZigLLVM_DIFlags_Thunk (1U << 25) | ||
| 437 | #define ZigLLVM_DIFlags_NonTrivial (1U << 26) | ||
| 438 | #define ZigLLVM_DIFlags_BigEndian (1U << 27) | ||
| 439 | #define ZigLLVM_DIFlags_LittleEndian (1U << 28) | ||
| 440 | #define ZigLLVM_DIFlags_AllCallsDescribed (1U << 29) | ||
| 441 | |||
| 409 | ZIG_EXTERN_C const char *ZigLLVMGetArchTypeName(enum ZigLLVM_ArchType arch); | 442 | ZIG_EXTERN_C const char *ZigLLVMGetArchTypeName(enum ZigLLVM_ArchType arch); |
| 410 | ZIG_EXTERN_C const char *ZigLLVMGetSubArchTypeName(enum ZigLLVM_SubArchType sub_arch); | 443 | ZIG_EXTERN_C const char *ZigLLVMGetSubArchTypeName(enum ZigLLVM_SubArchType sub_arch); |
| 411 | ZIG_EXTERN_C const char *ZigLLVMGetVendorTypeName(enum ZigLLVM_VendorType vendor); | 444 | ZIG_EXTERN_C const char *ZigLLVMGetVendorTypeName(enum ZigLLVM_VendorType vendor); |