From 5df091fea98e91536f95e3b4bd5bcb0881f06989 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 1 Mar 2016 15:26:41 -0700 Subject: c_void is provided outside of C imports --- src/parseh.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/parseh.cpp') diff --git a/src/parseh.cpp b/src/parseh.cpp index 929a22c8b1..e7b2f1ea42 100644 --- a/src/parseh.cpp +++ b/src/parseh.cpp @@ -36,7 +36,6 @@ struct Context { ZigList *errors; bool warnings_on; VisibMod visib_mod; - TypeTableEntry *c_void_type; AstNode *root; HashMap global_type_table; HashMap global_value_table; @@ -292,21 +291,9 @@ static AstNode *add_const_var_node(Context *c, Buf *name, TypeTableEntry *type_e return node; } -static TypeTableEntry *get_c_void_type(Context *c) { - if (!c->c_void_type) { - c->c_void_type = get_typedecl_type(c->codegen, "c_void", c->codegen->builtin_types.entry_u8); - add_typedef_node(c, c->c_void_type); - } - - return c->c_void_type; -} - static bool is_c_void_type(Context *c, TypeTableEntry *type_entry) { - if (!c->c_void_type) { - return false; - } while (type_entry->id == TypeTableEntryIdTypeDecl) { - if (type_entry == c->c_void_type) { + if (type_entry == c->codegen->builtin_types.entry_c_void) { return true; } type_entry = type_entry->data.type_decl.child_type; @@ -336,7 +323,7 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const const BuiltinType *builtin_ty = static_cast(ty); switch (builtin_ty->getKind()) { case BuiltinType::Void: - return get_c_void_type(c); + return c->codegen->builtin_types.entry_c_void; case BuiltinType::Bool: return c->codegen->builtin_types.entry_bool; case BuiltinType::Char_U: -- cgit v1.2.3