Compare commits

...

151 Commits

Author SHA1 Message Date
Nathan Sidwell
23b92c4789 Merge trunk r263669.
From-SVN: r263670
2018-08-20 17:49:52 +00:00
Nathan Sidwell
c014d99632 Merge trunk r263667.
From-SVN: r263668
2018-08-20 17:20:30 +00:00
Nathan Sidwell
942c7776a2 Merge trunk r263658.
From-SVN: r263659
2018-08-20 13:31:18 +00:00
Nathan Sidwell
aa47c164cf Merge trunk r263622.
From-SVN: r263634
2018-08-17 19:57:46 +00:00
Nathan Sidwell
33cec993ea Merge trunk r263618.
From-SVN: r263620
2018-08-17 14:12:20 +00:00
Nathan Sidwell
b27d440b39 Merge trunk r263587.
From-SVN: r263588
2018-08-16 14:13:51 +00:00
Nathan Sidwell
646ba1e958 Merge trunk r263558.
From-SVN: r263560
2018-08-15 13:37:14 +00:00
Nathan Sidwell
fabae36d8c cpplib.h (NODE_...): Reenumerate.
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.

From-SVN: r263558
2018-08-15 12:33:04 +00:00
Nathan Sidwell
eb8b390832 c-ppoutput.c (dump_macro): No need to check for assert here.
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.

From-SVN: r263440
2018-08-09 02:14:45 +00:00
Nathan Sidwell
97a46b3af5 Merge trunk r263434.
From-SVN: r263435
2018-08-08 22:12:46 +00:00
Nathan Sidwell
ae56543c58 Fold cpp-id-data.h into cpplib.h
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.

From-SVN: r263434
2018-08-08 20:53:00 +00:00
Nathan Sidwell
977fed5ba4 cpplib.h (enum node_type): Rename to NT_USER_MACR, NT_BUILTIN_MACRO.
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.

From-SVN: r263430
2018-08-08 19:32:23 +00:00
Nathan Sidwell
2b2bcdcab0 internal.h (_cpp_notify_macro_use): Declare.
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.

From-SVN: r263428
2018-08-08 17:26:45 +00:00
Nathan Sidwell
cec9516086 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.

From-SVN: r263425
2018-08-08 15:42:27 +00:00
Nathan Sidwell
92b6cf115c 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.

From-SVN: r263356
2018-08-07 12:10:18 +00:00
Nathan Sidwell
8d10a4a717 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.

From-SVN: r263343
2018-08-06 20:37:47 +00:00
Nathan Sidwell
f71be84135 Merge trunk r263332.
From-SVN: r263334
2018-08-06 13:49:40 +00:00
Nathan Sidwell
316e19eeb7 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.

From-SVN: r263297
2018-08-03 17:48:42 +00:00
Nathan Sidwell
76b851f2ba cpplib.h (enum node_type): Remove NT_ASSERTION.
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.

From-SVN: r263278
2018-08-02 20:44:34 +00:00
Nathan Sidwell
cc9a73d9a3 Asserts are now macro variants
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.

From-SVN: r263268
2018-08-02 16:53:21 +00:00
Nathan Sidwell
fa4de73c1b Assert body is back as trailing array
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.

From-SVN: r263260
2018-08-02 14:23:50 +00:00
Nathan Sidwell
0b4a2c0622 internal.h (_cpp_construct_macro): Rename to ...
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.

From-SVN: r263234
2018-08-01 19:42:01 +00:00
Nathan Sidwell
99679fe034 Macro tokens are trailing array
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.

From-SVN: r263233
2018-08-01 18:42:13 +00:00
Nathan Sidwell
887cc5bad4 macro.c (create_iso_definition): Create macro after saving parms.
libcpp/
	* macro.c (create_iso_definition): Create macro after saving
	parms.
	* traditional.c (_cpp_create_trad_definition): Likewise.

From-SVN: r262834
2018-07-17 18:31:15 +00:00
Nathan Sidwell
dfed6beefe internal.h (_cpp_reserve_room): New inline.
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).

From-SVN: r262745
2018-07-16 18:56:01 +00:00
Nathan Sidwell
e1b492c728 macro.c (parse_params): Re implement state machine.
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.

From-SVN: r262654
2018-07-13 22:11:59 +00:00
Nathan Sidwell
6a830630e4 internal.h (_cpp_new_macro): Declare.
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.

