diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-01-13 17:33:19 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-01-13 17:33:19 -0500 |
| commit | 0c1800a9c9507dd1b06c70cb8950b13afe09f758 (patch) | |
| tree | ad3f30397b6d83be6b8eb7ad6d62bab2e626f1dd /src/analyze.cpp | |
| parent | 83f1a6fae24b9fa74ced6f8022f38be08d27a0c0 (diff) | |
| download | zig-0c1800a9c9507dd1b06c70cb8950b13afe09f758.tar.gz zig-0c1800a9c9507dd1b06c70cb8950b13afe09f758.zip | |
fix some stuff when llvm has assertions on
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 58e6ec5498..b8fa326ca0 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1082,7 +1082,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c return get_fn_type(g, &fn_type_id); } -static bool type_is_invalid(TypeTableEntry *type_entry) { +bool type_is_invalid(TypeTableEntry *type_entry) { switch (type_entry->id) { case TypeTableEntryIdInvalid: return true; @@ -1118,6 +1118,9 @@ static void resolve_enum_type(CodeGen *g, TypeTableEntry *enum_type) { // if you change this logic you likely must also change similar logic in parseh.cpp assert(enum_type->id == TypeTableEntryIdEnum); + if (enum_type->data.enumeration.complete) + return; + resolve_enum_zero_bits(g, enum_type); if (enum_type->data.enumeration.is_invalid) return; @@ -1298,6 +1301,9 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { // parseh.cpp assert(struct_type->id == TypeTableEntryIdStruct); + if (struct_type->data.structure.complete) + return; + resolve_struct_zero_bits(g, struct_type); if (struct_type->data.structure.is_invalid) return; @@ -2045,45 +2051,6 @@ void resolve_top_level_decl(CodeGen *g, Tld *tld, bool pointer_only) { tld->dep_loop_flag = false; } -static bool type_has_codegen_value(TypeTableEntry *type_entry) { - switch (type_entry->id) { - case TypeTableEntryIdInvalid: - case TypeTableEntryIdMetaType: - case TypeTableEntryIdVoid: - case TypeTableEntryIdUnreachable: - case TypeTableEntryIdNumLitFloat: - case TypeTableEntryIdNumLitInt: - case TypeTableEntryIdUndefLit: - case TypeTableEntryIdNullLit: - case TypeTableEntryIdNamespace: - case TypeTableEntryIdBlock: - case TypeTableEntryIdBoundFn: - return false; - - case TypeTableEntryIdBool: - case TypeTableEntryIdInt: - case TypeTableEntryIdFloat: - case TypeTableEntryIdPointer: - case TypeTableEntryIdArray: - case TypeTableEntryIdStruct: - case TypeTableEntryIdMaybe: - case TypeTableEntryIdErrorUnion: - case TypeTableEntryIdPureError: - case TypeTableEntryIdEnum: - case TypeTableEntryIdUnion: - case TypeTableEntryIdFn: - case TypeTableEntryIdEnumTag: - return true; - - case TypeTableEntryIdTypeDecl: - return type_has_codegen_value(type_entry->data.type_decl.canonical_type); - - case TypeTableEntryIdVar: - zig_unreachable(); - } - zig_unreachable(); -} - bool types_match_const_cast_only(TypeTableEntry *expected_type, TypeTableEntry *actual_type) { if (expected_type == actual_type) return true; |
