| ... | @@ -275,6 +275,25 @@ fn transType(rp: RestorePoint, ty: *const ZigClangType, source_loc: ZigClangSour | ... | @@ -275,6 +275,25 @@ fn transType(rp: RestorePoint, ty: *const ZigClangType, source_loc: ZigClangSour |
| 275 | .Builtin => { | 275 | .Builtin => { |
| 276 | const builtin_ty = @ptrCast(*const ZigClangBuiltinType, ty); | 276 | const builtin_ty = @ptrCast(*const ZigClangBuiltinType, ty); |
| 277 | switch (ZigClangBuiltinType_getKind(builtin_ty)) { | 277 | switch (ZigClangBuiltinType_getKind(builtin_ty)) { |
| | 278 | .Void => return appendIdentifier(rp.c, "c_void"), |
| | 279 | .Bool => return appendIdentifier(rp.c, "bool"), |
| | 280 | .Char_U, .UChar, .Char_S, .Char8 => return appendIdentifier(rp.c, "u8"), |
| | 281 | .SChar => return appendIdentifier(rp.c, "i8"), |
| | 282 | .UShort => return appendIdentifier(rp.c, "c_ushort"), |
| | 283 | .UInt => return appendIdentifier(rp.c, "c_uint"), |
| | 284 | .ULong => return appendIdentifier(rp.c, "c_ulong"), |
| | 285 | .ULongLong => return appendIdentifier(rp.c, "c_ulonglong"), |
| | 286 | .Short => return appendIdentifier(rp.c, "c_short"), |
| | 287 | .Int => return appendIdentifier(rp.c, "c_int"), |
| | 288 | .Long => return appendIdentifier(rp.c, "c_long"), |
| | 289 | .LongLong => return appendIdentifier(rp.c, "c_longlong"), |
| | 290 | .UInt128 => return appendIdentifier(rp.c, "u128"), |
| | 291 | .Int128 => return appendIdentifier(rp.c, "i128"), |
| | 292 | .Float => return appendIdentifier(rp.c, "f32"), |
| | 293 | .Double => return appendIdentifier(rp.c, "f64"), |
| | 294 | .Float128 => return appendIdentifier(rp.c, "f128"), |
| | 295 | .Float16 => return appendIdentifier(rp.c, "f16"), |
| | 296 | .LongDouble => return appendIdentifier(rp.c, "c_longdouble"), |
| 278 | else => return revertAndWarn(rp, error.UnsupportedType, source_loc, "unsupported builtin type"), | 297 | else => return revertAndWarn(rp, error.UnsupportedType, source_loc, "unsupported builtin type"), |
| 279 | } | 298 | } |
| 280 | }, | 299 | }, |
| ... | @@ -328,7 +347,8 @@ fn transFnProto( | ... | @@ -328,7 +347,8 @@ fn transFnProto( |
| 328 | // TODO check for always_inline attribute | 347 | // TODO check for always_inline attribute |
| 329 | // TODO check for align attribute | 348 | // TODO check for align attribute |
| 330 | | 349 | |
| 331 | // extern fn name(...) T | 350 | // pub extern fn name(...) T |
| | 351 | const pub_tok = try appendToken(rp.c, .Keyword_pub, "pub"); |
| 332 | const cc_tok = if (cc == .Stdcall) try appendToken(rp.c, .Keyword_stdcallcc, "stdcallcc") else null; | 352 | const cc_tok = if (cc == .Stdcall) try appendToken(rp.c, .Keyword_stdcallcc, "stdcallcc") else null; |
| 333 | const is_export = exp: { | 353 | const is_export = exp: { |
| 334 | const fn_decl = opt_fn_decl orelse break :exp false; | 354 | const fn_decl = opt_fn_decl orelse break :exp false; |
| ... | @@ -380,7 +400,7 @@ fn transFnProto( | ... | @@ -380,7 +400,7 @@ fn transFnProto( |
| 380 | fn_proto.* = ast.Node.FnProto{ | 400 | fn_proto.* = ast.Node.FnProto{ |
| 381 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, | 401 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, |
| 382 | .doc_comments = null, | 402 | .doc_comments = null, |
| 383 | .visib_token = null, | 403 | .visib_token = pub_tok, |
| 384 | .fn_token = fn_tok, | 404 | .fn_token = fn_tok, |
| 385 | .name_token = name_tok, | 405 | .name_token = name_tok, |
| 386 | .params = ast.Node.FnProto.ParamList.init(rp.c.a()), | 406 | .params = ast.Node.FnProto.ParamList.init(rp.c.a()), |