| ... | @@ -314,6 +314,19 @@ static bool is_c_void_type(Context *c, TypeTableEntry *type_entry) { | ... | @@ -314,6 +314,19 @@ static bool is_c_void_type(Context *c, TypeTableEntry *type_entry) { |
| 314 | return false; | 314 | return false; |
| 315 | } | 315 | } |
| 316 | | 316 | |
| | 317 | static bool qual_type_child_is_fn_proto(const QualType &qt) { |
| | 318 | if (qt.getTypePtr()->getTypeClass() == Type::Paren) { |
| | 319 | const ParenType *paren_type = static_cast<const ParenType *>(qt.getTypePtr()); |
| | 320 | if (paren_type->getInnerType()->getTypeClass() == Type::FunctionProto) { |
| | 321 | return true; |
| | 322 | } |
| | 323 | } else if (qt.getTypePtr()->getTypeClass() == Type::Attributed) { |
| | 324 | const AttributedType *attr_type = static_cast<const AttributedType *>(qt.getTypePtr()); |
| | 325 | return qual_type_child_is_fn_proto(attr_type->getEquivalentType()); |
| | 326 | } |
| | 327 | return false; |
| | 328 | } |
| | 329 | |
| 317 | static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const Decl *decl, | 330 | static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const Decl *decl, |
| 318 | HashMap<Buf *, TypeTableEntry *, buf_hash, buf_eql_buf> *type_table) | 331 | HashMap<Buf *, TypeTableEntry *, buf_hash, buf_eql_buf> *type_table) |
| 319 | { | 332 | { |
| ... | @@ -395,11 +408,8 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const | ... | @@ -395,11 +408,8 @@ static TypeTableEntry *resolve_type_with_table(Context *c, const Type *ty, const |
| 395 | return c->codegen->builtin_types.entry_invalid; | 408 | return c->codegen->builtin_types.entry_invalid; |
| 396 | } | 409 | } |
| 397 | | 410 | |
| 398 | if (child_qt.getTypePtr()->getTypeClass() == Type::Paren) { | 411 | if (qual_type_child_is_fn_proto(child_qt)) { |
| 399 | const ParenType *paren_type = static_cast<const ParenType *>(child_qt.getTypePtr()); | 412 | return get_maybe_type(c->codegen, child_type); |
| 400 | if (paren_type->getInnerType()->getTypeClass() == Type::FunctionProto) { | | |
| 401 | return get_maybe_type(c->codegen, child_type); | | |
| 402 | } | | |
| 403 | } | 413 | } |
| 404 | bool is_const = child_qt.isConstQualified(); | 414 | bool is_const = child_qt.isConstQualified(); |
| 405 | | 415 | |
| ... | @@ -1639,7 +1649,12 @@ int parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const ch | ... | @@ -1639,7 +1649,12 @@ int parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const ch |
| 1639 | unsigned offset = fsl.getManager().getFileOffset(fsl); | 1649 | unsigned offset = fsl.getManager().getFileOffset(fsl); |
| 1640 | const char *source = (const char *)fsl.getManager().getBufferData(file_id).bytes_begin(); | 1650 | const char *source = (const char *)fsl.getManager().getBufferData(file_id).bytes_begin(); |
| 1641 | Buf *msg = buf_create_from_str((const char *)msg_str_ref.bytes_begin()); | 1651 | Buf *msg = buf_create_from_str((const char *)msg_str_ref.bytes_begin()); |
| 1642 | Buf *path = buf_create_from_str((const char *)filename.bytes_begin()); | 1652 | Buf *path; |
| | 1653 | if (filename.empty()) { |
| | 1654 | path = buf_alloc(); |
| | 1655 | } else { |
| | 1656 | path = buf_create_from_mem((const char *)filename.bytes_begin(), filename.size()); |
| | 1657 | } |
| 1643 | | 1658 | |
| 1644 | ErrorMsg *err_msg = err_msg_create_with_offset(path, line, column, offset, source, msg); | 1659 | ErrorMsg *err_msg = err_msg_create_with_offset(path, line, column, offset, source, msg); |
| 1645 | | 1660 | |