diff options
| author | Alexandros Naskos <alex_naskos@hotmail.com> | 2018-06-14 17:57:28 +0300 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-06-14 10:57:28 -0400 |
| commit | 4ec09ac243afa0b784669e618ec09e9e444a0275 (patch) | |
| tree | a42c343a2b0d5b884f3ac377ba392a8cd9f99c7f /src | |
| parent | fc87f6e417d206a88b581b77d3a5494ae4c978dd (diff) | |
| download | zig-4ec09ac243afa0b784669e618ec09e9e444a0275.tar.gz zig-4ec09ac243afa0b784669e618ec09e9e444a0275.zip | |
Enabled optional types of zero bit types with no LLVM DI type. (#1110)
* Zero bit optional types do not need a LLVM DI type
Diffstat (limited to 'src')
| -rw-r--r-- | src/analyze.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 0aa5ea5dcb..cbeac7bc21 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -522,7 +522,6 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) { TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdOptional); assert(child_type->type_ref || child_type->zero_bits); - assert(child_type->di_type); entry->is_copyable = type_is_copyable(g, child_type); buf_resize(&entry->name, 0); @@ -532,12 +531,14 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) { entry->type_ref = LLVMInt1Type(); entry->di_type = g->builtin_types.entry_bool->di_type; } else if (type_is_codegen_pointer(child_type)) { + assert(child_type->di_type); // this is an optimization but also is necessary for calling C // functions where all pointers are maybe pointers // function types are technically pointers entry->type_ref = child_type->type_ref; entry->di_type = child_type->di_type; } else { + assert(child_type->di_type); // create a struct with a boolean whether this is the null value LLVMTypeRef elem_types[] = { child_type->type_ref, |
