Lines Matching refs:sym

617 		struct symbol *sym = create_symbol(stream, ptr->name, SYM_KEYWORD, ptr->ns);  in init_parser()  local
618 sym->ident->keyword = 1; in init_parser()
620 sym->ident->reserved = 1; in init_parser()
621 sym->ctype.modifiers = ptr->modifiers; in init_parser()
622 sym->ctype.base_type = ptr->type; in init_parser()
623 sym->op = ptr->op; in init_parser()
628 struct symbol *sym = create_symbol(stream, name, SYM_KEYWORD, in init_parser() local
630 if (!sym->op) { in init_parser()
631 sym->ident->keyword = 1; in init_parser()
632 sym->op = &ignore_attr_op; in init_parser()
639 static void fn_local_symbol(struct symbol *sym) in fn_local_symbol() argument
642 add_symbol(function_symbol_list, sym); in fn_local_symbol()
691 struct symbol *sym = alloc_symbol(pos, type); in alloc_indirect_symbol() local
693 sym->ctype.base_type = ctype->base_type; in alloc_indirect_symbol()
694 sym->ctype.modifiers = ctype->modifiers; in alloc_indirect_symbol()
696 ctype->base_type = sym; in alloc_indirect_symbol()
698 return sym; in alloc_indirect_symbol()
708 struct symbol *sym = lookup_symbol(token->ident, NS_LABEL); in label_symbol() local
709 if (!sym) { in label_symbol()
710 sym = alloc_symbol(token->pos, SYM_LABEL); in label_symbol()
711 bind_symbol(sym, token->ident, NS_LABEL); in label_symbol()
712 fn_local_symbol(sym); in label_symbol()
714 return sym; in label_symbol()
721 struct symbol *sym; in struct_union_enum_specifier() local
726 sym = lookup_symbol(token->ident, NS_STRUCT); in struct_union_enum_specifier()
727 if (!sym || in struct_union_enum_specifier()
728 (is_outer_scope(sym->scope) && in struct_union_enum_specifier()
732 sym = alloc_symbol(token->pos, type); in struct_union_enum_specifier()
733 bind_symbol(sym, token->ident, NS_STRUCT); in struct_union_enum_specifier()
735 if (sym->type != type) in struct_union_enum_specifier()
736 error_die(token->pos, "invalid tag applied to %s", show_typename (sym)); in struct_union_enum_specifier()
737 ctx->ctype.base_type = sym; in struct_union_enum_specifier()
741 struct decl_state attr = { .ctype.base_type = sym, }; in struct_union_enum_specifier()
746 if (sym->symbol_list) in struct_union_enum_specifier()
747 error_die(token->pos, "redefinition of %s", show_typename (sym)); in struct_union_enum_specifier()
748 sym->pos = *repos; in struct_union_enum_specifier()
749 token = parse(token->next, sym); in struct_union_enum_specifier()
753 apply_ctype(token->pos, &attr.ctype, &sym->ctype); in struct_union_enum_specifier()
756 sym->examined = 0; in struct_union_enum_specifier()
757 sym->endpos = token->pos; in struct_union_enum_specifier()
769 sym = alloc_symbol(token->pos, type); in struct_union_enum_specifier()
770 token = parse(token->next, sym); in struct_union_enum_specifier()
771 ctx->ctype.base_type = sym; in struct_union_enum_specifier()
773 sym->endpos = token->pos; in struct_union_enum_specifier()
778 static struct token *parse_struct_declaration(struct token *token, struct symbol *sym) in parse_struct_declaration() argument
782 res = struct_declaration_list(token, &sym->symbol_list); in parse_struct_declaration()
783 FOR_EACH_PTR(sym->symbol_list, field) { in parse_struct_declaration()
796 static struct token *parse_union_declaration(struct token *token, struct symbol *sym) in parse_union_declaration() argument
798 return struct_declaration_list(token, &sym->symbol_list); in parse_union_declaration()
893 struct symbol *sym; in cast_enum_list() local
895 FOR_EACH_PTR(list, sym) { in cast_enum_list()
896 struct expression *expr = sym->initializer; in cast_enum_list()
913 } END_FOR_EACH_PTR(sym); in cast_enum_list()
928 struct symbol *sym; in parse_enum_declaration() local
950 sym = alloc_symbol(token->pos, SYM_NODE); in parse_enum_declaration()
951 bind_symbol(sym, token->ident, NS_SYMBOL); in parse_enum_declaration()
952 sym->ctype.modifiers &= ~MOD_ADDRESSABLE; in parse_enum_declaration()
953 sym->initializer = expr; in parse_enum_declaration()
954 sym->enum_member = 1; in parse_enum_declaration()
955 sym->ctype.base_type = parent; in parse_enum_declaration()
956 add_ptr_list(&parent->symbol_list, sym); in parse_enum_declaration()
1003 sym->endpos = token->pos; in parse_enum_declaration()
1053 struct symbol *sym; in typeof_specifier() local
1060 token = typename(token->next, &sym, NULL); in typeof_specifier()
1061 ctx->ctype.base_type = sym->ctype.base_type; in typeof_specifier()
1062 apply_ctype(token->pos, &sym->ctype, &ctx->ctype); in typeof_specifier()
1460 struct symbol *sym = NULL; in alignas_specifier() local
1461 token = typename(token->next, &sym, NULL); in alignas_specifier()
1462 sym = examine_symbol_type(sym); in alignas_specifier()
1463 alignment = sym->ctype.alignment; in alignas_specifier()
1688 static struct token *abstract_array_declarator(struct token *token, struct symbol *sym) in abstract_array_declarator() argument
1698 sym->array_size = expr; in abstract_array_declarator()
2013 static struct token *parameter_declaration(struct token *token, struct symbol *sym) in parameter_declaration() argument
2018 ctx.ident = &sym->ident; in parameter_declaration()
2022 sym->ctype = ctx.ctype; in parameter_declaration()
2023 sym->ctype.modifiers |= storage_modifiers(&ctx); in parameter_declaration()
2024 sym->endpos = token->pos; in parameter_declaration()
2025 sym->forced_arg = ctx.storage_class == SForced; in parameter_declaration()
2033 struct symbol *sym = alloc_symbol(token->pos, SYM_NODE); in typename() local
2034 *p = sym; in typename()
2038 sym->ctype = ctx.ctype; in typename()
2039 sym->endpos = token->pos; in typename()
2049 warning(sym->pos, "storage class in typename (%s %s)", in typename()
2050 storage_class[class], show_typename(sym)); in typename()
2236 static struct statement *start_function(struct symbol *sym) in start_function() argument
2239 struct statement *stmt = alloc_statement(sym->pos, STMT_COMPOUND); in start_function()
2241 start_function_scope(sym->pos); in start_function()
2242 ret = alloc_symbol(sym->pos, SYM_NODE); in start_function()
2243 ret->ctype = sym->ctype.base_type->ctype; in start_function()
2251 current_fn = sym; in start_function()
2256 static void end_function(struct symbol *sym) in end_function() argument
2304 struct symbol *sym; in add_case_statement() local
2311 sym = alloc_symbol(stmt->pos, SYM_NODE); in add_case_statement()
2312 add_symbol(&target->symbol_list, sym); in add_case_statement()
2313 sym->stmt = stmt; in add_case_statement()
2314 stmt->case_label = sym; in add_case_statement()
2315 fn_local_symbol(sym); in add_case_statement()
2329 static void validate_for_loop_decl(struct symbol *sym) in validate_for_loop_decl() argument
2331 unsigned long storage = sym->ctype.modifiers & MOD_STORAGE; in validate_for_loop_decl()
2334 const char *name = show_ident(sym->ident); in validate_for_loop_decl()
2335 sparse_error(sym->pos, "non-local var '%s' in for-loop initializer", name); in validate_for_loop_decl()
2336 sym->ctype.modifiers &= ~MOD_STORAGE; in validate_for_loop_decl()
2559 struct symbol *sym = alloc_symbol(token->pos, SYM_LABEL); in label_statement() local
2561 bind_symbol(sym, token->ident, NS_SYMBOL); in label_statement()
2562 sym->namespace = NS_LABEL; in label_statement()
2563 fn_local_symbol(sym); in label_statement()
2608 struct symbol *sym = alloc_symbol(token->pos, SYM_NODE); in identifier_list() local
2609 sym->ident = token->ident; in identifier_list()
2611 sym->endpos = token->pos; in identifier_list()
2612 sym->ctype.base_type = &incomplete_ctype; in identifier_list()
2613 add_symbol(list, sym); in identifier_list()
2628 struct symbol *sym; in parameter_type_list() local
2636 sym = alloc_symbol(token->pos, SYM_NODE); in parameter_type_list()
2637 token = parameter_declaration(token, sym); in parameter_type_list()
2638 if (sym->ctype.base_type == &void_ctype) { in parameter_type_list()
2640 if (!*list && !sym->ident) in parameter_type_list()
2644 add_symbol(list, sym); in parameter_type_list()
2769 static void declare_argument(struct symbol *sym, struct symbol *fn) in declare_argument() argument
2771 if (!sym->ident) { in declare_argument()
2772 sparse_error(sym->pos, "no identifier for function argument"); in declare_argument()
2775 bind_symbol(sym, sym->ident, NS_SYMBOL); in declare_argument()
2778 static int is_syscall(struct symbol *sym) in is_syscall() argument
2784 macro = get_macro_name(sym->pos); in is_syscall()
2790 name = sym->ident->name; in is_syscall()