| ... | ... | @@ -3973,6 +3973,10 @@ fn transCC( |
| 3973 | 3973 | switch (clang_cc) { |
| 3974 | 3974 | .C => return CallingConvention.C, |
| 3975 | 3975 | .X86StdCall => return CallingConvention.Stdcall, |
| 3976 | .X86FastCall => return CallingConvention.Fastcall, |
| 3977 | .X86VectorCall, .AArch64VectorCall => return CallingConvention.Vectorcall, |
| 3978 | .AAPCS => return CallingConvention.AAPCS, |
| 3979 | .AAPCS_VFP => return CallingConvention.AAPCSVFP, |
| 3976 | 3980 | else => return revertAndWarn( |
| 3977 | 3981 | rp, |
| 3978 | 3982 | error.UnsupportedType, |
| ... | ... | @@ -4028,7 +4032,6 @@ fn finishTransFnProto( |
| 4028 | 4032 | |
| 4029 | 4033 | // pub extern fn name(...) T |
| 4030 | 4034 | const pub_tok = if (is_pub) try appendToken(rp.c, .Keyword_pub, "pub") else null; |
| 4031 | | const cc_tok = if (cc == .Stdcall) try appendToken(rp.c, .Keyword_stdcallcc, "stdcallcc") else null; |
| 4032 | 4035 | const extern_export_inline_tok = if (is_export) |
| 4033 | 4036 | try appendToken(rp.c, .Keyword_export, "export") |
| 4034 | 4037 | else if (cc == .C and is_extern) |
| ... | ... | @@ -4101,6 +4104,14 @@ fn finishTransFnProto( |
| 4101 | 4104 | |
| 4102 | 4105 | const rparen_tok = try appendToken(rp.c, .RParen, ")"); |
| 4103 | 4106 | |
| 4107 | const callconv_expr = if (cc == .C and is_extern) null else blk: { |
| 4108 | _ = try appendToken(rp.c, .Keyword_callconv, "callconv"); |
| 4109 | _ = try appendToken(rp.c, .LParen, "("); |
| 4110 | const expr = try transCreateNodeEnumLiteral(rp.c, @tagName(cc)); |
| 4111 | _ = try appendToken(rp.c, .RParen, ")"); |
| 4112 | break :blk expr; |
| 4113 | }; |
| 4114 | |
| 4104 | 4115 | const return_type_node = blk: { |
| 4105 | 4116 | if (ZigClangFunctionType_getNoReturnAttr(fn_ty)) { |
| 4106 | 4117 | break :blk try transCreateNodeIdentifier(rp.c, "noreturn"); |
| ... | ... | @@ -4131,12 +4142,12 @@ fn finishTransFnProto( |
| 4131 | 4142 | .return_type = .{ .Explicit = return_type_node }, |
| 4132 | 4143 | .var_args_token = null, // TODO this field is broken in the AST data model |
| 4133 | 4144 | .extern_export_inline_token = extern_export_inline_tok, |
| 4134 | | .cc_token = cc_tok, |
| 4145 | .cc_token = null, |
| 4135 | 4146 | .body_node = null, |
| 4136 | 4147 | .lib_name = null, |
| 4137 | 4148 | .align_expr = null, |
| 4138 | 4149 | .section_expr = null, |
| 4139 | | .callconv_expr = null, |
| 4150 | .callconv_expr = callconv_expr, |
| 4140 | 4151 | }; |
| 4141 | 4152 | return fn_proto; |
| 4142 | 4153 | } |