diff options
-rw-r--r-- | ChangeLog.name-lookup | 1515 | ||||
-rw-r--r-- | gcc/c-family/c-ada-spec.c | 16 | ||||
-rw-r--r-- | gcc/c-family/c-ppoutput.c | 2 | ||||
-rw-r--r-- | gcc/cp/class.c | 12 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 137 | ||||
-rw-r--r-- | gcc/cp/name-lookup.h | 4 | ||||
-rw-r--r-- | libcpp/include/cpplib.h | 8 | ||||
-rw-r--r-- | libcpp/include/line-map.h | 23 | ||||
-rw-r--r-- | libcpp/traditional.c | 1 |
9 files changed, 1611 insertions, 107 deletions
diff --git a/ChangeLog.name-lookup b/ChangeLog.name-lookup new file mode 100644 index 0000000..f5ce219 --- /dev/null +++ b/ChangeLog.name-lookup @@ -0,0 +1,1515 @@ +2018-08-20 Nathan Sidwell <nathan@acm.org> + + Merge trunk r263669. + + Merge trunk r263667. + + Merge trunk r263658. + +2018-08-17 Nathan Sidwell <nathan@acm.org> + + Merge trunk r263622. + + Merge trunk r263618. + +2018-08-16 Nathan Sidwell <nathan@acm.org> + + Merge trunk r263587. + +2018-08-15 Nathan Sidwell <nathan@acm.org> + + Merge trunk r263558. + + libcpp/ + * incude/cpplib.h (NODE_...): Reenumerate. + (enum node_type): NT_VOID may be assert. + (struct _cpp_hashnode_value): Add assert field. + (cpp_user_macro_p): Don't check for assert here. + * directives.c (find_answer): Rename to ... + (find_assert): ... here. Adjust. + (undefine_macros): Zap value.assert. + (_cpp_test_assertion, do_assert, do_unassert): Adjust. + +2018-08-08 Nathan Sidwell <nathan@acm.org> + + gcc/c-family/ + c-ppoutput.c (dump_macro): No need to check for assert here. + libcpp/ + * include/cpplib.h (cpp_user_macro_p): Check non-assertness here. + (cpp_fun_like_macro_p): Make inline. + * macro.c (enter_macro_context): Use it directly. + (cpp_fun_like_macro_p): Remove definition here. + * pch.c (save_macros): Not need to check assertness here. + + Merge trunk r263434. + + Fold cpp-id-data.h into cpplib.h + libcpp/ + * internal.h: Include cpplib.h, not cpp-id-data.h. + (uchar, UC): From cpp-id-data.h. + * include/cpplib.h (cpp_macro_kind, cpp_macro): From cpp-id-data.h. + * include.cpp-id-data.h: Delete. + * Makefile.in (TAGS_SOURCES): Drop cpp-id-data.h. + gcc/ + * Makefile.in (CPP_ID_DATA_H): Delete. + (CPP_INTERNAL_H): Drop CPP_ID_DATA_H. + (GT_FILES): Replace CPP_ID_DATA_H with CPPLIB_H. + * cppbuiltin.c: Include cpplib.h instead of cpp-id-data.h. + gcc/c-family + * c-ada-spec.c: Don't include cpp-id-data.h. + * c-cppbuiltin.h: Likewise. + + libcpp/ + * include/cpplib.h (enum node_type): Rename to NT_USER_MACR, + NT_BUILTIN_MACRO. + (CPP_HASNODE_VALUE_IDX): Delete. + (union _cpp_hashnode_value): Adjust. + (struct cpp_hashnode): Likewise. + (cpp_macro_p, cpp_user_macro_p, cpp_builtin_macro_p): New. + * internal.h (_cpp_mark_macro_used): Use cpp_user_macro_p. + * directives.c (do_undef, do_pragma_poison, do_ifdef, do_ifndef) + (cpp_pop_definition): Use cpp_macro_p and friends. + (doassert): Adjust. + * expr.c (parse_defined): Use cpp_macro_p. + * files.c (should_stack_file): Likewise. + * identifiers.c (cpp_defined): Likewise. + * init.c (cpp_init_special_builtins): Adjust. + * lex.c (is_macro): Use cpp_macro_p. + * macro.c (cpp_warn_if_unused_macro, enter_macro_context) + (warn_of_redefinition, _cpp_create_definition): Use cpp_macro_p + and friends. + (_cpp_notify_macro_use): Adjust. + (cpp_macro_p): Delete old definition. + (cp_fun_like_macro_p): Use cpp_user_macro_p. + (cpp_macro_definition): Likewise. + * pch.c (write_macdef, count_defs, write_defs, save_macros): Adjust. + * traditional.c (fun_loke_macro, maybe_start_funlike) + (_cpp_scan_out_logical_line, push_replacement_text): Use + cpp_macro_p and friends. + gcc/c-family/ + * c-ada-spec.c (count_ada_macro, store_ada_macro): Use cpp_user_macro_p. + * c-ppoutput.c (cb_used_define, dump_macro): Likewise. + * c-spellcheck.cc (should_suggest_as_macro_p): Likewise. + gcc/ + * config/powerpcspe/powerpcspe-c.c (rs6000_macro_to_expand): Adjust. + * config/rs6000/rs6000-c.c (rs6000_macro_to_expand): Adjust. + gcc/cp/ + * name-lookup.c (lookup_name_fuzzy): Use cpp_user_macro_p. + gcc/fortran/ + * cpp.c (dump_macro): Use cpp_user_macro_p. + + libcpp/ + * internal.h (_cpp_notify_macro_use): Declare. + (_cpp_maybe_notify_macro_use): Define. + (_cpp_do_lazy_macro, _cpp_maybe_lazy_macro): Delete. + * directives.c (do_ifdef, do_ifndef): Call + _cpp_maybe_notify_macro_use. + * expr.c (parse_defined): Likewise. + * macro.c (enter_macro_context): Use _cpp_maybe_notify_macro_use. + (warn_of_redefinition): Do lazy definition explicitly. + (_cpp_notify_macro_use): Define. + (_cpp_do_lazy_macro): Delete. + + Move NODE_BUILTIN to NT_BUILTIN. + gcc/c-family/ + * c-ppoutput.c (cb_used_define): Use cpp_macro_p. + gcc/cp/ + * name-lookup.c (lookup_name_fuzzy): Use cpp_macro_p. + libcpp/ + * directives.c (do_undef): Adjust macro detection. + (undefine_macros): Adjust. + (do_pragma_poison, do_ifndef, do_ifdef, cpp_pop_definition): + Adjust. + * expr.c (parse_defined): Adjust. + * files.c (should_stack_file): Adjust. + * identifiers.c (cpp_defined): Adjust. + * include/cpplib.h (NODE_BUILTIN): Delete. + (enum node_type): Add NT_BUILTIN. + (CPP_HASHNODE_VALUE_IDX): Adjust. + * init.c (cpp_init_special_builtins): Adjust. + * internal.h (_cpp_mark_macro, _cpp_maybe_lazy_macro): Adjust. + * lex.c (is_macro): Adjust. + * macro.c (struct macro_arg_saved_data): Add type field. + (_cpp_warn_if_unused_macro): Adjust. + (enter_macro_context, cpp_get_token_1, warn_of_redefinition) + (_cpp_free_defintion, _cpp_safe_parameter) + (_cpp_unsave_parameters, _cpp_create_definition): Adjust. + (cpp_macro_p): Adjust. + * pch.c (write_macdef, count_defs, write_defs, cpp_validate_state) + (save_macros): Adjust. + * traditional.c (fun_like_macro, maybe_start_funlike) + (_cpp_scan_out_logical_line, push_replacement_text): Adjust. + +2018-08-07 Nathan Sidwell <nathan@acm.org> + + Move NODE_MACRO_ARG to NT_MACRO_ARG. + libcpp/ + * include/libcpp.h (NODE_MACRO_ARG): Delete. + (enum node_type): Add NT_MACRO_ARG. + (CPP_HSHNODE_VALUE_IDX): Adjust. + * macro.c (_cpp_save_parameter, _cpp_unsave_parameter): Adjust. + (lex_expansion_token): Likewise. + * traditional.c (_cpp_scan_out_logical_line): Likewise. + +2018-08-06 Nathan Sidwell <nathan@acm.org> + + Macro laziness now a property of cpp_macro. + libcpp/ + * include/cpp-id-data.h (cpp_macro): Add lazy field. + * include/libcpp.h (struct cpp_callbacks): Rename and retype + user_builtin_macro to user_lazy_macro. + (cpp_define_lazily): Adjust, + (cpp_define_lazy): Delete. + (enum cpp_builtin_type): Remove BT_FIRST_USER, BT_LAST_USER. + * internal.h (_cpp_do_lazy_macro): Declare. + (_cpp_maybe_lazy_macro): Inline fn. + * macro.c (enter_macro_context, warn_of_redefinition): Use + _cpp_maybe_lazy_macro. + (_cpp_new_macro): Initialize lazy field. + (cpp_define_lazily): Adjust. + (_cpp_do_lazy_macro): Define. + (cpp_macro_definition): Simplify. + * pch.c (write_macrodef, save_macros): Likewise. + * directives.c (do_ifdef, do_ifndef): Use _cpp_maybe_lazy_macro. + * expr.c (parse_defined): Likewise. + gcc/c-family/ + * c-cppbuiltin.c (lazy_hex_fp_value): Adjust for API changes. + (builtin_define_with_hex_fp_valye): Likewise. + + Merge trunk r263332. + +2018-08-03 Nathan Sidwell <nathan@acm.org> + + An API for lazy builtin macros. + libcpp/ + * include/libcpp.h (struct cpp_callbacks): Adjust + user_builtin_macro callback. + (cpp_define_lazily, cpp_define_lazy): Declare. + * macro.c (enter_macro_context, warn_of_redefinition): Adjust. + (cpp_define_lazily, cpp_define_lazy): Define. + (cpp_macro_definition): Adjust. + * pch.c (write_macrdef, save_macros): Likewise. + * directives.c (do_ifdef, do_ifndef): Adjust. + * expr.c (parse_defined): Likewise. + gcc/c-family/ + * c-cppbuiltin.c (lazy_hex_fp_value): Adjust for API changes. + (builtin_define_with_hex_fp_valye): Likewise. + +2018-08-02 Nathan Sidwell <nathan@acm.org> + + libcpp/ + * include/cpplib.h (enum node_type): Remove NT_ASSERTION. + (NTV_NONE): Delete. + (CPP_HASHNODE_VALUE_IDX): Adjust. + * macro.c (_cpp_free_definition): Zap macro pointer. + (_cpp_create_definition): Move _cpp_free_definition call. + * directives.c (find_answer): Initialize result. + (_cpp_test_assertion): Check macro pointer. + (do_assert): Likewise. + (do_unassert): Don't node type. + * pch.c (write_macdef, count_Defs, write_defs) + (save_macros): Adjust fo loss of NT_ASSERTION. + + Asserts are now macro variants + libcpp/ + * directives.c (parse_answer, parse_assertion, find_answer): Use + cpp_macro, not struct answer. + (do_assert, do_unassert): Adjust. + * include/cpp-id-data.h (struct answer): Delete. + * include/cpplib.h (NTV_ANSWER): Delete. + (CPP_HASNODE_VALUE_IDX): Adjust. + (_cpp_hashnode_value): Remove answer. + (cpp_macro_p): Make outline ... + * macro.c (cpp_macro_p): ... here. + + Assert body is back as trailing array + libcpp/ + * include/cpp-id-data.h (struct answer): Make body a trailing array + pointer. + * directives.c (parse_answer, parse_assertion, find_answer): + Return whole answer struct. + (_cpp_test_assertion, do_assert, do_unassert): Adjust. + +2018-08-01 Nathan Sidwell <nathan@acm.org> + + libcpp/ + * internal.h (_cpp_construct_macro): Rename to ... + (_cpp_new_macro): ... here. Kill old declaration. + * macro.c (_cpp_construct_macro): Rename to ... + (_cpp_new_macro): ... here. Kill old definition. + (create_iso_definition): Adjust. + * traditional.c (_cpp_create_trad_definition): Adjust. + + Macro tokens are trailing array + libcpp/ + * include/cpp-id-data.h (cpp_macro): Move tokens to trailing array. + * internal.h (_cpp_construct_macro): Declare. + * macro.c (lex_expansion): Return macro pointer, adjust. + (macro_real_token_count): Count backwards. + (replace_args): Use pointer equality, not orderedness. + (create_iso_definition): Adjust for trailing token array. + (_cpp_construct_macro): New, broken out of ... + (_cpp_new_macro): ... here. Call it. + (cpp_macro_definition): Constify token pointer. + gcc/c-family/ + * c-ada-spec.c (macro_length): Constify token pointer. + (dump_ada_macros): Likewise. + +2018-07-17 Nathan Sidwell <nathan@acm.org> + + libcpp/ + * macro.c (create_iso_definition): Create macro after saving + parms. + * traditional.c (_cpp_create_trad_definition): Likewise. + +2018-07-16 Nathan Sidwell <nathan@acm.org> + + libcpp/ + * internal.h (_cpp_reserve_room): New inline. + (_cpp_commit_buff): Declare. + * lex.c (_cpp_commit_buff): Implement. + * directives.c (parse_answer): Use them. + * macro.c (alloc_expansion_token): Fold ito ... + (lex_expansion_token): ... here. + (_cpp_save_parameter): Use _cpp_reserve_room. + (create_iso_definition): Use _cpp_reserve_room, _cpp_commit_buff). + +2018-07-13 Nathan Sidwell <nathan@acm.org> + + libcpp/ + * macro.c (parse_params): Re implement state machine. + (create_iso_definition): Adjust first token peeking. + * traditional.c (save_replacement_text): No need to set macro kind + here. + gcc/testsuite/ + * gcc.dg/cpp/macsyntx.c: Update errors. + * gcc.dg/cpp/macsyntx2.c: Update errors. + + libcpp/ + * internal.h (_cpp_new_macro): Declare. + (_cpp_unsave_parameters): Declare. + (_cpp_create_trad_definition): Return cpp_macro. + * macro.c (_cpp_unsave_parameters): New. + (parse_params): Take nparm & varadic ptr parms, not macro. + (create_iso_definition): Return cpp_macro. Adjust throughout. + (_cpp_new_macro): New. + (_cpp_create_definition): Adjust. + * traditional.c (scan_parameters): Take nparm ptr, not macro. + (_cpp_create_trad_definition): Return cpp_macro, adjust. + + libcpp/ + * internal.h (_cpp_save_parameter): Take parm no, not macro. + * macro,c (_cpp_save_parameter): Adjust. Invert sense of return value. + (parse_params): Adjust. + * traditional.c (scan_parameters): Likewise. + +2018-07-12 Nathan Sidwell <nathan@acm.org> + + assert body is indirect. + libcpp/ + * include/cpp-id-data.h (struct answer): Make body an external + pointer. + * directives.c (parse_answer, parse_assertion, find_answer): Use + separate base-ptr/len tuple for body. + (_cpp_test_assertion, do_assert, do_unassert): Adjust. + +2018-07-11 Nathan Sidwell <nathan@acm.org> + + Add cmk_assert structures + libcpp/ + * include/cpp-id-data.h (enum cpp_macro_kind): Add cmk_assert. + (struct cpp_macro): Place parms in union. + * macro.c (warn_of_redefinition): Adjust param field access. + (create_iso_definiton, _cpp_create_definition): Likewise. + (check_trad_stringification, cpp_macro_definition): Likewise. + * traditional.c (_cpp_replacement_text_len): Likewise. + (_cpp_copy_replacement_text, _cpp_create_trad_definition): Likewise. + gcc/c-family/ + * c-ada-spec.c (macro_length, dump_ada_macros): Adjust param field + access. + + Add cpp_macro_kind + libcpp/ + * include/cpp-id-data.h (enum cpp_macro_kind): New. + (struct cpp_macro): Replace traditional with kind. Adjust GTY. + * macro.c (create_iso_definition): Set kind. + * traditional.c (push_replacement_text): Assert trad. + (save_replacement_text): Set kind. + + Store include-from as a location, not line-map index. + libcpp/ + * include/line-map.h (line_map_ordinary): Replace included_from + index with included_at source_location. + (ORDINARY_MAP_INCLUDER_FILE_INDEX, LAST_SOURCE_LINE_LOCATION) + (LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete. + (INCUDED_FROM): Delete. + (INCLUDED_AT, linemap_included_at): New. + (MAIN_FILE_P): Adjust. + * directives.c (do_linemarker): Use linemap_included_at. + * line-map.c (include_at_map): New. + (line_check_files_exited): Use it. + (LAST_SOURCE_LINE_LOCATION): New (moved from header). + (linemap_add, linemap_dump, linemap_dump_location): Adjust. + gcc/ + * diagnostic.c (diagnostic_report_current_module): Use + linemap_included_at. Adjust line & col discovery. + gcc/c-family/ + * c-common.c (try_to_locate_new_include_insertion_point): Use + linemap_included_at. + * c-lex.c (fe_file_change): Use INCLUDED_AT. + * c-ppoutput.c (pp_file_change): Likewise. + gcc/fortran/ + * cpp.c (cb_file_change): Adjust for line map inclusion changes. + +2018-07-09 Nathan Sidwell <nathan@acm.org> + + libcpp/ + * include/line-map.h (enum lc_reason): Reformat comments. + gcc/ + * diagnostic.c (diagnostic_report_current_module): Reroll loop. + use array for prefix strings. + + Default allocator + libcpp/ + * include/line-map.h (line_maps): Document default allocator. + * line-map.c (linemap_init): Set default allocator. + (new_linemap): No need to set default here. Simplify data flow. + +2018-07-06 Nathan Sidwell <nathan@acm.org> + + Hide NT_MACRO + libcpp/ + * include/cpplib.h (cpp_macro_p): New. + * macro.c (cpp_fun_like_macro_p): Use it. + gcc/c-family/ + * c-ada-spec.c (count_ada_macro, store_ada_macro): Use + cpp_macro_p. + * c-ppoutput.c (dump_macro): Likewise. + * c-spellcheck.cc (should_suggest_as_macro_p): Likewise. + gcc/ + * config/rs6000/rs6000-c.c (rs6000_macro_to_expand): Use cpp_macro_p. + * config/powerpcspe/powerpcspe-c.c (rs6000_macro_to_expand): Likewise. + gcc/fortran/ + * cpp.c (dump_macro): Use cpp_macro_p. + + Merge trunk r262473. + + Merge trunk r260623. + +2017-11-03 Nathan Sidwell <nathan@acm.org> + + Merge trunk r254369. + +2017-11-01 Nathan Sidwell <nathan@acm.org> + + Merge trunk r254314. + + Merge trunk r254279. + +2017-10-31 Nathan Sidwell <nathan@acm.org> + + Merge trunk r254263. + + Merge trunk r254243. + +2017-10-30 Nathan Sidwell <nathan@acm.org> + + Operator code compaction part 12. + gcc/cp/ + * cp-tree.h (CPTI_CONV_OP_IDENTIFIER): Restore. + (conv_op_identifier): Revert. + * decl.c (initialize_predefined_identifiers): Restore. + (grok_op_properties): Detect conversion operators. + * decl2.c (mark_used): Dectect lambda conversion properly. + * lambda.c (maybe_add_lambda_conv_op): Not an overloaded fn. + * lex.c (init_operators): No need to deal with TYPE_EXPR. + + Merge trunk r254231. + + Operator code compaction part 11. + gcc/cp/ + * cp-tree.h (lang_decl_fn): Move spare bits to end. + (ovl_op_flags): Adjust names. + * decl.c (grokdeclarator): Use OVL_OP_FLAG_ALLOC. + (grok_op_properties): Adjust ellipsis and arg scanning. + * lex.c (init_operators): Adjust assert. + * operators.def: Adjust new & delete flags. + * pt.c (push_template_decl_real): Use OVL_OP_FLAG_ALLOC. + * typeck.c (check_return_expr): Likewise. + + Operator code compaction part 10. + gcc/cp/ + * cp-tree.h (ovl_op_flags): Adjust. + (ovl_op_alternate): Declare. + * decl.c (grokdeclarator): Adjust NEW/DEL selection. + (grok_op_properties): Move warnings to end. Don't multiply check + specific tree codes. + * lex.c (ovl_op_alternate): Define. + (init_operators): Initialize it. + * operators.def: Adjust new/delete. + * pt.c (push_template_decl_real): Likewise. + * typeck.c (check_return_expr): Likewise. + gcc/testsuite/ + * g++.dg/other/operator2.C: Adjust diagnostic. + * g++.old-deja/g++.jason/operator.C: Likewise. + +2017-10-27 Nathan Sidwell <nathan@acm.org> + + Operator code compaction part 9. + gcc/cp/ + * cp-tree.h (lang_decl_fn): Replace operator_code with smaller + ovl_op_code field. + (DECL_OVERLOADED_OPERATOR_CODE, SET_OVERLOADED_OPERATOR_CODE): Delete. + (DECL_OVERLOADED_OPERATOR_CODE_RAW): New. + (DECL_OVERLOADED_OPERATOR_IS): Adjust. + * decl.c (duplicate_decls): Open code operator copying. + (builtin_function_1): Don't set operator code. + (build_library_fn): Adjust operator code setting. + (grok_op_properties): Likewise. + * lambda.c (maybe_add_lambda_conv_op): Likewise. + * method.c (implicitly_declare_fn): Likewise. + * mangle.c (write_unqualified_name): Adjust operator name + accessor. + libcc1/ + * libcp1plugin.cc (plugin_build_decl): Adjust. + + Operator code compaction part 8. + gcc/cp/ + * cp-tree.h (CPTI_CONV_OP_IDENTIFIER): Delete. + (conv_op_identifier): Map into ovl_op_info array. + (enum cp_identifier_kind): Swap cik_conv_op & + cik_reserved_for_udlit. + (IDENTIFIER_CONV_OP_P): Adjust. + * decl.c (initialize_predefined_identifiers): Drop conv_op. + (grok_op_properties): Use IDENTIFIER_OVL_OP_INFO for all ops. + * lex.c (get_identifier_kind_name): Adjust. + (init_operators): Special case TYPE_EXPR. + * operators.def: Add TYPE_EXPR. Casts are mangling only. + + Operator code compaction part 7. + gcc/cp/ + * cp-tree.h (cp_identifier_kind): Swap cik_assign_op & + cik_reserved_for_udlit. + (IDENTIFIER_OVL_OP_P, IDENTIFIER_ASSIGN_OP_P, + IDENTIFIER_CONV_OP_P, IDENTIFIER_OVL_OP_INFO): Update. + * decl.c (ambi_op_p, unary_op_p): Delete. + (grok_op_properties): Reimplement operator lookup. + * lex.c (get_identifier_kind_name): Adjust. + * mangle.c (write_unqualified_id): Use IDENTIFIER_OVL_OP_INFO. + * operators.def (COMPONENT_REF): Is unary. + + Operator code compaction part 6. + gcc/cp/ + (enum cp_operator_kind): Delete cik_newdel_op. + (IDENTIFIER_NEWDEL_OP_P): Delete. + (IDENTIFIER_OVL_OP_P): New. + (enum ovl_op_flags): New. + (struct ovl_op_info_t): Delete kind, reorder. + (IDENTIFIER_OVL_OP_INFO, IDENTIFIER_OVL_OP_FLAGS): New. + * decl.c (grokdeclarator): Use IDENTIFIER_OVL_OP_FLAGS. + * lex.c (ovl_op_info): Adjust initialization. + (get_identifier_kind_name): Lose new-del-op. + (set_operator_ident): Return identifier. Don't set kind. + (init_operators): Set kind here. Set IDENTIFIER_CP_INDEX. + * mangle.c (write_unqualified_id): Pick first operator. + * operators.def: Adjust. + * pt.c (push_template_decl_real): Use IDENTIFIER_OVL_OP_FLAGS. + * typeck.c (check_return_expr): Likewise. + + Operator code compaction part 5. + gcc/cp/ + * cp-tree.h (ovl_op_code): Rename from overloaded_operator_code. + (ovl_op_info_t, ovl_op_info, ovl_op_mapping): Rename from + ooc_$FOO. + (operator_name_info_t, operator_name_info, + assignment_operator_name_info): Delete. + * *.c: Update all uses. + + Merge trunk r254141. + + Operator code compaction part 4. + gcc/cp/ + * cp-tree.h (cp_assignment_operator_id): Delete. + (assign_op_identifier, call_op_identifier): New. + * call.c (build_op_call_1): Use call_op_identifier. + (has_trivial_copy_assign_p): Use assign_op_identifier. + (build_special_member_call): Likewise. + * class.c (dfs_declare_virt_assop_and_dtor, + classtype_has_move_assign_or_move_ctor_p): Likewise. + * decl.c (grok_special_member_properties): Likewise. + * lambda.c (lambda_function): Use call_op_identifier. + * method.c (do_build_copy_assign): Use assign_op_identifier. + (get_copy_assign, synthesized_method_walk, + implicitly_declare_fn): Likewise. + * parser.c (cp_parser_lambda_declarator_opt): Use call_op_identifier. + * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use + assign_op_identifier. + * typeck.c (check_return_expr): Likewise. + +2017-10-26 Nathan Sidwell <nathan@acm.org> + + Operator code compaction part 3. + gcc/cp + * cp-tree.h (cp_operator_id): Delete. + (ovl_op_identifier): Define. + (OOC_INFO): Define. + * call.c (build_op_call_1): Use ovl_op_identifier. + (op_error): Use OOC_INFO. + (build_conditional_expr_1): Use ovl_op_identifier. + (build_new_op_1): Likewise. + (build_op_delete_call): Likewise. + * class.c (type_requires_array_cookie): Likewise. + * decl.c (push_cp_library_fn): Likewise. + * decl2.c (maybe_warn_sized_delete): Likewise. + * error.c (dump_expr): Use OOC_INFO. + (parm_to_string): Use ovl_op_identifier. + * init.c (build_new_1): Likewise. + * lambda.c (lambda_function): Likewise. + * lex.c (unqualified_name_lookup_error): Don't check ERROR_MARK. + * mangle.c (write_unqualified_name): Use OOC_INFO. + (write_expression): Likewise. + * method.c (synthesized_method_walk): Use ovl_op_identifier. + * parser.c (cp_parser_lambda_declarator_opt): Likewise. + (cp_parser_operator): Likewise. + (cp_parser_omp_clause_reduction): Likewise. + * semantics.c (omp_reduction_id): Likewise. + * typeck.c (cxx_sizeof_or_alignof_type): Use OOC_INFO. + libcc1/ + * libcp1plugin.cc (plugin_build_decl): Use ovl_op_identifier. + (plugin_build_dependent_expr): Likewise. + + Operator code compaction part 2. + gcc/cp/ + * cp-tree.h (IDENTIFIER_CP_INDEX): New. + * call.c (op_error): Use ooc_info. + (build_new_op_1): Likewise. + (build_op_delete_call): Likewise. + * error.c (assop_to_string): Delete. + (op_to_string): Add assop arg. Use ooc_info. + (dump_expr): Use ooc_info. + (cp_printer): Adjust. + * mangle.c (write_unqualified_name): Use ooc_info. + * typeck.c (cxx_sizeof_or_alignof_type): Likewise. + +2017-10-25 Nathan Sidwell <nathan@acm.org> + + Operator code compaction part 1. + gcc/cp/ + * cp-tree.h (enum overloaded_operator_codes): New. + (struct ooc_info_t): New. + (OOC_OPERATORS, OOC_ASSIGNMENTS): New. + (ooc_info, ooc_mapping): Declare. + * decl.c (grok_op_properties): Use ooc_info. + * lex.c (ooc_info, ooc_mapping): Define. + (set_operator_ident): New. + (init_operators): Initialize ooc_info, ooc_mapping. + * mangle.c (write_unqualified_id): Use ooc_info. + (write_expression): Use ooc_mapping and ooc_info. + * operators.def: Conditionally define DEF_ASSN_OPERATOR. Move + assignment ops later. Invoke OPERATOR_TRANSITION. + + Merge trunk r254084. + + Kill IDENTIFIER_LABEL_VALUE. + gcc/cp/ + * cp-tree.h (lang_identifier): Delete label_value slot. + (IDENTIFIER_LABEL_VALUE, SET_IDENTIFIER_LABEL_VALUE): Delete. + (struct named_label_hasher): Rename to ... + (struct named_label_hash): ... here. Reimplement. + (struct language_function): Adjust x_named_labels. + (lookup_label): Declare here too. + * decl.c (struct named_label_entry): Add name and outer slots. + (pop_label): Rename to ... + (check_label_used): ... here. Don't pop. + (note_label, sort_labels): Delete. + (pop_labels, pop_local_label): Reimplement. + (poplevel): Pop local labels as any other decl. Remove + shadowed_labels handling. + (named_label_hash::hash, named_label_hash::equal): New. + (make_label_decl): Absorb into ... + (lookup_label_1): ... here. Add making_local_p arg, reimplement. + (lookup_label, declare_local_label): Adjust. + (identify_goto, check_previous_goto, check_goto): Adjust. + (check_omp_return, define_label_1, define_label): Adjust. + * lex.c (make_conv_op_name): Don't clear IDENTIFIER_LABEL_VALUE. + * name-lookup.h (struct cp_label_binding): Delete. + (struct cp_binding_level): Delete shadowed_labels slot. + * ptree.c (cxx_print_identifier): Don't print identifier binding. + +2017-10-20 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * class.c (layout_class_type): Cleanup as-base creation, determine + mode here. + (finish_struct_1): ... not here. + +2017-10-19 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * cp-tree.h (LAMBDA_FUNCTION_P): Use + DECL_OVERLOADED_OPERATOR_IS. + (DECL_OVERLOADED_OPERATOR_P): Just be a predicate. + (DECL_VERLOADED_OPERATOR_IS): New. + (DECL_OVERLOADED_OPERAT_CODE): New. + * call.c (add_function_candidate): Use + DECL_OVERLOADED_OPERATOR_IS. + (build_op_call_1, build_over_call): Likewise. + * decl.c (duplicate_decls): Adjust DECL_OVERLOADED_OPERATOR_P, + USE_DECL_OVERLOADED_OPERATOR_CODE. + (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS. + * decl2.c (mark_used): Likwise. + * dump.c (dump_op): Delete. + (cp_dump_tree): Don't call it. + * mangle.c (wite_unqualified_name): Use + DECL_OVERLOADED_OPERATOR_CODE. + * method.c (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS. + (defaultable_fn_check): LIkewise. + * tree.c (special_function_p): Likewise. + * typeck.c (check_return_expr): Use IDENTIFIER_NEWDEL_OP_P. + + gcc/cp/ + * lex.c (get_identifier_kind_name): Fix names. + (init_operators): Nuke extraneous operators. + * operators.def (DEF_OPERATOR): Fix documentation. + (DEF_ASSN_OPERATOR): Lose ARITY. + (DEF_SIMPLE_OPERATOR, DEF_ASSN_OPERATOR): Undef at end. + +2017-10-17 Nathan Sidwell <nathan@acm.org> + + Merge trunk r253836. + + gcc/cp/ + * name-lookup.c (get_member_vec_index): New. Broken out of ... + (member_vec_binary_search): ... here. Use it. + (member_vec_linear_search): Delete. + (fields_linear_search, get_class_binding_direct): Adjust. + (get_member_slot): Use get_member_vec_index, reorganize. + +2017-10-13 Nathan Sidwell <nathan@acm.org> + + Merge trunk r253733 + + gcc/ + * tree.c (tree_code_size): Reformat. Punt to lang hook for unknown + TYPE nodes. + gcc/cp/ + * cp-objcp-common.c (cp_tree_size): Reformat. Adjust returns size + of TYPE nodes. + * cp-tree.h (PACK_EXPANSION_PATTERN): Correct formatting. + gcc/objc/ + * objc-act.c (objc_common_tree_size): Return size of TYPE nodes. + + Merge trunk r253723. + +2017-10-11 Nathan Sidwell <nathan@acm.org> + + Merge trunk r253649. + + gcc/ + * incpath.h (enum incpath_e): Name enum, prefix values. + (add_path, add_cpp_dir_path, get_added_cpp_dirs): Use incpath_e type. + * incpath.c (heads, tails): Use INC_MAX. + (add_env_var_paths, add_standard_paths): Use incpath_e type. + (merge_include_chains, split_quote_chain, + register_include_chains): Update incpath_e names. + (add_cpp_dir_path, add_path, get_added_cpp_dirs): Use incpath_e type. + * config/darwin-c.c (add_system_framework_path): Update incpath_e + names. + (add_framework_path, darwin_register_objc_includes ): Likewise. + * config/vms/vms-c.c (vms_c_register_includes): Likewise. + + gcc/fortran/ + * cpp.c (gfc_cpp_add_include_path): Update incpath_e names. + (gfc_cpp_add_include_path_after): Likewise. + + gcc/c-family/ + * c-opts.c (add_prefixed_path): Change chain to incpath_e type. + (c_common_handle_option): Update incpath_e names. + + Merge trunk r253623 + +2017-10-10 Nathan Sidwell <nathan@acm.org> + + Merge trunk r253619. + +2017-10-06 Nathan Sidwell <nathan@acm.org> + + Merge trunk r253485. + + gcc/cp/ + * cp-tree.h (struct default_hash_traits <lang_identifier *>): + Delete specialization. + +2017-10-05 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * name-lookup.c (extern_c_fns): Use hash_table<named_decl_hash>. + (check_extern_c_conflict, c_linkage_bindings): Adjust. + + gcc/cp/ + * cp-tree.h (struct named_decl_hash): New. + (lang_decl_ns): Change type of bindings field. + * lex.c (maybe_add_lang_decl_raw): Adjust. + * name-lookup.c (find_namespace_slot): Adjust. + + gcc/cp/ + * decl2.c (struct mangled_decl_hash): New. + (mangled_decls): Use a hash_table, not map. + (generate_mangled_alias, record_mangling): Adjust. + gcc/ + * tree.h (DECL_ASSEBLER_NAME_RAW): New. + (DECL_ASSEBLER_NAME_SET_P, SET_DECL_ASSEMBLER_NAME): Use it. + + gcc/cp/ + * name-lookup.c (set_global_binding): No need for stat_hack. + + Merge trunk r253446. + + gcc/cp/ + Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE + * cp-tree.h (IDENTIFIER_GLOBAL_VALUE, + SET_IDENTIFIER_GLOBAL_VALUE): Delete. + * name-lookup.h (set_global_binding): Remove NAME parm. + (get_global_binding): New inline fn. + * name-lookup.c (identifier_global_value): Use get_global_binding. + (set_global_binding): Adjust arg name. + * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust. + * decl.c (record_builtin_type, expand_static_init, + grokdeclarator): Adjust. + * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn, + get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust. + * except.c (declare_library_fn, build_throw): Adjust. + * init.c (throw_bad_array_length): Adjust. + * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust. + +2017-10-04 Nathan Sidwell <nathan@acm.org> + + Merge trunk r253413. + + gcc/cp/ + * cp-tree.h (SET_IDENTIFIER_GLOBAL_VALUE): Drop NAME arg. + * decl.c (record_builtin_type): Adjust SET_IDENTIFIER_GLOBAL_VALUE. + * decl2.c (get_local_tls_init_fn, get_tls_init_fn): Likewise. + * name-lookup.c (set_global_binding): Drop NAME arg. + * name-lookup.h (set_global_binding): Drop NAME arg. + + gcc/cp/ + * decl.c (record_builtin_type): Reimplement. Push decls with + matching name. + + gcc/cp/ + * cp-tree.h (record_mangling): Adjust arg types. + * decl2.c (mangled_decls): New hash_map. + (generate_mangling_alias): Use mangled_decls, not + IDENTFIFIER_GLOBAL_VALUE. + (decl_implicit_alias_p): Delete. + (record_mangling): Use mangled_decls, not + IDENTIFIER_GLOBAL_VALUE. Diagnose conflict here. + * mangle.c (mangle_decl): Adjust record_mangling call. Don't + diagnose here. + * name-lookup.c (set_global_binding): Remove temporary hack. + gcc/testsuite/ + * g++.dg/abi/mangle41.C: Adjust diags. + libcc1/ + * libcp1plugin.cc (supplement_binding): Don't call + maybe_remove_implicit_alias. + +2017-10-03 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * cp-tree.h (record_mangling): Declare. + (maybe_remove_implicit_alias): Delete. + * mangle.c (maybe_remove_implicit_alias): Delete. + (mangle_decl): Use record_mangling. + (decl_implicit_alias_p): Move to ... + * decl2.c (decl_implicit_alias_p): ... here. + (record_mangling): New. + * name-lookup.c (supplement_binding_1): Delete implicit_alias + handling. + (set_global_binding): Allow zapping a slot, for now. + +2017-09-13 Nathan Sidwell <nathan@acm.org> + + Merge trunk r252087. + +2017-09-06 Nathan Sidwell <nathan@acm.org> + + Merge trunk r251808. + + Merge trunk r251780. + +2017-09-05 Nathan Sidwell <nathan@acm.org> + + Merge trunk r251721. + + gcc/cp/ + * cp-tree.h (DECL_TEMPLATE_CONV_FN_P): Delete. + * pt.c (push_template_decl_real): Don't set it. + + gcc/cp/ + * cp-tree.h (DECL_CONV_FN_P): No need to check DECL_NAME nullness. + (DECL_CONV_FN_TYPE): FN must be a conv op. + + gcc/cp/ + * class.c (add_method): Move conv_op marker handling to ... + * name-lookup.c (find_method_slot): ... here. + + gcc/cp/ + * name-lookup.h (get_class_binding_direct, get_class_binding): + Merge want_type and restricted args. + * name-lookup.c (get_class_binding_direct): Merge want_type and + restricted args. Adjust. + (get_class_binding): Adjust for argument merge. + * decl.c (reshape_init_class): Adjust get_class_binding call. + * search.c (lookup_field_r): Adjust get_class_binding call. + + Kill CLASSTYPE_SORTED_FIELDS + gcc/cp/ + * cp-tree.h (struct lang_type): Delete sorted_fields. + (CLASSTYPE_SORTED_FIELDS): Delete. + gcc/c-family/ + * c-common.c (field_decl_cmp, resort_data, + resort_field_decl_cmp, resort_sorted_fields): Move ... + * c-common.h (field_decl_cmp, resort_sorted_fields): ... and ... + (struct sorted_fields_type): ... and to ... + gcc/c/ + * c-decl.c (field_decl_cmp, resort_data, + resort_field_decl_cmp, resort_sorted_fields): Here and ... + * c-lang.h (struct sorted_fields_type): here.. + + Merge TYPE_FIELDS to METHOD_VEC + gcc/cp/ + * name-lookup.c (method_vec_binary_search, + method_vec_linear_search): New. Broken out of ... + (legacy_fn_member_lookup): ... here. Delete. + (fields_linear_search): New. Broken out of ... + (legacy_nonfn_member_lookup): ... here. Delete. + (find_method_slot): Call set_class_bindings if adding method_vec + to completed class. + (get_class_binding_direct): Use new searching functions. + (method-name_cmp): Order identically named decls. + (resort_method_name_cmp): Adjust. + (sorted_fields_type_new): Delete. + (count_fields): Rename to ... + (count_class_fields): ... here. Take RECORD_TYPE and adjust. + (add_fields_to_record_type): Rename to ... + (method_vec_append_class_fields): ... here. Take RECORD_TYPE and + adjust. + (add_enum_fields_to_record_type): Rename to ... + (method_vec_append_enum_values): ... here. Adjust. + (method_vec_dedup): New. + (set_class_bindings): Reimplement. + (insert_late_enum_def_bindings): Reimplement. + * name-lookup.h (lookup_field_1, lookup_fnfields_slot, + lookup_fnfields_slot_nolazy): Delete. + (get_class_binding_direct, get_class_binding, find_method_slot): Move. + (set_class_bindings): Add EXTRA parm. + * class.c (warn_hidden): Cope with non-functions. + * decl.c (cxx_init_decl_processing): Make conv-op marker function + not so bogusly typed. + +2017-09-01 Nathan Sidwell <nathan@acm.org> + + Merge trunk r251609. + + gcc/cp/ + * class.c (warn_hidden): Clean up. + (clone_constructors_and_destructors): No need to check METHOD_VEC. + (type_has_user_provided_constructor): Likewise. + (type_has_user_provided_or_explicit_constructor): Likewise. + (classtype_has_move_assign_or_move_ctor_p): Likewise. + (finish_struct): Adjust comment. + + gcc/cp/ + * cp-tree.h (resort_type_method_vec): Move declaration to ... + * name-lookup.h (resort_type_method_vec): ... here. + * class.c (finish_struct_1, finish_struct): Adjust + set_class_bindings call. Don't call finish_struct_methods. + (resort_data, method_name_cmp, resort_method_name_cmp, + resort_type_method_vec, finish_struct_methods): Move to ... + * name-lookup.c (resort_data, method_name_cmp, + resort_method_name_cmp, resort_type_method_vec): ... here. + (set_class_bindings): Lose fields arg. Swallow finish_struct_methods. + + Merge trunk r251592. + + gcc/cp/ + * class.c (finish_struct): Also call set_class_bindings in + template case. + +2017-08-31 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * class.c (finish_struct_1): Move finish_struct_methods and + set_class_bindings to just after layout. + (finish_struct): Process using_decls before setting template + pseudo-size. Call finish_struct_methods immediately after. + + gcc/cp/ + * class.c (finish_struct_methods): Don't warn about private bases + here. + (finish_struct_1): Move set_class_bindings as late as possible. + (finish_struct): Warn about overly private bases after completing + the type. + + gcc/cp/ + * class.c (finish_struct_methods): Move DECL_IN_AGGR_P frobbing to + finish_struct_1. + (check_bases_and_members): Move finish_struct_methods to ... + (finish_struct_1): ... here. Frob DECL_IN_AGGR_P. + (unreverse_member_declarations): Remove unneeded if. + * method.c (lazily_declare_fn): Adjust comment. + * pt.c (do_class_deduction): No need to check CLASSTYPE_METHOD_VEC. + * tree.c (type_has_nontrivial_copy_init): Likewise. + + gcc/cp/ + * class.c (add_method): Use find_method_slot. + * name-lookup.h (find_method_slot): Declare. + * name-lookup.c (legacy_fn_member_lookup): Allow NULL slot in + incomplete type. + (find_method_slot): Use. + * decl.c (grok_special_member_properties): Check conv-op here. + + Restore get_class_binding name. + gcc/cp/ + * name-lookup.c (get_class_value, get_class_value_direct): Rename + to ... + (get_class_binding, get_class_binding_direct): ... here. + * name-lookup.h (get_class_value, get_class_value_direct): Rename + to ... + (get_class_binding, get_class_binding_direct): ... here. + * call.c (builduser_type_conersion_1): Rename calls. + (has_trivial_copy_assign_p, has_trvial_copy_p): Likewise. + * class.c (vbase_has_user_provided_move_assign, + classtype_has_move_assign_or_move_ctor_p, type_build_ctor_call, + type_build_dtor_call): Likewise. + * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Likewise. + * decl.c (reshape_init_class, register_dtor_fn): Likewise. + * decl2.c (check_classfn): Likewise. + * pt.c (retrieve_specialization, + check_explicit_specialization): Likewise. + * search.c (lookup_field_r, look_for_overrides_here, + lookup_conversions_r): Likewise. + * semantics.c (classtype_has_nothrow_assign_or_copy_p): Likewise. + + gcc/cp/ + * name-lookup.c (insert_late_enum_def_bindings): Swap args. + * decl.c (finish_enum_value_list): Adjust + insert_late_enum_def_bindings call. + + Restore lang_type::sorted_fields + gcc/c/ + * c-decl.c (field_decl_cmp, resort_data, + resort_field_decl_cmp, resort_sorted_fields): Moved back to ... + * c-lang.h (struct sorted_fields_type): ... + gcc/c-family + * c-common.c (field_decl_cmp, resort_data, + resort_field_decl_cmp, resort_sorted_fields): ... here ... + * c-common.h (field_decl_cmp, resort_sorted_fields): ... here ... + (struct sorted_fields_type): ... here. + gcc/cp/ + * cp-tree.h (struct lang_type): Restore sorted_fields. + (CLASSTYPE_SORTED_FIELDS): Restore. + (CLASSTYPE_BINDINGS): Delete. + * decl.c (finish_enum_value_list): Adjust + insert_late_enum_def_bindings call. + * name-lookup.c (legacy_nonfn_member_lookup): Restore binary + search. + (get_class_value_direct): Remove binding table code. + (sorted_fields_type_new, count_fields, + add_fields_to_record_type, add_enum_fields_to_record_type): Restore. + (add_class_member, add_class_members): Delete. + (set_class_bindings, insert_late_enum_def_bindings): Adjust. + + Merge trunk r251560. + +2017-08-29 Nathan Sidwell <nathan@acm.org> + + Anonymous namespace has NULL name + gcc/cp/ + * cp-tree.h (default_hash_traits <lang_identifier *>): Permit + NULL. + * name-lookup.c (do_pushdecl): Push NULL-named namespace. + (do_push_nested_namespace): Adjust. + (push_namespace): Push anonymous namespace as NULL name. + +2017-08-28 Nathan Sidwell <nathan@acm.org> + + Merge trunk r251385. + + gcc/cp/ + * name-lookup.c (do_class_using_decl): Simplify. + +2017-08-25 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * name-lookup.h (lookup_class_member): Delete. + * name-lookup.c (lookup_class_member): Merge into ... + (get_class_value): ... here. + (legacy_nonfn_member_lookup): Don't call it. + + Merge trunk r251351. + +2017-08-24 Nathan Sidwell <nathan@acm.org> + + Rename get_class_binding -> get_class_value + * name-lookup.c (get_class_binding, get_class_binding_direct): Rename + to ... + (get_class_value, get_class_value_direct): ... here. + * name-lookup.h (get_class_binding, get_class_binding_direct): Rename + to ... + (get_class_value, get_class_value_direct): ... here. + * call.c (builduser_type_conersion_1): Rename calls. + (has_trivial_copy_assign_p, has_trvial_copy_p): Likewise. + * class.c (vbase_has_user_provided_move_assign, + classtype_has_move_assign_or_move_ctor_p, type_build_ctor_call, + type_build_dtor_call): Likewise. + * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Likewise. + * decl.c (reshape_init_class, register_dtor_fn): Likewise. + * decl2.c (check_classfn): Likewise. + * pt.c (retrieve_specialization, + check_explicit_specialization): Likewise. + * searh.c (lookup_field_r, look_for_overrides_here, + lookup_conversions_r): Likewise. + * semantics.c (classtype_has_nothrow_assign_or_copy_p): Likewise. + +2017-08-23 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * name-lookup.c (extract_conversion_operator, + legacy_fn_member_lookup, legacy_nonfn_member_lookup, + get_class_binding_direct, get_class_binding, lookup_class_member, + add_class_member, add_class_members, set_class_bindings, + insert_late_enum_def_bindings): Move earlier to match trunk. + + Merge trunk r251313. + + gcc/cp/ + * name-lookup.h (get_class_binding_direct, get_class_binding): Add + temporary restricted parm. + * name-lookup.c (get_class_binding_direct): Replace fn_only with + restricted. + (get_class_binding): Adjust. + * decl.c (reshape_init_class): get_class_binding is differently + restricted. + * search.c (lookup_field_r): get_class_binding is not restricted. + gcc/testsuite/ + * g++.dg/cpp0x/decltype9.C: Revert, not ready yet. + + gcc/cp/ + * semantics.c (finish_member_declaration): Move USING_DECL check. + Always set lang_cplusplus. Commonize decl linking. + +2017-08-22 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * name-lookup.c (legacy_fn_member_lookup): Move conv_op processing + to get_class_binding_direct. + (legacy_nonfn_member_lookup): Move asserts to + get_class_binding_direct. + (get_class_binding_direct): Abosorb asserts and conv_op processing. + + gcc/cp/ + * cp-tree.h (print_search_statistics, + reinit_search_statistics): Delete. + * tree.c (cxx_print_statistics): Don't print search stats. + * search.c (n_fields_searched, n_calls_lookup_field, + n_calls_lookup_field_1, n_calls_lookup_fnfields, + n_calls_lookup_fnfields_1, n_calls_get_base_type, + n_outer_fields_searched, n_contexts_saved): Delete. + (lookup_member): Delete stats. + (print_search_statistics, reinit_search_statistics): Delete. + + Merge trunk r251283. + + gcc/cp/ + * cp-tree.h (lookup_field_1, lookup_fnfields_slot_nolazy): Delete. + * name-lookup.h (lookup_all_conversions): Delete. + * decl2.c (check_classfn): Lookup conversions directly. + * pt.c (check_explicit_specialization): Likewise. + * search.c (lookup_conversion_operator, + lookup_fnfields_slot_nolazy, lookup_field_1): Move to ... + * name-lookup.c (extract_conversion_operator, + legacy_fn_member_lookup, legacy_nonfn_member_lookup): ... here. + Make static. + (get_class_binding_direct): Adjust. + (lookup_all_conversions): Delete. + + gcc/cp/ + * cp-tree.h (lookup_fnfields_slot): Delete. + * search.c (lookup_fnfields_slot): Delete. + (look_for_overrides_here): Use get_class_binding. + * call.c (build_user_type_conversion_1): Likewise. + (has_trivial_copy_assign_p, has_trivial_copy_p): Likewise. + * class.c (get_basefndecls, type_build_ctor_call, + type_build_dtor_call): Likewise. + * decl.c (register_dtor_fn): Likewise. + * decl2.c (check_classfn): Likewise. + * pt.c (retrieve_specialization, + check_explicit_specialization): Likewise. + * semantics.c (classtype_has_nothrow_assign_or_copy_p): Likewise. + + gcc/cp/ + * name-lookup.h (get_class_binding_direct): Declare. + (get_class_binding): Adjust. + * name-lookup.c (get_class_binding_direct): New. + (get_class_binding): Adjust. + * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Use + get_class_binding_direct. + * class.c (vbase_has_user_provided_move_assign): Likewise. + (classtype_has_move_assign_or_move_ctor_p): Likewise. + * decl2.c (check_classfn): Skip non-functions. + * search.c (lookup_fnfields_slot): Forward to get_class_binding. + (lookup_conversions_r): Use get_class_binding_direct. + gcc/testsuite/ + * g++.dg/cpp0x/decltype9.C: Adjust messages. + +2017-08-21 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * decl.c (reshape_init_class): Use get_class_binding. + * name-lookup.c (get_class_binding): New. + * name-lookup.h (get_class_binding): Declare. + * search.c (lookup_field_r): Use get_class_binding. + + gcc/cp/ + * search.c (lookup_field_r): Remove obsolete code for type-named + field in PoD. + + Merge trunk r251241. + + gcc/cp/ + * search.c (lookup_field_1) : Assert TYPE is a class. Assert + vfield is not special. + (lookup_field_fuzzy_info::fuzzy_lookup_fnfields): Delete. + (lookup_field_fuzzy_r): Adjust. + +2017-08-17 Nathan Sidwell <nathan@acm.org> + + Merge trunk r251159. + +2017-07-27 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * cp-tree.h (maybe_version_functions): Declare. + * decl.c (maybe_version_functions): New. Broken out of ... + (decls_match): ... here. Call it. + * class.c (add_method): Add asserts, use maybe_version_functions. + + Add conversion marker fn. + gcc/cp/ + * cp-tree.h (CPTI_CONV_OP_MARKER, conv_op_marker): New. + * decl.c (initialize_predefined_identifiers): conv_op is conv_op. + (cxx_init_decl_processing): Create conv_op_marker. + * class.c (add_method): Compare identifiers. Insert + conv_op_marker for conv op overloads. + (method_name_cmp, resort_method_name): Compare identifiers. + * lex.c (make_conv_op_name): No need to set identifier kind. + * search.c (lookup_fnfields_slot_nolazy): Compare identifiers, + deal with conv_op_marker. + +2017-07-21 Nathan Sidwell <nathan@acm.org> + + Merge trunk r250440. + + Merge trunk r250437. + + gcc/ + * dbxout.c: Restore from trunk. + + Merge trunk r250426. + + Conv ops are regular METHODVEC fns. + gcc/cp/ + * cp-tree.h (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete. + * class (add-method): Treat conv ops as regular fns. + (resort_type_method_vec, finish_struct_methods, warn_hidden) No + need to skip conversion ops. + * decl.c (initialize_predefined_identifiers): Naked + conv_op_identifier is not a conv op. + * lex.c (make_conv_op_name): Set identifier kind. + * name-lookup.c (lookup_all_conversions): Use + lookup_fnfields_slot_nolazy. + * search.c (lookup_conversion_operator): Process passed in + overload set. + (lookup_fnfields_slot_nolazy): Don't skip conversion ops. Process + conversions after lookup. + (lookup_conversions_r): Use lookup_fnfields_slot_nolazy. + +2017-07-20 Nathan Sidwell <nathan@acm.org> + + Merge trunk r250413. + + Method vec sorted by identifier pointer (not conv ops) + gcc/cp/ + * class.c (add_method): Use IDENTIFIER_POINTER. + (method_name_cmp, resort_method_name_cmp): Likewise. DECL_NAME can + never be NULL. + * search.c (lookup_fnfields_slot_nolazy): Use IDENTIFIER_POINTER. + + Conv op names all same. + gcc/cp/ + * cp-tree.h (CPTI_CONV_OP_IDENTIFIER): New. + (conv_op_identifier): New. + * decl.c (initialize_predefined_identifiers): Add it. + * lex.c (make_conv_op_name): Names are not in the symbol table. + + All conv ops on one slot. + gcc/cp/ + * class.c (add_method): Put conversion ops on a single slot. + * name-lookup.c (lookup_all_conversions): Only examine single + slot. + * search.c (lookup_conversion_operator): Examine single slot in + detail to pull out requested conversions. + (lookup_conversions_r): Lose tmp/non-tmpl distinction. All ops on + one slot. + (lookup_conversions): Likewise. + + gcc/cp/ + * call.c (add_candidates): Move decls to initialization. Don't + use !!. + + Merge trunk r250380. + +2017-07-19 Nathan Sidwell <nathan@acm.org> + + Merge trunk r250344. + +2017-07-18 Nathan Sidwell <nathan@acm.org> + + gcc/cp/ + * search.c (lookup_conversion_operator): Return overloads not + index. + (lookup_fnfields_idx_nolazy): Absorb into ... + (lookup_fnfields_slot_nolazy): ... this. + (lookup_fnfields_1): Absorb into ... + (lookup_fnfields_slot): ... this. + + Merge trunk r250313. + + Rename TYPE_{MIN,MAX}VAL to TYPE_{MIN,MAX}VAL_RAW. + gcc/c/ + * c-parser.c (c_parser_array_notation): Use TYPE_{MIN,MAX}_VALUE. + gcc/c-family/ + * c-warn.c (warn_for_memset): Use TYPE_{MIN,MAX}_VALUE. + gcc/cp/ + * cp-array-notation.c (build_array_notation_ref): Use + TYPE_{MIN,MAX}_VALUE. + * cp-tree.h (PACK_EXPANSION_PARAMETER_PACKS, + PACK_EXPANSION_EXTRA_ARGS): Use TYPE_{MIN,MAX}VAL_RAW. + fortran/ + * trans.c (gfc_build_array_ref): Use TYPE_{MIN,MAX}_VALUE. + lto/ + * lto.c (mentions_vars_p_type): Use TYPE_{MIN,MAX}VAL_RAW. + (compare_tree_sccs_1): Likewise. Don't check BINFO directly. + (lto_fixup_prevailing_decls): Use TYPE_{MIN,MAX}VAL_RAW. + gcc/ + * tree.h (TYPE_MINVAL, TYPE_MAXVAL): Rename to ... + (TYPE_MINVAL_RAW, TYPE_MAXVAL_RAW): ... these. + * lto-streamer-out.c (DFS::DFS_write_tree_body): Use + TYPE_{MIN,MAX}VAL_RAW. Don't process BINFO directly. + (hash_tree): Likewise. + * tree-parloops.c (try_transform_to_exit_first_loop_alt): Use + TYPE_MAX_VALUE. + * tree-streamer-in.c (lto_input_ts_type_non_common_tree_pointers): + Use TYPE_{MIN,MAX}VAL_RAW. Don't process BINFO directly. + * tree-streamer-out.c (write_ts_type_non_common_tree_pointers): + Likewise. + * tree.c (free_lang_data_in_type): Use switch, cleanup. + (find_decls_types_r): Use TYPE_{MIN,MAX}VAL_RAW. Don't process + BINFO directly. + (verify_type): Use TYPE_{MIN,MAX}VAL_RAW. Move BINFO checking + into RECORD check. + objc/ + * objc-act.h (CLASS_NST_METHODS, CLASS_CLS_METHODS): Use + TYPE_{MIN,MAX}VAL_RAW. + +2017-07-17 Nathan Sidwell <nathan@acm.org> + + Remove special ctor/dtor slots + gcc/cp/ + * cp-tree.h (CLASSTYPE_CONSTRUCTOR_SLOT, + CLASSTYPE_DESTRUCTOR_SLOT): Delete. + (CLASSTYPE_FIRST_CONVERSION_SLOT): Set to zero. + * class.c (add_method): cdtors do not have specia slots. + * search.c (lookup_fnfields_idx_nolazy): Likewise. + (look_for_overrides_here): Use lookup_fnfields_slot. + + Replace lang_type::sorted_fields with lang_type::bindings. + (from c++modules branch) + gcc/cp/ + * cp-tree.h (struct lang_type): Replace sorted_fields with + bindings map. + (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Use + lookup_fnfields_slot_nolazy. + (CLASSTYPE_SORTED_FIELDS): Replace with ... + (CLASSTYPE_BINDINGS): ... this. + (type_has_user_declared_move_constructor, + type_has_user_declared_move_assign): Delete, replace with: + (classtype_has_user_move_assign_or_ctor_p): ... this. + (insert_late_enum_def_into_classtype_sorted_fields): Delete. + (lookup_all_conversions): Delete. + * decl.c (finish_enum_value_list): Use + insert_late_enum_def_bindings. + * method.c (maybe_explain_implicit_delete): Use + classtype_has_user_move_assign_or_ctor_p. + (lazily_declare_fn): Likewise. + * class.c (maybe_warn_about_overly_private_class): Ignore + copy/move ctors. + (type_has_user_declared_move_constructor, + type_has_user_declared_move_assign): Delete, replace with: + (classtype_has_user_move_assign_or_ctor_p): ... this. + (count_fields, add_fields_to_record_type, + add_enum_fields_to_record_type, sorted_fields_type_new, + create_classtype_sorted_fields, + insert_late_enum_def_into_classtype_sorted_fields): Move to ... + * name-lookup.c: ... here. + (add_class_member, add_class_members, set_class_bindings): New. + (lookup_class_member): New. Broken out of ... + * search.c (lookup_field_1): ... here. Call it. + (lookup_fnfields_idx_nolazy): Look directly at method_vec. + (lookup_fnfields_slot_nolazy): Don't complete the type. + (lookup_all_conversions): Move to name-lookup.c + * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use + lookup_fnfields_slot always. + * tree.c (type_has_nontrivial_copy_init): Use + classtype_has_user_move_assign_or_ctor_p. + * name-lookup.h (lookup_class_member, + set_class_bindings, insert_late_enum_def_binsings, + lookup_all_conversions): Declare. + * pt.c (check_explicit_specialization): Use lookup_fnfields_slot. + * ptree.c (cxx_print_type): Delete sorted-fields. + gcc/c-family/ + * c-common.h (field_decl_cmp, resort_sorted_fields): Delete. + (struct sorted_fields_type): Move to c-lang.h. + * c-common.c (field_decl_cmp, resort_data, + resort_field_decl_cmp): Move to c-decl.c. + * c-ada-spec.c (decl_sloc): Ignore builtin fields. + gcc/c/ + * c-decl.c (field_decl_cmp, resort_data, + resort_field_decl_cmp): Moved from c-common.c + * c-lang.h (struct sorted_fields_type): Moved from c-common.h. + +2017-07-12 Nathan Sidwell <nathan@acm.org> + + gcc/ + * tree-core.h (struct tree_type_non_common): Rename binfo to + lang_1. + * tree.h (TYPE_BINFO): Move to maxval field. + (TYPE_LANG_SLOT_1): Allow any type. + gcc/lto/ + * lto.c (mentions_vars_p_type, lto_fixup_prevailing_decls): Use + TYPE_LANG_SLOT_1, not binfo. + +2017-07-11 Nathan Sidwell <nathan@acm.org> + + gcc/ + * tree.h (TYPE_METHODS): Delete. + * tree.c (free_lang_data_in_type): Stitch out member functions and + templates from TYPE_FIELDS. + (build_distinct_type_copy, verify_type_variant, + verify_type): Member fns are on TYPE_FIELDS. + * tree-dump.c (dequeue_and_dump): No TYPE_METHODS. + * tree-pretty-print.c (dump_generic_node): Likewise. + * dbxout.c (dbxout_type_fields): Member fns are on TYPE_FIELDS. + (dbxout_type_method_1, dbxout_type_methods): Delete. + (dbxout_type_fn_member): New, constructed from previous. + (dbxout_type): No TYPE_METHODS scan. + * dwarf2out.c (gen_member_die): Member fns are on TYPE_FIELDS. + * function.c (use_register_for_decl): Always ignore register for + class types when not optimizing. + * ipa-devirt.c (odr_types_equivalent_p): Delete TYPE_METHODS scan. + gcc/c-family/ + * c-ada-spec.c (is_tagged_type, has_nontrivial_methods, + dump_ada_template, print_ada_methods, + print_ada_declaration): Member fns are on TYPE_FIELDS. + gcc/cp/ + * class.c (maybe_warn_about_overly_private_class, + finish_struct_methods, one_inheriting_sig, count_fields, + add_fields_to_record_type, check_field_decls, check_methods, + clone_function_decl, set_method_tm_attributes, + finalize_literal_type_property, check_bases_and_members, + create_vtable_ptr, determine_key_method, + unreverse_member_declarations, finish_struct, + add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS. + * decl.c (fixup_anonymous_aggr): Likewise. + * decl2.c (reset_type_linkage_2): Likewise. + * method.c (after_nsdmi_defaulted_late_checks, + lazily_declare_fn): Likewise. + * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. + * pt.c (instantiate_class_template_1, tsubst_expr, + do_type_instantiation, instantiate_pending_templates): Likewise. + * search.c (lookup_field_1): Likewise. + * semantics.c (finish_member_declaration, + finish_omp_declare_simd_methods): Likewise. + gcc/objc/ + * objc-runtime-shared-support.c (build_ivar_list_initializer): + Don't presume first item is a FIELD_DECL. + libcc1/ + * libcp1plugin.cc (plugin_build_decl): Member fns are on TYPE_FIELDS. + gcc/testsuite/ + * g++.dg/ext/anon-struct6.C: Adjust diag. + * g++.old-deja/g++.other/anon4.C: Adjust diag. + + gcc/cp/ + * decl2.c (mark_used): Reformat. + * pt.c (instantiate_class_member): Delete. + +2017-07-05 Nathan Sidwell <nathan@acm.org> + + gcc/ + * tree.h (TYPE_METHODS): Delete. + * tree.c (free_lang_data_in_type): Stitch out member functions and + templates from TYPE_FIELDS. + (build_distinct_type_copy, verify_type_variant, + verify_type): Member fns are on TYPE_FIELDS. + * tree-dump.c (dequeue_and_dump): No TYPE_METHODS. + * tree-pretty-print.c (dump_generic_node): Likewise. + * dbxout.c (dbxout_type_fields): Member fns are on TYPE_FIELDS. + (dbxout_type_method_1, dbxout_type_methods): Delete. + (dbxout_type_fn_member): New, constructed from previous. + (dbxout_type): No TYPE_METHODS scan. + * dwarf2out.c (gen_member_die): Member fns are on TYPE_FIELDS. + * function.c (use_register_for_decl): Always ignore register for + class types when not optimizing. + * ipa-devirt.c (odr_types_equivalent_p): Delete TYPE_METHODS scan. + gcc/c-family/ + * c-ada-spec.c (is_tagged_type, has_nontrivial_methods, + dump_ada_template, print_ada_methods, + print_ada_declaration): Member fns are on TYPE_FIELDS. + gcc/cp/ + * class.c (maybe_warn_about_overly_private_class, + finish_struct_methods, one_inheriting_sig, count_fields, + add_fields_to_record_type, check_field_decls, check_methods, + clone_function_decl, set_method_tm_attributes, + finalize_literal_type_property, check_bases_and_members, + create_vtable_ptr, determine_key_method, + unreverse_member_declarations, finish_struct, + add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS. + * decl.c (fixup_anonymous_aggr): Likewise. + * decl2.c (reset_type_linkage_2): Likewise. + * method.c (after_nsdmi_defaulted_late_checks, + lazily_declare_fn): Likewise. + * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. + * pt.c (instantiate_class_template_1, tsubst_expr, + do_type_instantiation, instantiate_pending_templates): Likewise. + * search.c (lookup_field_1): Likewise. + * semantics.c (finish_member_declaration, + finish_omp_declare_simd_methods): Likewise. + libcc1/ + * libcp1plugin.cc (plugin_build_decl): Member fns are on TYPE_FIELDS. + gcc/testsuite/ + * g++.dg/ext/anon-struct6.C: Adjust diag. + * g++.old-deja/g++.other/anon4.C: Adjust diag. + + gcc/cp/ + * decl2.c (mark_used): Reformat. + * pt.c (instantiate_class_member): Delete. + + Branch creation from trunk:250000 + Use this Changelog for all branch changes, including merges. + +Local Variables: +mode: change-log +change-log-default-name: "ChangeLog.name-lookup" +End: diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 5e0dea4..3fe8138 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -631,20 +631,24 @@ static const char *current_source_file; location_t decl_sloc (const_tree decl, bool last) { - tree field; - /* Compare the declaration of struct-like types based on the sloc of their last field (if LAST is true), so that more nested types collate before less nested ones. */ if (TREE_CODE (decl) == TYPE_DECL && !DECL_ORIGINAL_TYPE (decl) - && RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)) - && (field = TYPE_FIELDS (TREE_TYPE (decl)))) + && RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl))) { - if (last) + tree field = TYPE_FIELDS (TREE_TYPE (decl)); + + /* Skip any builtin fields we added. */ + while (field && DECL_IS_BUILTIN (field)) + field = DECL_CHAIN (field); + + if (field && last) while (DECL_CHAIN (field)) field = DECL_CHAIN (field); - return DECL_SOURCE_LOCATION (field); + if (field) + DECL_SOURCE_LOCATION (field); } return DECL_SOURCE_LOCATION (decl); diff --git a/gcc/c-family/c-ppoutput.c b/gcc/c-family/c-ppoutput.c index 2e5a44e..8187280 100644 --- a/gcc/c-family/c-ppoutput.c +++ b/gcc/c-family/c-ppoutput.c @@ -20,7 +20,7 @@ #include "system.h" #include "coretypes.h" #include "c-common.h" /* For flags. */ -#include "../libcpp/internal.h" +#include "../libcpp/internal.h" /* EW! */ #include "c-pragma.h" /* For parse_in. */ #include "file-prefix-map.h" /* remap_macro_filename() */ diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 7b10b20..81a1673 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1007,8 +1007,8 @@ add_method (tree type, tree method, bool via_using) gcc_assert (!DECL_EXTERN_C_P (method)); - tree *slot = find_member_slot (type, DECL_NAME (method)); - tree current_fns = slot ? *slot : NULL_TREE; + tree *slot = get_member_slot (type, DECL_NAME (method)); + tree current_fns = *slot; /* Check to see if we've already got this method. */ for (ovl_iterator iter (current_fns); iter; ++iter) @@ -1157,10 +1157,10 @@ add_method (tree type, tree method, bool via_using) if (!COMPLETE_TYPE_P (type) && !DECL_CONV_FN_P (method) && !push_class_level_binding (DECL_NAME (method), current_fns)) - return false; - - if (!slot) - slot = add_member_slot (type, DECL_NAME (method)); + { + unget_member_slot (type, slot); + return false; + } /* Maintain TYPE_HAS_USER_CONSTRUCTOR, etc. */ grok_special_member_properties (method); diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 3ba7644..9d96c25 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1107,6 +1107,8 @@ extract_conversion_operator (tree fns, tree type) if (same_type_p (DECL_CONV_FN_TYPE (*iter), type)) convs = lookup_add (*iter, convs); + // FIXME: really want some way to say 'no templates' + // FIXME: Plus ordering the overload to put templates last if (TREE_CODE (*iter) == TEMPLATE_DECL) tpls = lookup_add (*iter, tpls); } @@ -1117,15 +1119,27 @@ extract_conversion_operator (tree fns, tree type) return convs; } -/* Binary search of (ordered) MEMBER_VEC for NAME. */ +/* Binary search of MEMBER_VEC for NAME. Returns >= slot index if it + is present. Returns -1-slot index of where to insert it if it is + not present. */ -static tree -member_vec_binary_search (vec<tree, va_gc> *member_vec, tree name) +static int +get_member_vec_index (vec<tree, va_gc> *member_vec, tree name) { - for (unsigned lo = 0, hi = member_vec->length (); lo < hi;) + unsigned lo = 0; + unsigned hi = member_vec->length (); + + while (lo != hi) { unsigned mid = (lo + hi) / 2; tree binding = (*member_vec)[mid]; + + /* We can get a NULL binding during insertion of a new method + name, because the identifier_binding machinery performs a + lookup. If we find such a NULL slot, that's the thing we were + looking for, so we might as well bail out immediately. */ + if (!binding) + break; tree binding_name = OVL_NAME (binding); if (binding_name > name) @@ -1133,23 +1147,20 @@ member_vec_binary_search (vec<tree, va_gc> *member_vec, tree name) else if (binding_name < name) lo = mid + 1; else - return binding; + return mid; } - return NULL_TREE; + return -1 - int (lo); } -/* Linear search of (unordered) MEMBER_VEC for NAME. */ +/* Binary search of (ordered) MEMBER_VEC for NAME. */ static tree -member_vec_linear_search (vec<tree, va_gc> *member_vec, tree name) +member_vec_binary_search (vec<tree, va_gc> *member_vec, tree name) { - for (int ix = member_vec->length (); ix--;) - if (tree binding = (*member_vec)[ix]) - if (OVL_NAME (binding) == name) - return binding; + int ix = get_member_vec_index (member_vec, name); - return NULL_TREE; + return ix >= 0 ? (*member_vec)[ix] : NULL_TREE; } /* Linear search of (partially ordered) fields of KLASS for NAME. */ @@ -1167,7 +1178,6 @@ fields_linear_search (tree klass, tree name, bool want_type) if (tree temp = search_anon_aggr (TREE_TYPE (decl), name, want_type)) return temp; } - if (DECL_NAME (decl) != name) continue; @@ -1250,7 +1260,7 @@ get_class_binding_direct (tree klass, tree name, int type_or_fns) else { if (member_vec && type_or_fns <= 0) - val = member_vec_linear_search (member_vec, lookup); + val = member_vec_binary_search (member_vec, lookup); if (type_or_fns < 0) /* Don't bother looking for field. We don't want it. */; @@ -1302,7 +1312,7 @@ get_class_binding (tree klass, tree name, int type_or_fns) if (CLASSTYPE_LAZY_DESTRUCTOR (klass)) lazily_declare_fn (sfk_destructor, klass); } - else if (name == assign_op_identifier) + else if (IDENTIFIER_ASSIGN_OP_P (name) && name == assign_op_identifier) { if (CLASSTYPE_LAZY_COPY_ASSIGN (klass)) lazily_declare_fn (sfk_copy_assignment, klass); @@ -1315,22 +1325,19 @@ get_class_binding (tree klass, tree name, int type_or_fns) } /* Find the slot containing overloads called 'NAME'. If there is no - such slot and the class is complete, create an empty one, at the - correct point in the sorted member vector. Otherwise return NULL. - Deals with conv_op marker handling. */ + such slot, create an empty one. KLASS might be complete at this + point. Deals with conv_op marker handling. */ tree * -find_member_slot (tree klass, tree name) +get_member_slot (tree klass, tree name) { - bool complete_p = COMPLETE_TYPE_P (klass); - vec<tree, va_gc> *member_vec = CLASSTYPE_MEMBER_VEC (klass); if (!member_vec) { vec_alloc (member_vec, 8); CLASSTYPE_MEMBER_VEC (klass) = member_vec; - if (complete_p) - { + if (COMPLETE_TYPE_P (klass)) + { /* If the class is complete but had no member_vec, we need to add the TYPE_FIELDS into it. We're also most likely to be adding ctors & dtors, so ask for 6 spare slots (the @@ -1343,70 +1350,50 @@ find_member_slot (tree klass, tree name) if (IDENTIFIER_CONV_OP_P (name)) name = conv_op_identifier; - unsigned ix, length = member_vec->length (); - for (ix = 0; ix < length; ix++) - { - tree *slot = &(*member_vec)[ix]; - tree fn_name = OVL_NAME (*slot); - - if (fn_name == name) - { - /* If we found an existing slot, it must be a function set. - Even with insertion after completion, because those only - happen with artificial fns that have unspellable names. - This means we do not have to deal with the stat hack - either. */ - gcc_checking_assert (OVL_P (*slot)); - if (name == conv_op_identifier) - { - gcc_checking_assert (OVL_FUNCTION (*slot) == conv_op_marker); - /* Skip the conv-op marker. */ - slot = &OVL_CHAIN (*slot); - } - return slot; - } - - if (complete_p && fn_name > name) - break; - } - - /* No slot found, add one if the class is complete. */ - if (complete_p) + int ix = get_member_vec_index (member_vec, name); + if (ix < 0) { - /* Do exact allocation, as we don't expect to add many. */ - gcc_assert (name != conv_op_identifier); - vec_safe_reserve_exact (member_vec, 1); + /* No slot found. Create one at -1-IX. We know in this case + that our caller will succeed in adding the function. */ + ix = -1 - ix; + /* Do exact allocation, when complete, as we don't expect to add many. */ + vec_safe_reserve (member_vec, 1, COMPLETE_TYPE_P (klass)); CLASSTYPE_MEMBER_VEC (klass) = member_vec; member_vec->quick_insert (ix, NULL_TREE); - return &(*member_vec)[ix]; } - return NULL; -} - -/* KLASS is an incomplete class to which we're adding a method NAME. - Add a slot and deal with conv_op marker handling. */ - -tree * -add_member_slot (tree klass, tree name) -{ - gcc_assert (!COMPLETE_TYPE_P (klass)); - - vec<tree, va_gc> *member_vec = CLASSTYPE_MEMBER_VEC (klass); - vec_safe_push (member_vec, NULL_TREE); - CLASSTYPE_MEMBER_VEC (klass) = member_vec; + tree *slot = &(*member_vec)[ix]; - tree *slot = &member_vec->last (); - if (IDENTIFIER_CONV_OP_P (name)) + /* If we found an existing slot, it must be a function set. + Even with insertion after completion, because those only + happen with artificial fns that have unspellable names. + This means we do not have to deal with the stat hack + either. */ + gcc_checking_assert (!*slot || OVL_P (*slot)); + if (name == conv_op_identifier) { - /* Install the marker prefix. */ - *slot = ovl_make (conv_op_marker, NULL_TREE); + /* Check or install the conv-op marker. */ + if (*slot) + gcc_checking_assert (OVL_FUNCTION (*slot) == conv_op_marker); + else + *slot = ovl_make (conv_op_marker, NULL_TREE); + /* Skip the conv-op marker. */ slot = &OVL_CHAIN (*slot); } return slot; } +void +unget_member_slot (tree klass, tree *slot) +{ + vec<tree, va_gc> *member_vec = CLASSTYPE_MEMBER_VEC (klass); + gcc_checking_assert (!*slot && member_vec); + + int ix = slot - &(*member_vec)[0]; + member_vec->ordered_remove (ix); +} + /* Comparison function to compare two MEMBER_VEC entries by name. Because we can have duplicates during insertion of TYPE_FIELDS, we do extra checking so deduping doesn't have to deal with so many diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index 2bda0f1..9f739e8 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -305,8 +305,8 @@ extern tree lookup_arg_dependent (tree, tree, vec<tree, va_gc> *); extern tree search_anon_aggr (tree, tree, bool = false); extern tree get_class_binding_direct (tree, tree, int type_or_fns = -1); extern tree get_class_binding (tree, tree, int type_or_fns = -1); -extern tree *find_member_slot (tree klass, tree name); -extern tree *add_member_slot (tree klass, tree name); +extern tree *get_member_slot (tree klass, tree name); +extern void unget_member_slot (tree klass, tree *slot); extern void resort_type_member_vec (void *, void *, gt_pointer_operator, void *); extern void set_class_bindings (tree, unsigned extra = 0); diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 85aa09f..5928f7b 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -611,7 +611,8 @@ struct cpp_callbacks time_t (*get_source_date_epoch) (cpp_reader *); /* Callback for providing suggestions for misspelled directives. */ - const char *(*get_suggestion) (cpp_reader *, const char *, const char *const *); + const char *(*get_suggestion) (cpp_reader *, const char *, + const char *const *); /* Callback for when a comment is encountered, giving the location of the opening slash, a pointer to the content (which is not @@ -816,7 +817,10 @@ struct GTY(()) cpp_hashnode { ENUM_BITFIELD(node_type) type : 2; /* CPP node type. */ unsigned int flags : 8; /* CPP flags. */ - /* 6 bits spare (plus another 32 on 64-bit hosts). */ + /* 6 bits spare (plus another 32 on 64-bit hosts). We could shrink + this by making ht_identifier hold an offset to a trailing string + value. That would require FE's expose their IDENTIFIER_NODE size + to us. */ union _cpp_hashnode_value GTY ((desc ("%1.type"))) value; }; diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 4f0ff87..8a4bf53 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -61,22 +61,16 @@ inline int compare (linenum_type lhs, linenum_type rhs) return 0; } -/* Reason for creating a new line map with linemap_add. LC_ENTER is - when including a new file, e.g. a #include directive in C. - LC_LEAVE is when reaching a file's end. LC_RENAME is when a file - name or line number changes for neither of the above reasons - (e.g. a #line directive in C); LC_RENAME_VERBATIM is like LC_RENAME - but a filename of "" is not specially interpreted as standard - input. LC_ENTER_MACRO is when a macro expansion is about to start. */ +/* Reason for creating a new line map with linemap_add. */ enum lc_reason { - LC_ENTER = 0, - LC_LEAVE, - LC_RENAME, - LC_RENAME_VERBATIM, - LC_ENTER_MACRO, + LC_ENTER = 0, /* Begin #include. */ + LC_LEAVE, /* Return to including file. */ + LC_RENAME, /* Other reason for name change. */ + LC_RENAME_VERBATIM, /* Likewise, but "" != stdin. */ + LC_ENTER_MACRO, /* Begin macro expansion. */ /* FIXME: add support for stringize and paste. */ - LC_HWM /* High Water Mark. */ + LC_HWM }; /* The typedef "source_location" is a key within the location database, @@ -777,8 +771,7 @@ struct GTY(()) line_maps { may require allocating a new line_map. */ unsigned int max_column_hint; - /* If non-null, the allocator to use when resizing 'maps'. If null, - xrealloc is used. */ + /* The allocator to use when resizing 'maps', defaults to xrealloc. */ line_map_realloc reallocator; /* The allocators' function used to know the actual size it diff --git a/libcpp/traditional.c b/libcpp/traditional.c index 51c3e35..94c1f7b 100644 --- a/libcpp/traditional.c +++ b/libcpp/traditional.c @@ -851,6 +851,7 @@ push_replacement_text (cpp_reader *pfile, cpp_hashnode *node) else { cpp_macro *macro = node->value.macro; + gcc_assert (macro->kind == cmk_traditional); macro->used = 1; text = macro->exp.text; len = macro->count; |