| ... | @@ -1010,8 +1010,6 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { | ... | @@ -1010,8 +1010,6 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { |
| 1010 | | 1010 | |
| 1011 | // populate the name of the type | 1011 | // populate the name of the type |
| 1012 | buf_resize(&fn_type->name, 0); | 1012 | buf_resize(&fn_type->name, 0); |
| 1013 | if (fn_type->data.fn.fn_type_id.cc == CallingConventionC) | | |
| 1014 | buf_append_str(&fn_type->name, "extern "); | | |
| 1015 | buf_appendf(&fn_type->name, "fn("); | 1013 | buf_appendf(&fn_type->name, "fn("); |
| 1016 | for (size_t i = 0; i < fn_type_id->param_count; i += 1) { | 1014 | for (size_t i = 0; i < fn_type_id->param_count; i += 1) { |
| 1017 | FnTypeParamInfo *param_info = &fn_type_id->param_info[i]; | 1015 | FnTypeParamInfo *param_info = &fn_type_id->param_info[i]; |
| ... | @@ -1030,8 +1028,8 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { | ... | @@ -1030,8 +1028,8 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { |
| 1030 | if (fn_type_id->alignment != 0) { | 1028 | if (fn_type_id->alignment != 0) { |
| 1031 | buf_appendf(&fn_type->name, " align(%" PRIu32 ")", fn_type_id->alignment); | 1029 | buf_appendf(&fn_type->name, " align(%" PRIu32 ")", fn_type_id->alignment); |
| 1032 | } | 1030 | } |
| 1033 | if (fn_type_id->cc != CallingConventionUnspecified && fn_type_id->cc != CallingConventionC) { | 1031 | if (fn_type_id->cc != CallingConventionUnspecified) { |
| 1034 | buf_appendf(&fn_type->name, " callconv(%s)", calling_convention_name(fn_type_id->cc)); | 1032 | buf_appendf(&fn_type->name, " callconv(.%s)", calling_convention_name(fn_type_id->cc)); |
| 1035 | } | 1033 | } |
| 1036 | buf_appendf(&fn_type->name, " %s", buf_ptr(&fn_type_id->return_type->name)); | 1034 | buf_appendf(&fn_type->name, " %s", buf_ptr(&fn_type_id->return_type->name)); |
| 1037 | | 1035 | |
| ... | @@ -1464,7 +1462,7 @@ ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) { | ... | @@ -1464,7 +1462,7 @@ ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) { |
| 1464 | } | 1462 | } |
| 1465 | buf_append_str(&fn_type->name, ")"); | 1463 | buf_append_str(&fn_type->name, ")"); |
| 1466 | if (fn_type_id->cc != CallingConventionUnspecified) { | 1464 | if (fn_type_id->cc != CallingConventionUnspecified) { |
| 1467 | buf_appendf(&fn_type->name, " callconv(%s)", calling_convention_name(fn_type_id->cc)); | 1465 | buf_appendf(&fn_type->name, " callconv(.%s)", calling_convention_name(fn_type_id->cc)); |
| 1468 | } | 1466 | } |
| 1469 | buf_append_str(&fn_type->name, " var"); | 1467 | buf_append_str(&fn_type->name, " var"); |
| 1470 | | 1468 | |
| ... | @@ -4385,7 +4383,7 @@ uint32_t get_ptr_align(CodeGen *g, ZigType *type) { | ... | @@ -4385,7 +4383,7 @@ uint32_t get_ptr_align(CodeGen *g, ZigType *type) { |
| 4385 | } else if (ptr_type->id == ZigTypeIdFn) { | 4383 | } else if (ptr_type->id == ZigTypeIdFn) { |
| 4386 | // I tried making this use LLVMABIAlignmentOfType but it trips this assertion in LLVM: | 4384 | // I tried making this use LLVMABIAlignmentOfType but it trips this assertion in LLVM: |
| 4387 | // "Cannot getTypeInfo() on a type that is unsized!" | 4385 | // "Cannot getTypeInfo() on a type that is unsized!" |
| 4388 | // when getting the alignment of `?extern fn() void`. | 4386 | // when getting the alignment of `?fn() callconv(.C) void`. |
| 4389 | // See http://lists.llvm.org/pipermail/llvm-dev/2018-September/126142.html | 4387 | // See http://lists.llvm.org/pipermail/llvm-dev/2018-September/126142.html |
| 4390 | return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment; | 4388 | return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment; |
| 4391 | } else if (ptr_type->id == ZigTypeIdAnyFrame) { | 4389 | } else if (ptr_type->id == ZigTypeIdAnyFrame) { |