diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-22 20:56:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-22 20:56:30 -0400 |
| commit | 1c636e2564e2fc2e8e4b6b1edbc782592ee3d2d7 (patch) | |
| tree | 5311dc81615ff9efa2b4840070371f54182f8bee /src/stage1/analyze.cpp | |
| parent | 9baf8917725ede02d9fc1aeebe253842174ee57b (diff) | |
| parent | 563ea60a86a733f53f2394a11cb9ec4e56063fa3 (diff) | |
| download | zig-1c636e2564e2fc2e8e4b6b1edbc782592ee3d2d7.tar.gz zig-1c636e2564e2fc2e8e4b6b1edbc782592ee3d2d7.zip | |
Merge pull request #8844 from ifreund/inline
Support inline keyword as well as callconv(.Inline)
Diffstat (limited to 'src/stage1/analyze.cpp')
| -rw-r--r-- | src/stage1/analyze.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index a87fd80613..581e34acfc 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -1638,6 +1638,9 @@ CallingConvention cc_from_fn_proto(AstNodeFnProto *fn_proto) { if (fn_proto->is_extern || fn_proto->is_export) return CallingConventionC; + if (fn_proto->fn_inline == FnInlineAlways) + return CallingConventionInline; + return CallingConventionUnspecified; } @@ -3649,7 +3652,7 @@ ZigFn *create_fn(CodeGen *g, AstNode *proto_node) { assert(proto_node->type == NodeTypeFnProto); AstNodeFnProto *fn_proto = &proto_node->data.fn_proto; - ZigFn *fn_entry = create_fn_raw(g, fn_proto->is_noinline); + ZigFn *fn_entry = create_fn_raw(g, fn_proto->fn_inline == FnInlineNever); fn_entry->proto_node = proto_node; fn_entry->body_node = (proto_node->data.fn_proto.fn_def_node == nullptr) ? nullptr : @@ -3742,6 +3745,9 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) { CallingConvention cc; if (fn_proto->callconv_expr != nullptr) { + if (fn_proto->fn_inline == FnInlineAlways) { + add_node_error(g, fn_proto->callconv_expr, buf_sprintf("explicit callconv incompatible with inline keyword")); + } ZigType *cc_enum_value = get_builtin_type(g, "CallingConvention"); ZigValue *result_val = analyze_const_value(g, child_scope, fn_proto->callconv_expr, |
