| ... | ... | @@ -443,12 +443,22 @@ fn visitFnDecl(c: *Context, fn_decl: *const ZigClangFunctionDecl) Error!void { |
| 443 | 443 | }; |
| 444 | 444 | |
| 445 | 445 | var fn_qt = ZigClangFunctionDecl_getType(fn_decl); |
| 446 | | var fn_type = ZigClangQualType_getTypePtr(fn_qt); |
| 447 | | if (ZigClangType_getTypeClass(fn_type) == .Attributed) { |
| 448 | | const attr_type = @ptrCast(*const ZigClangAttributedType, fn_type); |
| 449 | | fn_qt = ZigClangAttributedType_getEquivalentType(attr_type); |
| 450 | | fn_type = ZigClangQualType_getTypePtr(fn_qt); |
| 451 | | } |
| 446 | |
| 447 | const fn_type = while (true) { |
| 448 | const fn_type = ZigClangQualType_getTypePtr(fn_qt); |
| 449 | |
| 450 | switch (ZigClangType_getTypeClass(fn_type)) { |
| 451 | .Attributed => { |
| 452 | const attr_type = @ptrCast(*const ZigClangAttributedType, fn_type); |
| 453 | fn_qt = ZigClangAttributedType_getEquivalentType(attr_type); |
| 454 | }, |
| 455 | .Paren => { |
| 456 | const paren_type = @ptrCast(*const ZigClangParenType, fn_type); |
| 457 | fn_qt = ZigClangParenType_getInnerType(paren_type); |
| 458 | }, |
| 459 | else => break fn_type, |
| 460 | } |
| 461 | } else unreachable; |
| 452 | 462 | |
| 453 | 463 | const proto_node = switch (ZigClangType_getTypeClass(fn_type)) { |
| 454 | 464 | .FunctionProto => blk: { |
| ... | ... | @@ -505,7 +515,7 @@ fn visitFnDecl(c: *Context, fn_decl: *const ZigClangFunctionDecl) Error!void { |
| 505 | 515 | |
| 506 | 516 | const arg_name = blk: { |
| 507 | 517 | const param_prefix = if (is_const) "" else "arg_"; |
| 508 | | const bare_arg_name = try std.fmt.allocPrint(c.a(), "{}{}", .{param_prefix, mangled_param_name}); |
| 518 | const bare_arg_name = try std.fmt.allocPrint(c.a(), "{}{}", .{ param_prefix, mangled_param_name }); |
| 509 | 519 | break :blk try block_scope.makeMangledName(c, bare_arg_name); |
| 510 | 520 | }; |
| 511 | 521 | |