| ... | @@ -3667,6 +3667,7 @@ static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_ | ... | @@ -3667,6 +3667,7 @@ static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_ |
| 3667 | if (existing_entry) { | 3667 | if (existing_entry) { |
| 3668 | return existing_entry->value; | 3668 | return existing_entry->value; |
| 3669 | } | 3669 | } |
| | 3670 | |
| 3670 | QualType child_qt = typedef_decl->getUnderlyingType(); | 3671 | QualType child_qt = typedef_decl->getUnderlyingType(); |
| 3671 | Buf *type_name = buf_create_from_str(decl_name(typedef_decl)); | 3672 | Buf *type_name = buf_create_from_str(decl_name(typedef_decl)); |
| 3672 | | 3673 | |
| ... | @@ -3700,16 +3701,19 @@ static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_ | ... | @@ -3700,16 +3701,19 @@ static AstNode *resolve_typedef_decl(Context *c, const TypedefNameDecl *typedef_ |
| 3700 | // use the name of this typedef | 3701 | // use the name of this typedef |
| 3701 | // TODO | 3702 | // TODO |
| 3702 | | 3703 | |
| | 3704 | // trans_qual_type here might cause us to look at this typedef again so we put the item in the map first |
| | 3705 | AstNode *symbol_node = trans_create_node_symbol(c, type_name); |
| | 3706 | c->decl_table.put(typedef_decl->getCanonicalDecl(), symbol_node); |
| | 3707 | |
| 3703 | AstNode *type_node = trans_qual_type(c, child_qt, typedef_decl->getLocation()); | 3708 | AstNode *type_node = trans_qual_type(c, child_qt, typedef_decl->getLocation()); |
| 3704 | if (type_node == nullptr) { | 3709 | if (type_node == nullptr) { |
| 3705 | emit_warning(c, typedef_decl->getLocation(), "typedef %s - unresolved child type", buf_ptr(type_name)); | 3710 | emit_warning(c, typedef_decl->getLocation(), "typedef %s - unresolved child type", buf_ptr(type_name)); |
| 3706 | c->decl_table.put(typedef_decl, nullptr); | 3711 | c->decl_table.put(typedef_decl, nullptr); |
| | 3712 | // TODO add global var with type_name equal to @compileError("unable to resolve C type") |
| 3707 | return nullptr; | 3713 | return nullptr; |
| 3708 | } | 3714 | } |
| 3709 | add_global_var(c, type_name, type_node); | 3715 | add_global_var(c, type_name, type_node); |
| 3710 | | 3716 | |
| 3711 | AstNode *symbol_node = trans_create_node_symbol(c, type_name); | | |
| 3712 | c->decl_table.put(typedef_decl->getCanonicalDecl(), symbol_node); | | |
| 3713 | return symbol_node; | 3717 | return symbol_node; |
| 3714 | } | 3718 | } |
| 3715 | | 3719 | |