aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-08-29 10:24:24 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-08-29 10:24:24 -0400
commitf7f86927304073a0e95a2932a77c8d4193099a29 (patch)
treee821861f21dac397ab4c51dfc935f867ec369783 /src/analyze.cpp
parent928ce5e326ccd1b7456002c28f34975b5bc4b13f (diff)
downloadzig-f7f86927304073a0e95a2932a77c8d4193099a29.tar.gz
zig-f7f86927304073a0e95a2932a77c8d4193099a29.zip
fix not fully resolving debug info for structs causing llvm error
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 9ae7e99547..2c934bcf69 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -7271,7 +7271,13 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS
di_scope, di_file, line);
struct_type->data.structure.resolve_status = ResolveStatusLLVMFwdDecl;
- if (ResolveStatusLLVMFwdDecl >= wanted_resolve_status) return;
+ if (ResolveStatusLLVMFwdDecl >= wanted_resolve_status) {
+ struct_type->data.structure.llvm_full_type_queue_index = g->type_resolve_stack.length;
+ g->type_resolve_stack.append(struct_type);
+ return;
+ } else {
+ struct_type->data.structure.llvm_full_type_queue_index = SIZE_MAX;
+ }
}
size_t field_count = struct_type->data.structure.src_field_count;
@@ -7475,6 +7481,13 @@ static void resolve_llvm_types_struct(CodeGen *g, ZigType *struct_type, ResolveS
ZigLLVMReplaceTemporary(g->dbuilder, struct_type->llvm_di_type, replacement_di_type);
struct_type->llvm_di_type = replacement_di_type;
struct_type->data.structure.resolve_status = ResolveStatusLLVMFull;
+ if (struct_type->data.structure.llvm_full_type_queue_index != SIZE_MAX) {
+ ZigType *last = g->type_resolve_stack.last();
+ assert(last->id == ZigTypeIdStruct);
+ last->data.structure.llvm_full_type_queue_index = struct_type->data.structure.llvm_full_type_queue_index;
+ g->type_resolve_stack.swap_remove(struct_type->data.structure.llvm_full_type_queue_index);
+ struct_type->data.structure.llvm_full_type_queue_index = SIZE_MAX;
+ }
}
static void resolve_llvm_types_enum(CodeGen *g, ZigType *enum_type, ResolveStatus wanted_resolve_status) {