aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2019-09-04 15:55:54 +0200
committerRobin Voetter <robin@voetter.nl>2019-09-04 15:55:54 +0200
commit5308eb7045b7b6a48356c6e814baf2a45a094d80 (patch)
tree88b2bd51d15a72b1aa27c51fdc54a2c51d8c827a /src/analyze.cpp
parentd62f7c6b605a672f032aff8870496d2ae2366017 (diff)
parent77a5f888be664f9ef09e2c93f52338448e992e00 (diff)
downloadzig-5308eb7045b7b6a48356c6e814baf2a45a094d80.tar.gz
zig-5308eb7045b7b6a48356c6e814baf2a45a094d80.zip
Merge remote-tracking branch 'upstream/master' into arm-support-improvement
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp
index 9b361baa56..e1d6b59ddf 100644
--- a/src/analyze.cpp
+++ b/src/analyze.cpp
@@ -2671,6 +2671,10 @@ static Error resolve_struct_alignment(CodeGen *g, ZigType *struct_type) {
}
}
+ if (!type_has_bits(struct_type)) {
+ assert(struct_type->abi_align == 0);
+ }
+
struct_type->data.structure.resolve_loop_flag_other = false;
if (struct_type->data.structure.resolve_status == ResolveStatusInvalid) {
@@ -4191,7 +4195,7 @@ bool fn_is_async(ZigFn *fn) {
return fn->inferred_async_node != inferred_async_none;
}
-static void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) {
+void add_async_error_notes(CodeGen *g, ErrorMsg *msg, ZigFn *fn) {
assert(fn->inferred_async_node != nullptr);
assert(fn->inferred_async_node != inferred_async_checking);
assert(fn->inferred_async_node != inferred_async_none);
@@ -7687,8 +7691,13 @@ static void resolve_llvm_types_union(CodeGen *g, ZigType *union_type, ResolveSta
ZigType *tag_type = union_type->data.unionation.tag_type;
uint32_t gen_field_count = union_type->data.unionation.gen_field_count;
if (gen_field_count == 0) {
- union_type->llvm_type = get_llvm_type(g, tag_type);
- union_type->llvm_di_type = get_llvm_di_type(g, tag_type);
+ if (tag_type == nullptr) {
+ union_type->llvm_type = g->builtin_types.entry_void->llvm_type;
+ union_type->llvm_di_type = g->builtin_types.entry_void->llvm_di_type;
+ } else {
+ union_type->llvm_type = get_llvm_type(g, tag_type);
+ union_type->llvm_di_type = get_llvm_di_type(g, tag_type);
+ }
union_type->data.unionation.resolve_status = ResolveStatusLLVMFull;
return;
}