From-SVN: r262643
2018-07-13 18:51:13 +00:00
Nathan Sidwell
5dafa677a4 internal.h (_cpp_save_parameter): Take parm no, not macro.
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.

From-SVN: r262638
2018-07-13 15:37:31 +00:00
Nathan Sidwell
46d4c344ca 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.

From-SVN: r262580
2018-07-12 11:26:16 +00:00
Nathan Sidwell
d2caa0054d Add cmk_assert structures
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.

From-SVN: r262558
2018-07-11 16:14:14 +00:00
Nathan Sidwell
3eef3a1923 Add cpp_macro_kind
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.

From-SVN: r262555
2018-07-11 14:46:07 +00:00
Nathan Sidwell
87bda85c67 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.

From-SVN: r262553
2018-07-11 13:35:57 +00:00
Nathan Sidwell
cd1941d122 line-map.h (enum lc_reason): Reformat comments.
libcpp/
	* include/line-map.h (enum lc_reason): Reformat comments.
	gcc/
	* diagnostic.c (diagnostic_report_current_module): Reroll loop.
	use array for prefix strings.

From-SVN: r262521
2018-07-09 20:27:45 +00:00
Nathan Sidwell
1fb1bc967e Default allocator
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.

From-SVN: r262520
2018-07-09 18:34:58 +00:00
Nathan Sidwell
b0a5308b05 Hide NT_MACRO
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.

From-SVN: r262483
2018-07-06 17:49:52 +00:00
Nathan Sidwell
d6b91e0687 Merge trunk r262473.
From-SVN: r262476
2018-07-06 12:53:33 +00:00
Nathan Sidwell
dc0232056a Merge trunk r260623.
From-SVN: r262473
2018-07-06 11:40:20 +00:00
Nathan Sidwell
6d0a5f8573 Merge trunk r254369.
From-SVN: r254370
2017-11-03 11:37:32 +00:00
Nathan Sidwell
33fcc4e9bb Merge trunk r254314.
From-SVN: r254318
2017-11-01 17:18:05 +00:00
Nathan Sidwell
450ffdeeab Merge trunk r254279.
From-SVN: r254298
2017-11-01 11:26:29 +00:00
Nathan Sidwell
e08110445c Merge trunk r254263.
From-SVN: r254266
2017-10-31 13:20:37 +00:00
Nathan Sidwell
595449182f Merge trunk r254243.
From-SVN: r254256
2017-10-31 11:18:44 +00:00
Nathan Sidwell
1c49f9cfdd 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.

From-SVN: r254243
2017-10-30 20:33:32 +00:00
Nathan Sidwell
fc2af89298 Merge trunk r254231.
From-SVN: r254232
2017-10-30 16:57:42 +00:00
Nathan Sidwell
9e27d1f517 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.

From-SVN: r254231
2017-10-30 16:46:36 +00:00
Nathan Sidwell
89b1ac7bc1 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.

From-SVN: r254215
2017-10-30 11:56:55 +00:00
Nathan Sidwell
bed3df711e 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.

From-SVN: r254185
2017-10-27 21:52:31 +00:00
Nathan Sidwell
726a68777e 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.

From-SVN: r254182
2017-10-27 20:35:40 +00:00
Nathan Sidwell
9f8c566001 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.

From-SVN: r254171
2017-10-27 19:08:15 +00:00
Nathan Sidwell
152addeddf 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.

From-SVN: r254155
2017-10-27 16:49:45 +00:00
Nathan Sidwell
0c94f13c74 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.

From-SVN: r254149
2017-10-27 13:05:11 +00:00
Nathan Sidwell
d71e691ac7 Merge trunk r254141.
From-SVN: r254142
2017-10-27 11:33:22 +00:00
Nathan Sidwell
f96792bf04 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.

From-SVN: r254141
2017-10-27 10:54:05 +00:00
Nathan Sidwell
2f9db6e78e 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.

From-SVN: r254119
2017-10-26 18:50:58 +00:00
Nathan Sidwell
6058132967 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.

From-SVN: r254108
2017-10-26 15:51:41 +00:00
Nathan Sidwell
4d650cc3ee 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.

From-SVN: r254091
2017-10-25 22:34:31 +00:00
Nathan Sidwell
8b8c6f7ca8 Merge trunk r254084.
From-SVN: r254085
2017-10-25 20:45:00 +00:00
Nathan Sidwell
860fb1204c 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.

