| ... | ... | @@ -7864,6 +7864,26 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS |
| 7864 | 7864 | } |
| 7865 | 7865 | } |
| 7866 | 7866 | |
| 7867 | // This is to be used instead of void for debug info types, to avoid tripping |
| 7868 | // Assertion `!isa<DIType>(Scope) && "shouldn't make a namespace scope for a type"' |
| 7869 | // when targeting CodeView (Windows). |
| 7870 | static ZigLLVMDIType *make_empty_namespace_llvm_di_type(CodeGen *g, ZigType *import, const char *name, |
| 7871 | AstNode *decl_node) |
| 7872 | { |
| 7873 | uint64_t debug_size_in_bits = 0; |
| 7874 | uint64_t debug_align_in_bits = 0; |
| 7875 | ZigLLVMDIType **di_element_types = nullptr; |
| 7876 | size_t debug_field_count = 0; |
| 7877 | return ZigLLVMCreateDebugStructType(g->dbuilder, |
| 7878 | ZigLLVMFileToScope(import->data.structure.root_struct->di_file), |
| 7879 | name, |
| 7880 | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), |
| 7881 | debug_size_in_bits, |
| 7882 | debug_align_in_bits, |
| 7883 | ZigLLVM_DIFlags_Zero, |
| 7884 | nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); |
| 7885 | } |
| 7886 | |
| 7867 | 7887 | static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type, ResolveStatus wanted_resolve_status) { |
| 7868 | 7888 | assert(enum_type->data.enumeration.resolve_status >= ResolveStatusSizeKnown); |
| 7869 | 7889 | if (enum_type->data.enumeration.resolve_status >= wanted_resolve_status) return; |
| ... | ... | @@ -7874,19 +7894,8 @@ static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type, ResolveStatu |
| 7874 | 7894 | |
| 7875 | 7895 | if (!type_has_bits(enum_type)) { |
| 7876 | 7896 | enum_type->llvm_type = g->builtin_types.entry_void->llvm_type; |
| 7877 | | |
| 7878 | | uint64_t debug_size_in_bits = 0; |
| 7879 | | uint64_t debug_align_in_bits = 0; |
| 7880 | | ZigLLVMDIType **di_element_types = nullptr; |
| 7881 | | size_t debug_field_count = 0; |
| 7882 | | enum_type->llvm_di_type = ZigLLVMCreateDebugStructType(g->dbuilder, |
| 7883 | | ZigLLVMFileToScope(import->data.structure.root_struct->di_file), |
| 7884 | | buf_ptr(&enum_type->name), |
| 7885 | | import->data.structure.root_struct->di_file, (unsigned)(decl_node->line + 1), |
| 7886 | | debug_size_in_bits, |
| 7887 | | debug_align_in_bits, |
| 7888 | | ZigLLVM_DIFlags_Zero, |
| 7889 | | nullptr, di_element_types, (int)debug_field_count, 0, nullptr, ""); |
| 7897 | enum_type->llvm_di_type = make_empty_namespace_llvm_di_type(g, import, buf_ptr(&enum_type->name), |
| 7898 | decl_node); |
| 7890 | 7899 | enum_type->data.enumeration.resolve_status = ResolveStatusLLVMFull; |
| 7891 | 7900 | return; |
| 7892 | 7901 | } |
| ... | ... | @@ -7927,6 +7936,8 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7927 | 7936 | if (union_type->data.unionation.resolve_status >= wanted_resolve_status) return; |
| 7928 | 7937 | |
| 7929 | 7938 | bool packed = (union_type->data.unionation.layout == ContainerLayoutPacked); |
| 7939 | Scope *scope = &union_type->data.unionation.decls_scope->base; |
| 7940 | ZigType *import = get_scope_import(scope); |
| 7930 | 7941 | |
| 7931 | 7942 | TypeUnionField *most_aligned_union_member = union_type->data.unionation.most_aligned_union_member; |
| 7932 | 7943 | ZigType *tag_type = union_type->data.unionation.tag_type; |
| ... | ... | @@ -7934,7 +7945,8 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7934 | 7945 | if (gen_field_count == 0) { |
| 7935 | 7946 | if (tag_type == nullptr) { |
| 7936 | 7947 | union_type->llvm_type = g->builtin_types.entry_void->llvm_type; |
| 7937 | | union_type->llvm_di_type = g->builtin_types.entry_void->llvm_di_type; |
| 7948 | union_type->llvm_di_type = make_empty_namespace_llvm_di_type(g, import, buf_ptr(&union_type->name), |
| 7949 | union_type->data.unionation.decl_node); |
| 7938 | 7950 | } else { |
| 7939 | 7951 | union_type->llvm_type = get_llvm_type(g, tag_type); |
| 7940 | 7952 | union_type->llvm_di_type = get_llvm_di_type(g, tag_type); |
| ... | ... | @@ -7943,8 +7955,6 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta |
| 7943 | 7955 | return; |
| 7944 | 7956 | } |
| 7945 | 7957 | |
| 7946 | | Scope *scope = &union_type->data.unionation.decls_scope->base; |
| 7947 | | ZigType *import = get_scope_import(scope); |
| 7948 | 7958 | AstNode *decl_node = union_type->data.unionation.decl_node; |
| 7949 | 7959 | |
| 7950 | 7960 | if (union_type->data.unionation.resolve_status < ResolveStatusLLVMFwdDecl) { |