From-SVN: r254084
2017-10-25 20:33:19 +00:00
Nathan Sidwell
3e4d48aa0b class.c (layout_class_type): Cleanup as-base creation, determine mode here.
gcc/cp/
	* class.c (layout_class_type): Cleanup as-base creation, determine
	mode here.
	(finish_struct_1): ... not here.

From-SVN: r253950
2017-10-20 17:51:23 +00:00
Nathan Sidwell
fbf3440a59 cp-tree.h (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS.
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.

From-SVN: r253913
2017-10-19 21:39:52 +00:00
Nathan Sidwell
c043c22a70 lex.c (get_identifier_kind_name): Fix names.
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.

From-SVN: r253898
2017-10-19 14:20:11 +00:00
Nathan Sidwell
f8e314fa8b Merge trunk r253836.
From-SVN: r253837
2017-10-18 00:14:13 +00:00
Nathan Sidwell
90078a281e name-lookup.c (get_member_vec_index): New.
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.

From-SVN: r253836
2017-10-18 00:00:43 +00:00
Nathan Sidwell
066931ca5b Merge trunk rr253733
From-SVN: r253737
2017-10-13 18:16:15 +00:00
Nathan Sidwell
018a6d019f tree.c (tree_code_size): Reformat.
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.

From-SVN: r253732
2017-10-13 16:48:00 +00:00
Nathan Sidwell
e266a043f1 Merge trunk r253723.
From-SVN: r253727
2017-10-13 12:52:14 +00:00
Nathan Sidwell
4858049b88 Merge trunk r253649.
From-SVN: r253651
2017-10-11 17:28:32 +00:00
Nathan Sidwell
dc045783d9 incpath.h (enum incpath_e): Name enum, prefix values.
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.

From-SVN: r253648
2017-10-11 16:25:52 +00:00
Nathan Sidwell
1565f6525b Merge trunk r253623
From-SVN: r253633
2017-10-11 11:01:30 +00:00
Nathan Sidwell
3ba57d7f85 Merge trunk r253619.
From-SVN: r253623
2017-10-10 20:54:48 +00:00
Nathan Sidwell
1b6759caa6 Merge trunk r253485.
From-SVN: r253488
2017-10-06 12:20:11 +00:00
Nathan Sidwell
602b074874 cp-tree.h (struct default_hash_traits <lang_identifier *>): Delete specialization.
gcc/cp/
	* cp-tree.h (struct default_hash_traits <lang_identifier *>):
	Delete specialization.

From-SVN: r253485
2017-10-06 11:15:36 +00:00
Nathan Sidwell
e6f2564ce9 name-lookup.c (extern_c_fns): Use hash_table<named_decl_hash>.
gcc/cp/
	* name-lookup.c (extern_c_fns): Use hash_table<named_decl_hash>.
	(check_extern_c_conflict, c_linkage_bindings): Adjust.

From-SVN: r253464
2017-10-05 20:30:58 +00:00
Nathan Sidwell
8a76bdda6a cp-tree.h (struct named_decl_hash): New.
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.

From-SVN: r253459
2017-10-05 17:54:17 +00:00
Nathan Sidwell
be2fe92054 decl2.c (struct mangled_decl_hash): New.
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.

From-SVN: r253457
2017-10-05 16:52:02 +00:00
Nathan Sidwell
629d50c30a name-lookup.c (set_global_binding): No need for stat_hack.
gcc/cp/
	* name-lookup.c (set_global_binding): No need for stat_hack.

From-SVN: r253450
2017-10-05 15:07:22 +00:00
Nathan Sidwell
fcf735744a Merge trunk r253446.
From-SVN: r253447
2017-10-05 14:11:43 +00:00
Nathan Sidwell
52f58685cb Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE
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.

From-SVN: r253445
2017-10-05 12:16:03 +00:00
Nathan Sidwell
6208735ff7 Merge trunk r253413.
From-SVN: r253416
2017-10-04 15:41:37 +00:00
Nathan Sidwell
8bf7b5679a cp-tree.h (SET_IDENTIFIER_GLOBAL_VALUE): Drop NAME arg.
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.

From-SVN: r253413
2017-10-04 14:48:27 +00:00
Nathan Sidwell
1b164a79a3 decl.c (record_builtin_type): Reimplement.
gcc/cp/
	* decl.c (record_builtin_type): Reimplement. Push decls with
	matching name.

From-SVN: r253412
2017-10-04 14:33:20 +00:00
Nathan Sidwell
aad9a3d440 cp-tree.h (record_mangling): Adjust arg types.
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.

From-SVN: r253408
2017-10-04 12:45:48 +00:00
Nathan Sidwell
f04f8fd8e6 cp-tree.h (record_mangling): Declare.
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.

From-SVN: r253387
2017-10-03 19:55:33 +00:00
Nathan Sidwell
84deef1f6e Merge trunk r252087.
From-SVN: r252088
2017-09-13 14:47:03 +00:00
Nathan Sidwell
da7d813ec0 Merge trunk r252046.
From-SVN: r252047
2017-09-12 23:54:10 +00:00
Nathan Sidwell
915a3a2026 Merge trunk r251808.
From-SVN: r251810
2017-09-06 16:21:55 +00:00
Nathan Sidwell
82afe8f2a5 Merge trunk r251780.
From-SVN: r251782
2017-09-06 11:54:31 +00:00
Nathan Sidwell
397149c087 Merge trunk r251721.
From-SVN: r251722
2017-09-05 18:33:45 +00:00
Nathan Sidwell
724325bb66 cp-tree.h (DECL_TEMPLATE_CONV_FN_P): Delete.
gcc/cp/
	* cp-tree.h (DECL_TEMPLATE_CONV_FN_P): Delete.
	* pt.c (push_template_decl_real): Don't set it.

From-SVN: r251721
2017-09-05 18:03:58 +00:00
Nathan Sidwell
a2a9b9c0d2 cp-tree.h (DECL_CONV_FN_P): No need to check DECL_NAME nullness.
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.

From-SVN: r251719
2017-09-05 17:14:52 +00:00
Nathan Sidwell
d0d2b78e19 class.c (add_method): Move conv_op marker handling to ...
gcc/cp/
	* class.c (add_method): Move conv_op marker handling to ...
	* name-lookup.c (find_method_slot): ... here.

From-SVN: r251716
2017-09-05 15:07:22 +00:00
Nathan Sidwell
9b30ad69c1 name-lookup.h (get_class_binding_direct, [...]): Merge want_type and restricted args.
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.

From-SVN: r251715
2017-09-05 14:16:50 +00:00
Nathan Sidwell
889b40ab4f Kill CLASSTYPE_SORTED_FIELDS
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..

From-SVN: r251712
2017-09-05 13:26:44 +00:00
Nathan Sidwell
46acd67fc7 backport: name-lookup.c (method_vec_binary_search, [...]): New.
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.

From-SVN: r251710
2017-09-05 12:40:02 +00:00
Nathan Sidwell
fa5a03c66c Merge trunk r251609.
From-SVN: r251611
2017-09-01 19:38:35 +00:00
Nathan Sidwell
8eb44ac7c6 class.c (warn_hidden): Clean up.
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.

From-SVN: r251599
2017-09-01 14:49:20 +00:00
Nathan Sidwell
c1f11fc0ba cp-tree.h (resort_type_method_vec): Move declaration to ...
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.

From-SVN: r251598
2017-09-01 14:29:35 +00:00
Nathan Sidwell
33a582be84 Merge trunk r251592.
From-SVN: r251593
2017-09-01 13:31:56 +00:00
Nathan Sidwell
75ff26c715 class.c (finish_struct): Also call set_class_bindings in template case.
gcc/cp/
	* class.c (finish_struct): Also call set_class_bindings in
	template case.

From-SVN: r251583
2017-09-01 11:02:46 +00:00
Nathan Sidwell
2bc268ff43 class.c (finish_struct_1): Move finish_struct_methods and set_class_bindings to just after layout.
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.

From-SVN: r251576
2017-08-31 20:32:28 +00:00
Nathan Sidwell
95cf8f32d1 class.c (finish_struct_methods): Don't warn about private bases here.
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.

From-SVN: r251572
2017-08-31 19:12:28 +00:00
Nathan Sidwell
d76c9e2e95 class.c (finish_struct_methods): Move DECL_IN_AGGR_P frobbing to finish_struct_1.
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.

From-SVN: r251571
2017-08-31 17:47:51 +00:00
Nathan Sidwell
50c6efb14e class.c (add_method): Use find_method_slot.
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.

From-SVN: r251569
2017-08-31 16:23:03 +00:00
Nathan Sidwell
31a3a7ffe7 Restore get_class_binding name.
* 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.

	* name-lookup.c (insert_late_enum_def_bindings): Swap args.
	* decl.c (finish_enum_value_list): Adjust
	insert_late_enum_def_bindings call.

From-SVN: r251565
2017-08-31 14:28:20 +00:00
Nathan Sidwell
46990968b9 Restore lang_type::sorted_fields
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.

From-SVN: r251563
2017-08-31 14:12:19 +00:00
Nathan Sidwell
78b8f1584e Merge trunk r251560.
From-SVN: r251561
2017-08-31 12:56:37 +00:00
Nathan Sidwell
67076db415 Anonymous namespace has NULL name
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.

From-SVN: r251411
2017-08-29 13:33:46 +00:00
Nathan Sidwell
393f08ba89 Merge trunk r251385.
From-SVN: r251386
2017-08-28 13:54:10 +00:00
Nathan Sidwell
fc9262b1bb name-lookup.c (do_class_using_decl): Simplify.
gcc/cp/
	* name-lookup.c (do_class_using_decl): Simplify.

From-SVN: r251380
2017-08-28 12:44:37 +00:00
Nathan Sidwell
09247a099d name-lookup.h (lookup_class_member): Delete.
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.

From-SVN: r251354
2017-08-25 14:49:08 +00:00
Nathan Sidwell
df4cf99622 Merge trunk r251351.
From-SVN: r251353
2017-08-25 13:34:20 +00:00
Nathan Sidwell
b2c3b92cb3 Rename get_class_binding -> get_class_value
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.

From-SVN: r251327
2017-08-24 11:27:37 +00:00
Nathan Sidwell
af83df89a3 name-lookup.c (extract_conversion_operator, [...]): Move earlier to match trunk.
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.

From-SVN: r251320
2017-08-23 21:18:24 +00:00
Nathan Sidwell
fad15a3992 Merge trunk r251313.
From-SVN: r251314
2017-08-23 18:30:00 +00:00
Nathan Sidwell
1faaddedb5 name-lookup.h (get_class_binding_direct, [...]): Add temporary restricted parm.
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.

From-SVN: r251307
2017-08-23 13:09:10 +00:00
Nathan Sidwell
0110b14b75 semantics.c (finish_member_declaration): Move USING_DECL check.
gcc/cp/
	* semantics.c (finish_member_declaration): Move USING_DECL check.
	Always set lang_cplusplus.  Commonize decl linking.

From-SVN: r251305
2017-08-23 11:42:09 +00:00
Nathan Sidwell
3da9e40c8f name-lookup.c (legacy_fn_member_lookup): Move conv_op processing to get_class_binding_direct.
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.

From-SVN: r251288
2017-08-22 18:31:18 +00:00
Nathan Sidwell
3d37196f06 cp-tree.h (print_search_statistics, [...]): Delete.
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.

From-SVN: r251285
2017-08-22 17:27:06 +00:00
Nathan Sidwell
ec717a1e3c Merge trunk r251283.
From-SVN: r251284
2017-08-22 17:12:50 +00:00
Nathan Sidwell
7e39336f94 cp-tree.h (lookup_field_1, [...]): Delete.
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.

From-SVN: r251283
2017-08-22 16:49:57 +00:00
Nathan Sidwell
5acc247c99 cp-tree.h (lookup_fnfields_slot): 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.

From-SVN: r251280
2017-08-22 15:17:27 +00:00
Nathan Sidwell
142e6f377a name-lookup.h (get_class_binding_direct): Declare.
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

From-SVN: r251278
2017-08-22 14:22:28 +00:00
Nathan Sidwell
3f434d24e2 decl.c (reshape_init_class): Use get_class_binding.
* 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.

From-SVN: r251247
2017-08-21 20:31:33 +00:00
Nathan Sidwell
53659b3358 search.c (lookup_field_r): Remove obsolete code for type-named field in PoD.
* search.c (lookup_field_r): Remove obsolete code for type-named
	field in PoD.

From-SVN: r251244
2017-08-21 19:09:25 +00:00
Nathan Sidwell
30720b86a7 Merge trunk r251241.
From-SVN: r251242
2017-08-21 17:41:32 +00:00
Nathan Sidwell
5450af1ada search.c (lookup_field_1): Assert TYPE is a class.
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.

From-SVN: r251237
2017-08-21 16:47:23 +00:00
Nathan Sidwell
8b63c6959f Merge trunk r251159.
From-SVN: r251167
2017-08-17 20:13:22 +00:00
Nathan Sidwell
df6d8b7588 cp-tree.h (maybe_version_functions): Declare.
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.

From-SVN: r250643
2017-07-27 23:56:49 +00:00
Nathan Sidwell
02d996d5f1 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.

From-SVN: r250634
2017-07-27 17:40:35 +00:00
Nathan Sidwell
ea65447add Merge trunk r250440.
From-SVN: r250441
2017-07-21 19:31:55 +00:00
Nathan Sidwell
bc9040129c Merge trunk r250437.
From-SVN: r250438
2017-07-21 18:20:13 +00:00
Nathan Sidwell
c5362ad39b dbxout.c: Restore from trunk.
gcc/
	* dbxout.c: Restore from trunk.

From-SVN: r250429
2017-07-21 16:04:12 +00:00
Nathan Sidwell
0a78354e6e Merge trunk r250426.
From-SVN: r250427
2017-07-21 15:49:27 +00:00
Nathan Sidwell
1c3a9260c2 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.

From-SVN: r250426
2017-07-21 13:21:58 +00:00
Nathan Sidwell
45e7f3350d Merge trunk r250413.
From-SVN: r250414
2017-07-21 00:59:32 +00:00
Nathan Sidwell
ac26d00e2f Method vec sorted by identifier pointer (not conv ops)
From-SVN: r250401
2017-07-20 20:32:32 +00:00
Nathan Sidwell
5fe9a2c37e 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.

From-SVN: r250396
2017-07-20 16:28:24 +00:00
Nathan Sidwell
57eb838408 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.

From-SVN: r250388
2017-07-20 14:20:32 +00:00
Nathan Sidwell
fa206c04db call.c (add_candidates): Move decls to initialization.
gcc/cp/
	* call.c (add_candidates): Move decls to initialization.  Don't
	use !!.

From-SVN: r250387
2017-07-20 14:16:32 +00:00
Nathan Sidwell
9ddaee6ca6 Merge trunk r250380.
From-SVN: r250381
2017-07-20 11:15:52 +00:00
Nathan Sidwell
faf877036b Merge trunk r250344.
From-SVN: r250348
2017-07-19 14:39:06 +00:00
Nathan Sidwell
56eb45debf search.c (lookup_conversion_operator): Return overloads not index.
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.

From-SVN: r250318
2017-07-18 19:16:08 +00:00
Nathan Sidwell
3f4f545f68 Merge trunk r250313.
From-SVN: r250316
2017-07-18 16:43:01 +00:00
Nathan Sidwell
86fe86298d missing changelog
From-SVN: r250313
2017-07-18 15:25:12 +00:00
Nathan Sidwell
5e07660d38 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.

From-SVN: r250306
2017-07-18 12:18:38 +00:00
Nathan Sidwell
aa5520885f Remove special ctor/dtor slots
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.

From-SVN: r250283
2017-07-17 18:36:20 +00:00
Nathan Sidwell
49c6196440 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.

From-SVN: r250277
2017-07-17 13:40:26 +00:00
Nathan Sidwell
c757c9df76 Merge trunk
From-SVN: r250161
2017-07-12 20:28:33 +00:00
Nathan Sidwell
6e38c63305 tree-core.h (struct tree_type_non_common): Rename binfo to lang_1.
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.

	Merge trunk

From-SVN: r250160
2017-07-12 20:27:23 +00:00
Nathan Sidwell
8d174dbbc4 tree.h (TYPE_METHODS): Delete.
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.

From-SVN: r250142
2017-07-11 23:36:24 +00:00
Nathan Sidwell
8e7ce49de1 Branch creation from trunk:250000
Use this Changelog for all branch changes, including merges.

From-SVN: r250002
2017-07-05 15:22:30 +00:00
9 changed files with 1611 additions and 107 deletions

1515
ChangeLog.name-lookup Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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);

View File

@@ -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() */

View File

@@ -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);

View File

@@ -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++)
int ix = get_member_vec_index (member_vec, name);
if (ix < 0)
{
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)
{
/* 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;
}
tree *slot = &(*member_vec)[ix];
/* 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->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

View File

@@ -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);

View File

@@ -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;
};

View File

@@ -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

View File

@@ -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;