gcc/gcc/cp/method.c

2414 lines
72 KiB
C
Raw Normal View History

1994-02-24 02:02:37 +01:00
/* Handle the hair of processing (but not expanding) inline functions.
Also manage function and variable name overloading.
Copyright (C) 1987-2017 Free Software Foundation, Inc.
1994-02-24 02:02:37 +01:00
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
1994-02-24 02:02:37 +01:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
1994-02-24 02:02:37 +01:00
any later version.
GCC is distributed in the hope that it will be useful,
1994-02-24 02:02:37 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
1994-02-24 02:02:37 +01:00
/* Handle method declarations. */
#include "config.h"
1998-03-06 23:24:29 +01:00
#include "system.h"
#include "coretypes.h"
decl.c: Reorder #include's and remove duplicates. ada 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/decl.c: Reorder #include's and remove duplicates. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Reorder #include's and remove duplicates. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Reorder #include's and remove duplicates. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * call.c: Reorder #include's and remove duplicates. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. fortran 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array.c: Reorder #include's and remove duplicates. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * resolve.c: Likewise. * simplify.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Reorder #include's and remove duplicates. * go-lang.c: Likewise. java 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Reorder #include's and remove duplicates. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. jit 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Reorder #include's and remove duplicates. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * libgccjit.c: Likewise. lto 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Reorder #include's and remove duplicates. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objc-lang.c: Reorder #include's and remove duplicates. * objc-map.c: Likewise. objcp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Reorder #include's and remove duplicates. * objcp-lang.c: Likewise. From-SVN: r229533
2015-10-29 16:27:20 +01:00
#include "target.h"
#include "cp-tree.h"
Factor unrelated declarations out of tree.h. This patch applies the rule that functions defined in FOO.c must be declared in FOO.h. One of the worst offenders in the code base is tree.h, unsurprisingly. The patch creates several new headers: attribs.h calls.h fold-const.h gcc-symtab.h print-rtl.h print-tree.h stmt.h stor-layout.h stringpool.h tree-nested.h tree-object-size.h varasm.h. Functions in each corresponding .c file got moved to those headers and others that already existed. I wanted to make this patch as mechanical as possible, so I made no attempt to fix problems like having build_addr defined in tree-inline.c. I left that for later. There were some declarations that I could not move out of tree.h because of header poisoning or the use of target macros. We forbid the inclusion of things like expr.h from FE files. While that's a reasonable idea, the FE file *still* manage to at expr.c functionality because the declarations they want to use were defined in tree.h. The affected files are builtins.h, emit-rtl.h and expr.h. If that functionality is allowed to be accessed from the FEs, then I will later move those functions out of expr.c into tree.c. I have moved these declarations to the bottom of tree.h so they are easy to identify later. There is a namespace collision with libcpp. The file gcc/symtab.c cannot use gcc/symtab.h because the #include command picks up libcpp/include/symtab.h first. So I named this file gcc-symtab.h for now. Finally, I added a new header to PLUGIN_HEADERS to account for the tree.h refactoring. I did not add all headers factored out of tree.h because it is unclear (and impossible to tell) what plugins need. This adds the one header used by the plugins in the testsuite. This will be changing quite dramatically as we progress with the header refactoring. This patch should offer some minimal incremental build advantages by reducing the size of tree.h. Changes that would otherwise affected tree.h, will now go to other headers which are less frequently included. * tree.h: Include fold-const.h. (aggregate_value_p): Moved to function.h. (alloca_call_p): Moved to calls.h. (allocate_struct_function): Moved to function.h. (apply_tm_attr): Moved to attribs.h. (array_at_struct_end_p): Moved to expr.h. (array_ref_element_size): Moved to tree-dfa.h. (array_ref_low_bound): Moved to tree-dfa.h. (array_ref_up_bound): Moved to tree.h. (assemble_alias): Moved to cgraph.h. (bit_from_pos): Moved to stor-layout.h. (build_addr): Moved to tree-nested.h. (build_duplicate_type): Moved to tree-inline.h. (build_fold_addr_expr): Moved to fold-const.h. (build_fold_addr_expr_with_type): Moved to fold-const.h. (build_fold_addr_expr_with_type_loc): Moved to fold-const.h. (build_fold_indirect_ref): Moved to fold-const.h. (build_fold_indirect_ref_loc): Moved to fold-const.h. (build_personality_function): Moved to tree.h. (build_range_check): Moved to fold-const.h. (build_simple_mem_ref): Moved to fold-const.h. (build_simple_mem_ref_loc): Moved to fold-const.h. (build_tm_abort_call): Moved to trans-mem.h. (byte_from_pos): Moved to stor-layout.h. (call_expr_flags): Moved to calls.h. (can_move_by_pieces): Moved to expr.h. (categorize_ctor_elements): Moved to expr.h. (change_decl_assembler_name): Moved to gcc-symtab.h. (combine_comparisons): Moved to fold-const.h. (complete_ctor_at_level_p): Moved to tree.h. (component_ref_field_offset): Moved to tree-dfa.h. (compute_builtin_object_size): Moved to tree-object-size.h. (compute_record_mode): Moved to stor-layout.h. (constant_boolean_node): Moved to fold-const.h. (constructor_static_from_elts_p): Moved to varasm.h. (cxx11_attribute_p): Moved to attribs.h. (debug_body): Moved to print-tree.h. (debug_find_tree): Moved to tree-inline.h. (debug_fold_checksum): Moved to fold-const.h. (debug_head): Moved to print-tree.h. (debug_head): Moved to print-tree.h. (debug_raw): Moved to print-tree.h. (debug_tree): Moved to print-tree.h. (debug_vec_tree): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (decl_attributes): Moved to attribs.h. (decl_binds_to_current_def_p): Moved to varasm.h. (decl_default_tls_model): Moved to varasm.h. (decl_replaceable_p): Moved to varasm.h. (div_if_zero_remainder): Moved to fold-const.h. (double_int mem_ref_offset): Moved to fold-const.h. (dump_addr): Moved to print-tree.h. (element_precision): Moved to machmode.h. (expand_dummy_function_end): Moved to function.h. (expand_function_end): Moved to function.h. (expand_function_start): Moved to function.h. (expand_label): Moved to stmt.h. (expr_first): Moved to tree-iterator.h. (expr_last): Moved to tree-iterator.h. (finalize_size_functions): Moved to stor-layout.h. (finish_builtin_struct): Moved to stor-layout.h. (finish_record_layout): Moved to stor-layout.h. (fixup_signed_type): Moved to stor-layout.h. (fixup_unsigned_type): Moved to stor-layout.h. (flags_from_decl_or_type): Moved to calls.h. (fold): Moved to fold-const.h. (fold_abs_const): Moved to fold-const.h. (fold_binary): Moved to fold-const.h. (fold_binary_loc): Moved to fold-const.h. (fold_binary_to_constant): Moved to fold-const.h. (fold_build1): Moved to fold-const.h. (fold_build1_initializer_loc): Moved to fold-const.h. (fold_build1_loc): Moved to fold-const.h. (fold_build1_stat_loc): Moved to fold-const.h. (fold_build2): Moved to fold-const.h. (fold_build2_initializer_loc): Moved to fold-const.h. (fold_build2_loc): Moved to fold-const.h. (fold_build2_stat_loc): Moved to fold-const.h. (fold_build3): Moved to fold-const.h. (fold_build3_loc): Moved to fold-const.h. (fold_build3_stat_loc): Moved to fold-const.h. (fold_build_call_array): Moved to fold-const.h. (fold_build_call_array_initializer): Moved to fold-const.h. (fold_build_call_array_initializer_loc): Moved to fold-const.h. (fold_build_call_array_loc): Moved to fold-const.h. (fold_build_cleanup_point_expr): Moved to fold-const.h. (fold_convert): Moved to fold-const.h. (fold_convert_loc): Moved to fold-const.h. (fold_convertible_p): Moved to fold-const.h. (fold_defer_overflow_warnings): Moved to fold-const.h. (fold_deferring_overflow_warnings_p): Moved to fold-const.h. (fold_fma): Moved to fold-const.h. (fold_ignored_result): Moved to fold-const.h. (fold_indirect_ref): Moved to fold-const.h. (fold_indirect_ref_1): Moved to fold-const.h. (fold_indirect_ref_loc): Moved to fold-const.h. (fold_read_from_constant_string): Moved to fold-const.h. (fold_real_zero_addition_p): Moved to fold-const.h. (fold_single_bit_test): Moved to fold-const.h. (fold_strip_sign_ops): Moved to fold-const.h. (fold_ternary): Moved to fold-const.h. (fold_ternary_loc): Moved to fold-const.h. (fold_unary): Moved to tree-data-ref.h. (fold_unary_ignore_overflow): Moved to fold-const.h. (fold_unary_ignore_overflow_loc): Moved to fold-const.h. (fold_unary_loc): Moved to fold-const.h. (fold_unary_to_constant): Moved to fold-const.h. (fold_undefer_and_ignore_overflow_warnings): Moved to fold-const.h. (fold_undefer_overflow_warnings): Moved to fold-const.h. (folding_initializer): Moved to fold-const.h. (free_temp_slots): Moved to function.h. (generate_setjmp_warnings): Moved to function.h. (get_attribute_name): Moved to attribs.h. (get_identifier): Moved to stringpool.h. (get_identifier_with_length): Moved to stringpool.h. (get_inner_reference): Moved to tree.h. (gimple_alloca_call_p): Moved to calls.h. (gimplify_parameters): Moved to function.h. (highest_pow2_factor): Moved to expr.h. (indent_to): Moved to print-tree.h. (init_attributes): Moved to attribs.h. (init_dummy_function_start): Moved to function.h. (init_function_start): Moved to function.h. (init_inline_once): Moved to tree-inline.h. (init_object_sizes): Moved to tree-object-size.h. (init_temp_slots): Moved to function.h. (init_tree_optimization_optabs): Moved to optabs.h. (initialize_sizetypes): Moved to stor-layout.h. (initializer_constant_valid_for_bitfield_p): Moved to varasm.h. (initializer_constant_valid_p): Moved to varasm.h. (int_const_binop): Moved to fold-const.h. (internal_reference_types): Moved to stor-layout.h. (invert_tree_comparison): Moved to fold-const.h. (invert_truthvalue): Moved to fold-const.h. (invert_truthvalue_loc): Moved to fold-const.h. (is_tm_ending_fndecl): Moved to trans-mem.h. (is_tm_may_cancel_outer): Moved to trans-mem.h. (is_tm_pure): Moved to trans-mem.h. (is_tm_safe): Moved to trans-mem.h. (layout_decl): Moved to stor-layout.h. (layout_type): Moved to stor-layout.h. (lookup_attribute_spec): Moved to attribs.h. (make_accum_type): Moved to stor-layout.h. (make_decl_one_only): Moved to varasm.h. (make_decl_rtl): Moved to tree.h. (make_decl_rtl_for_debug): Moved to varasm.h. (make_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_fract_type): Moved to stor-layout.h. (make_or_reuse_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_unsigned_fract_type): Moved to stor-layout.h. (make_range): Moved to fold-const.h. (make_range_step): Moved to fold-const.h. (make_sat_signed_accum_type): Moved to stor-layout.h. (make_sat_signed_fract_type): Moved to stor-layout.h. (make_sat_unsigned_accum_type): Moved to stor-layout.h. (make_sat_unsigned_fract_type): Moved to stor-layout.h. (make_signed_accum_type): Moved to stor-layout.h. (make_signed_fract_type): Moved to stor-layout.h. (make_signed_type): Moved to stor-layout.h. (make_unsigned_accum_type): Moved to stor-layout.h. (make_unsigned_fract_type): Moved to stor-layout.h. (make_unsigned_type): Moved to stor-layout.h. (mark_decl_referenced): Moved to varasm.h. (mark_referenced): Moved to varasm.h. (may_negate_without_overflow_p): Moved to fold-const.h. (maybe_get_identifier): Moved to stringpool.h. (merge_ranges): Moved to fold-const.h. (merge_weak): Moved to varasm.h. (mode_for_size_tree): Moved to stor-layout.h. (multiple_of_p): Moved to fold-const.h. (must_pass_in_stack_var_size): Moved to calls.h. (must_pass_in_stack_var_size_or_pad): Moved to calls.h. (native_encode_expr): Moved to fold-const.h. (native_interpret_expr): Moved to fold-const.h. (non_lvalue): Moved to fold-const.h. (non_lvalue_loc): Moved to fold-const.h. (normalize_offset): Moved to stor-layout.h. (normalize_rli): Moved to stor-layout.h. (notice_global_symbol): Moved to varasm.h. (omit_one_operand): Moved to fold-const.h. (omit_one_operand_loc): Moved to fold-const.h. (omit_two_operands): Moved to fold-const.h. (omit_two_operands_loc): Moved to fold-const.h. (operand_equal_p): Moved to tree-data-ref.h. (parse_input_constraint): Moved to stmt.h. (parse_output_constraint): Moved to stmt.h. (place_field): Moved to stor-layout.h. (pop_function_context): Moved to function.h. (pop_temp_slots): Moved to function.h. (pos_from_bit): Moved to stor-layout.h. (preserve_temp_slots): Moved to function.h. (print_node): Moved to print-tree.h. (print_node_brief): Moved to print-tree.h. (print_rtl): Moved to rtl.h. (process_pending_assemble_externals): Moved to varasm.h. (ptr_difference_const): Moved to fold-const.h. (push_function_context): Moved to function.h. (push_struct_function): Moved to function.h. (push_temp_slots): Moved to function.h. (record_tm_replacement): Moved to trans-mem.h. (relayout_decl): Moved to stor-layout.h. (resolve_asm_operand_names): Moved to stmt.h. (resolve_unique_section): Moved to varasm.h. (rli_size_so_far): Moved to stor-layout.h. (rli_size_unit_so_far): Moved to stor-layout.h. (round_down): Moved to fold-const.h. (round_down_loc): Moved to fold-const.h. (round_up): Moved to fold-const.h. (round_up_loc): Moved to fold-const.h. (set_decl_incoming_rtl): Moved to emit-rtl.h. (set_decl_rtl): Moved to tree.h. (set_min_and_max_values_for_integral_type): Moved to stor-layout.h. (set_user_assembler_name): Moved to varasm.h. (setjmp_call_p): Moved to calls.h. (size_binop): Moved to fold-const.h. (size_binop_loc): Moved to fold-const.h. (size_diffop): Moved to fold-const.h. (size_diffop_loc): Moved to fold-const.h. (size_int_kind): Moved to fold-const.h. (stack_protect_epilogue): Moved to function.h. (start_record_layout): Moved to stor-layout.h. (supports_one_only): Moved to varasm.h. (swap_tree_comparison): Moved to fold-const.h. (tm_malloc_replacement): Moved to trans-mem.h. (tree build_fold_addr_expr_loc): Moved to fold-const.h. (tree build_invariant_address): Moved to fold-const.h. (tree_binary_nonnegative_warnv_p): Moved to fold-const.h. (tree_binary_nonzero_warnv_p): Moved to fold-const.h. (tree_call_nonnegative_warnv_p): Moved to fold-const.h. (tree_expr_nonnegative_p): Moved to fold-const.h. (tree_expr_nonnegative_warnv_p): Moved to fold-const.h. (tree_output_constant_def): Moved to varasm.h. (tree_overlaps_hard_reg_set): Moved to stmt.h. (tree_single_nonnegative_warnv_p): Moved to fold-const.h. (tree_single_nonzero_warnv_p): Moved to fold-const.h. (tree_swap_operands_p): Moved to fold-const.h. (tree_unary_nonnegative_warnv_p): Moved to fold-const.h. (tree_unary_nonzero_warnv_p): Moved to fold-const.h. (update_alignment_for_field): Moved to stor-layout.h. (use_register_for_decl): Moved to function.h. (variable_size): Moved to rtl.h. (vector_type_mode): Moved to stor-layout.h. * cgraph.h: Corresponding changes. * emit-rtl.h: Corresponding changes. * expr.h: Corresponding changes. * function.h: Corresponding changes. * optabs.h: Corresponding changes. * trans-mem.h: Corresponding changes. Protect against multiple inclusion. * tree-inline.h: Corresponding changes. * tree-iterator.h: Corresponding changes. * tree-dfa.h: Include expr.h. * tree-ssanames.h: Include stringpool.h. * attribs.h: New file. * calls.h: New file. * fold-const.h: New file. * gcc-symtab.h: New file. * print-rtl.h: New file. * print-tree.h: New file. * stmt.h: New file. * stor-layout.h: New file. * strinpool.h: New file. * tree-nested.h: New file * tree-object-size.h: New file. * varasm.h: New file. * Makefile.in (PLUGIN_HEADERS): Add stringpool.h. * alias.c: Include varasm.h. Include expr.h. * asan.c: Include calls.h. Include stor-layout.h. Include varasm.h. * attribs.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. * builtins.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. Include tree-object-size.h. * calls.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include attribs.h. * cfgexpand.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. * cgraph.c: Include varasm.h. Include calls.h. Include print-tree.h. * cgraphclones.c: Include stringpool.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * cgraphunit.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * cilk-common.c: Include stringpool.h. Include stor-layout.h. * combine.c: Include stor-layout.h. * config/aarch64/aarch64-builtins.c: Include stor-layout.h. Include stringpool.h. Include calls.h. * config/aarch64/aarch64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/alpha/alpha.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/arc/arc.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. Include calls.h. * config/arm/arm.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/avr/avr-c.c: Include stor-layout.h. * config/avr/avr-log.c: Include print-tree.h. * config/avr/avr.c: Include print-tree.h. Include calls.h. Include stor-layout.h. Include stringpool.h. * config/bfin/bfin.c: Include varasm.h. Include calls.h. * config/c6x/c6x.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/cr16/cr16.c: Include stor-layout.h. Include calls.h. * config/cris/cris.c: Include varasm.h. Include stor-layout.h. Include calls.h. Include stmt.h. * config/darwin.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. * config/epiphany/epiphany.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/fr30/fr30.c: Include stor-layout.h. Include varasm.h. * config/frv/frv.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * config/h8300/h8300.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/i386/i386.c: Include stringpool.h. Include attribs.h. Include calls.h. Include stor-layout.h. Include varasm.h. * config/i386/winnt-cxx.c: Include stringpool.h. Include attribs.h. * config/i386/winnt.c: Include stringpool.h. Include varasm.h. * config/ia64/ia64-c.c: Include stringpool.h. * config/ia64/ia64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/iq2000/iq2000.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/lm32/lm32.c: Include calls.h. * config/m32c/m32c.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/m32r/m32r.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/m68k/m68k.c: Include calls.h. Include stor-layout.h. Include varasm.h. * config/mcore/mcore.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/mep/mep.c: Include varasm.h. Include calls.h. Include stringpool.h. Include stor-layout.h. * config/microblaze/microblaze.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mips/mips.c: Include varasm.h. Include stringpool.h. Include stor-layout.h. Include calls.h. * config/mmix/mmix.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mn10300/mn10300.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/moxie/moxie.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/msp430/msp430.c: Include stor-layout.h. Include calls.h. * config/nds32/nds32.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/pa/pa.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include calls.h. * config/pdp11/pdp11.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/picochip/picochip.c: Include calls.h. Include stor-layout.h. Include stringpool.h. Include varasm.h. * config/rl78/rl78.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/rs6000/rs6000-c.c: Include stor-layout.h. Include stringpool.h. * config/rs6000/rs6000.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include print-tree.h. Include varasm.h. * config/rx/rx.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/s390/s390.c: Include print-tree.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/score/score.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. * config/sh/sh-c.c: Include stringpool.h. Include attribs.h.h. * config/sh/sh.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/sol2-c.c: Include stringpool.h. Include attribs.h. * config/sol2-cxx.c: Include stringpool.h. * config/sol2.c: Include stringpool.h. Include varasm.h. * config/sparc/sparc.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/spu/spu-c.c: Include stringpool.h. * config/spu/spu.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/stormy16/stormy16.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilegx/tilegx.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilepro/tilepro.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/v850/v850-c.c: Include stringpool.h. Include attribs.h. * config/v850/v850.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/vax/vax.c: Include calls.h. Include varasm.h. * config/vms/vms.c: Include stringpool.h. * config/vxworks.c: Include stringpool.h. * config/xtensa/xtensa.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * convert.c: Include stor-layout.h. * coverage.c: Include stringpool.h. Include stor-layout.h. * dbxout.c: Include varasm.h. Include stor-layout.h. * dojump.c: Include stor-layout.h. * dse.c: Include stor-layout.h. * dwarf2asm.c: Include stringpool.h. Include varasm.h. * dwarf2cfi.c: Include stor-layout.h. * dwarf2out.c: Include rtl.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * emit-rtl.c: Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * explow.c: Include stor-layout.h. * expmed.c: Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. Include varasm.h. * final.c: Include varasm.h. * fold-const.c: Include stor-layout.h. Include calls.h. Include tree-iterator.h. * function.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. * genattrtab.c (write_header): Emit includes for varasm.h, stor-layout.h and calls.h. * genautomata.c (main): Likewise. * genemit.c: Likewise. * genopinit.c: Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c: Likewise. * genpreds.c (write_insn_preds_c): Likewise. * gengtype.c (open_base_files): Add stringpool.h. * gimple-expr.c: Include stringpool.h. Include stor-layout.h. * gimple-fold.c: Include stringpool.h. Include expr.h. Include stmt.h. Include stor-layout.h. * gimple-low.c: Include tree-nested.h. Include calls.h. * gimple-pretty-print.c: Include stringpool.h. * gimple-ssa-strength-reduction.c: Include stor-layout.h. Include expr.h. * gimple-walk.c: Include stmt.h. * gimple.c: Include calls.h. Include stmt.h. Include stor-layout.h. * gimplify.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. Include expr.h. * gimplify-me.c: Include stmt.h Include stor-layout.h * internal-fn.c: Include stor-layout.h. * ipa-devirt.c: Include print-tree.h. Include calls.h. * ipa-inline-analysis.c: Include stor-layout.h. Include stringpool.h. Include print-tree.h. * ipa-inline.c: Include trans-mem.h. Include calls.h. * ipa-prop.c: Include expr.h. Include stor-layout.h. Include print-tree.h. * ipa-pure-const.c: Include print-tree.h. Include calls.h. * ipa-reference.c: Include calls.h. * ipa-split.c: Include stringpool.h. Include expr.h. Include calls.h. * ipa.c: Include calls.h. Include stringpool.h. * langhooks.c: Include stringpool.h. Include attribs.h. * lto-cgraph.c: Include stringpool.h. * lto-streamer-in.c: Include stringpool.h. * lto-streamer-out.c: Include stor-layout.h. Include stringpool.h. * omp-low.c: Include stringpool.h. Include stor-layout.h. Include expr.h. * optabs.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * passes.c: Include varasm.h. * predict.c: Include calls.h. * print-rtl.c: Include print-tree.h. * print-tree.c: Include varasm.h. Include print-rtl.h. Include stor-layout.h. * realmpfr.c: Include stor-layout.h. * reg-stack.c: Include varasm.h. * sdbout.c: Include varasm.h. Include stor-layout.h. * simplify-rtx.c: Include varasm.h. * stmt.c: Include varasm.h. Include stor-layout.h. * stor-layout.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include print-tree.h. * symtab.c: Include rtl.h. Include print-tree.h. Include varasm.h. Include function.h. Include emit-rtl.h. * targhooks.c: Include stor-layout.h. Include varasm.h. * toplev.c: Include varasm.h. Include tree-inline.h. * trans-mem.c: Include calls.h. Include function.h. Include rtl.h. Include emit-rtl.h. * tree-affine.c: Include expr.h. * tree-browser.c: Include print-tree.h. * tree-call-cdce.c: Include stor-layout.h. * tree-cfg.c: Include trans-mem.h. Include stor-layout.h. Include print-tree.h. * tree-complex.c: Include stor-layout.h. * tree-data-ref.c: Include expr.h. * tree-dfa.c: Include stor-layout.h. * tree-eh.c: Include expr.h. Include calls.h. * tree-emutls.c: Include stor-layout.h. Include varasm.h. * tree-if-conv.c: Include stor-layout.h. * tree-inline.c: Include stor-layout.h. Include calls.h. * tree-loop-distribution.c: Include stor-layout.h. * tree-nested.c: Include stringpool.h. Include stor-layout.h. * tree-object-size.c: Include tree-object-size.h. * tree-outof-ssa.c: Include stor-layout.h. * tree-parloops.c: Include stor-layout.h. Include tree-nested.h. * tree-pretty-print.c: Include stor-layout.h. Include expr.h. * tree-profile.c: Include varasm.h. Include tree-nested.h. * tree-scalar-evolution.c: Include expr.h. * tree-sra.c: Include stor-layout.h. * tree-ssa-address.c: Include stor-layout.h. * tree-ssa-ccp.c: Include stor-layout.h. * tree-ssa-dce.c: Include calls.h. * tree-ssa-dom.c: Include stor-layout.h. * tree-ssa-forwprop.c: Include stor-layout.h. * tree-ssa-ifcombine.c: Include stor-layout.h. * tree-ssa-loop-ivopts.c: Include stor-layout.h. * tree-ssa-loop-niter.c: Include calls.h. Include expr.h. * tree-ssa-loop-prefetch.c: Include stor-layout.h. * tree-ssa-math-opts.c: Include stor-layout.h. * tree-ssa-operands.c: Include stmt.h. Include print-tree.h. * tree-ssa-phiopt.c: Include stor-layout.h. * tree-ssa-reassoc.c: Include stor-layout.h. * tree-ssa-sccvn.c: Include stor-layout.h. * tree-ssa-sink.c: Include stor-layout.h. * tree-ssa-strlen.c: Include stor-layout.h. * tree-ssa-structalias.c: Include stor-layout.h. Include stmt.h. * tree-ssa-tail-merge.c: Include stor-layout.h. Include trans-mem.h. * tree-ssa-uncprop.c: Include stor-layout.h. * tree-ssa.c: Include stor-layout.h. * tree-ssanames.c: Include stor-layout.h. * tree-streamer-in.c: Include stringpool.h. * tree-streamer-out.c: Include stor-layout.h. * tree-switch-conversion.c: Include varasm.h. Include stor-layout.h. * tree-tailcall.c: Include stor-layout.h. * tree-vect-data-refs.c: Include stor-layout.h. * tree-vect-generic.c: Include stor-layout.h. * tree-vect-loop.c: Include stor-layout.h. * tree-vect-patterns.c: Include stor-layout.h. * tree-vect-slp.c: Include stor-layout.h. * tree-vect-stmts.c: Include stor-layout.h. * tree-vectorizer.c: Include stor-layout.h. * tree-vrp.c: Include stor-layout.h. Include calls.h. * tree.c: Include stor-layout.h. Include calls.h. Include attribs.h. Include varasm.h. * tsan.c: Include expr.h. * ubsan.c: Include stor-layout.h. Include stringpool.h. * value-prof.c: Include tree-nested.h. Include calls.h. * var-tracking.c: Include varasm.h. Include stor-layout.h. * varasm.c: Include stor-layout.h. Include stringpool.h. Include gcc-symtab.h. Include varasm.h. * varpool.c: Include varasm.h. * vmsdbgout.c: Include varasm.h. * xcoffout.c: Include varasm.h. ada/ChangeLog * gcc-interface/decl.c: Include stringpool.h Include stor-layout.h * gcc-interface/misc.c: Include stor-layout.h Include print-tree.h * gcc-interface/trans.c: Include stringpool.h Include stor-layout.h Include stmt.h Include varasm.h * gcc-interface/utils.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h * gcc-interface/utils2.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h c-family/ChangeLog * c-common.c: Include fold-const.h. Include stor-layout.h. Include calls.h. Include stringpool.h. Include attribs.h. Include varasm.h. Include trans-mem.h. * c-cppbuiltin.c: Include stor-layout.h. Include stringpool.h. * c-format.c: Include stringpool.h. * c-lex.c: Include stringpool.h. Include stor-layout.h. * c-pragma.c: Include stringpool.h. Include attribs.h. Include varasm.h. Include gcc-symtab.h. * c-pretty-print.c: Include stor-layout.h. Include attribs.h. * cilk.c: Include stringpool.h. Include calls.h. c/ChangeLog * c-decl.c: Include print-tree.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include stringpool.h. * c-lang.c: Include fold-const.h. * c-parser.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. Include varasm.h. Include trans-mem.h. * c-typeck.c: Include stor-layout.h. Include trans-mem.h. Include varasm.h. Include stmt.h. cp/ChangeLog * call.c: Include stor-layout.h. Include trans-mem.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * cp-gimplify.c: Include stor-layout.h. * cvt.c: Include stor-layout.h. * decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include calls.h. * decl2.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. Include calls.h. * error.c: Include stringpool.h. * except.c: Include stringpool.h. Include trans-mem.h. Include attribs.h. * init.c: Include stringpool.h. Include varasm.h. * lambda.c: Include stringpool.h. * lex.c: Include stringpool.h. * mangle.c: Include stor-layout.h. Include stringpool.h. * method.c: Include stringpool.h. Include varasm.h. * name-lookup.c: Include stringpool.h. Include print-tree.h. Include attribs.h. * optimize.c: Include stringpool.h. * parser.c: Include print-tree.h. Include stringpool.h. Include attribs.h. Include trans-mem.h. * pt.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. * ptree.c: Include print-tree.h. * repo.c: Include stringpool.h. * rtti.c: Include stringpool.h. Include stor-layout.h. * semantics.c: Include stmt.h. Include varasm.h. Include stor-layout.h. Include stringpool.h. * tree.c: Include stor-layout.h. Include print-tree.h. Include tree-iterator.h. * typeck.c: Include stor-layout.h. Include varasm.h. * typeck2.c: Include stor-layout.h. Include varasm.h. * vtable-class-hierarchy.c: Include stringpool.h. Include stor-layout.h. fortran/ChangeLog * decl.c: Include stringpool.h. * iresolve.c: Include stringpool.h. * match.c: Include stringpool.h. * module.c: Include stringpool.h. * target-memory.c: Include stor-layout.h. * trans-common.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * trans-const.c: Include stor-layout.h. * trans-decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. * trans-expr.c: Include stringpool.h. * trans-intrinsic.c: Include stringpool.h. Include tree-nested.h. Include stor-layout.h. * trans-io.c: Include stringpool.h. Include stor-layout.h. * trans-openmp.c: Include stringpool.h. * trans-stmt.c: Include stringpool.h. * trans-types.c: Include stor-layout.h. Include stringpool.h. * trans.c: Include stringpool.h. go/ChangeLog * go-backend.c: Include stor-layout.h. * go-gcc.cc: Include stringpool.h. Include stor-layout.h. Include varasm.h. * go-lang.c: Include stor-layout.h. java/ChangeLog * builtins.c: Include stor-layout.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * constants.c: Include stringpool.h. Include stor-layout.h. * decl.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. * jcf-parse.c: Include stringpool.h. * mangle.c: Include stringpool.h. * resource.c: Include stringpool.h. Include stor-layout.h. * typeck.c: Include stor-layout.h. Include stringpool.h. * verify-glue.c: Include stringpool.h. lto/ChangeLog * lto-lang.c: Include stringpool.h. Include stor-layout.h. * lto-partition.c: Include gcc-symtab.h. * lto.c: Include stor-layout.h. objc/ChangeLog * objc-act.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * objc-encoding.c: Include stringpool.h. Include stor-layout.h. * objc-gnu-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-02.c: Include stringpool.h. * objc-runtime-shared-support.c: Include stringpool.h. testsuite/ChangeLog * gcc.dg/plugin/selfassign.c: Include stringpool.h. * gcc.dg/plugin/start_unit_plugin.c: Likewise. From-SVN: r205023
2013-11-19 13:31:09 +01:00
#include "stringpool.h"
decl.c: Reorder #include's and remove duplicates. ada 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/decl.c: Reorder #include's and remove duplicates. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Reorder #include's and remove duplicates. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Reorder #include's and remove duplicates. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * call.c: Reorder #include's and remove duplicates. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. fortran 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array.c: Reorder #include's and remove duplicates. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * resolve.c: Likewise. * simplify.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Reorder #include's and remove duplicates. * go-lang.c: Likewise. java 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Reorder #include's and remove duplicates. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. jit 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Reorder #include's and remove duplicates. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * libgccjit.c: Likewise. lto 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Reorder #include's and remove duplicates. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objc-lang.c: Reorder #include's and remove duplicates. * objc-map.c: Likewise. objcp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Reorder #include's and remove duplicates. * objcp-lang.c: Likewise. From-SVN: r229533
2015-10-29 16:27:20 +01:00
#include "cgraph.h"
Factor unrelated declarations out of tree.h. This patch applies the rule that functions defined in FOO.c must be declared in FOO.h. One of the worst offenders in the code base is tree.h, unsurprisingly. The patch creates several new headers: attribs.h calls.h fold-const.h gcc-symtab.h print-rtl.h print-tree.h stmt.h stor-layout.h stringpool.h tree-nested.h tree-object-size.h varasm.h. Functions in each corresponding .c file got moved to those headers and others that already existed. I wanted to make this patch as mechanical as possible, so I made no attempt to fix problems like having build_addr defined in tree-inline.c. I left that for later. There were some declarations that I could not move out of tree.h because of header poisoning or the use of target macros. We forbid the inclusion of things like expr.h from FE files. While that's a reasonable idea, the FE file *still* manage to at expr.c functionality because the declarations they want to use were defined in tree.h. The affected files are builtins.h, emit-rtl.h and expr.h. If that functionality is allowed to be accessed from the FEs, then I will later move those functions out of expr.c into tree.c. I have moved these declarations to the bottom of tree.h so they are easy to identify later. There is a namespace collision with libcpp. The file gcc/symtab.c cannot use gcc/symtab.h because the #include command picks up libcpp/include/symtab.h first. So I named this file gcc-symtab.h for now. Finally, I added a new header to PLUGIN_HEADERS to account for the tree.h refactoring. I did not add all headers factored out of tree.h because it is unclear (and impossible to tell) what plugins need. This adds the one header used by the plugins in the testsuite. This will be changing quite dramatically as we progress with the header refactoring. This patch should offer some minimal incremental build advantages by reducing the size of tree.h. Changes that would otherwise affected tree.h, will now go to other headers which are less frequently included. * tree.h: Include fold-const.h. (aggregate_value_p): Moved to function.h. (alloca_call_p): Moved to calls.h. (allocate_struct_function): Moved to function.h. (apply_tm_attr): Moved to attribs.h. (array_at_struct_end_p): Moved to expr.h. (array_ref_element_size): Moved to tree-dfa.h. (array_ref_low_bound): Moved to tree-dfa.h. (array_ref_up_bound): Moved to tree.h. (assemble_alias): Moved to cgraph.h. (bit_from_pos): Moved to stor-layout.h. (build_addr): Moved to tree-nested.h. (build_duplicate_type): Moved to tree-inline.h. (build_fold_addr_expr): Moved to fold-const.h. (build_fold_addr_expr_with_type): Moved to fold-const.h. (build_fold_addr_expr_with_type_loc): Moved to fold-const.h. (build_fold_indirect_ref): Moved to fold-const.h. (build_fold_indirect_ref_loc): Moved to fold-const.h. (build_personality_function): Moved to tree.h. (build_range_check): Moved to fold-const.h. (build_simple_mem_ref): Moved to fold-const.h. (build_simple_mem_ref_loc): Moved to fold-const.h. (build_tm_abort_call): Moved to trans-mem.h. (byte_from_pos): Moved to stor-layout.h. (call_expr_flags): Moved to calls.h. (can_move_by_pieces): Moved to expr.h. (categorize_ctor_elements): Moved to expr.h. (change_decl_assembler_name): Moved to gcc-symtab.h. (combine_comparisons): Moved to fold-const.h. (complete_ctor_at_level_p): Moved to tree.h. (component_ref_field_offset): Moved to tree-dfa.h. (compute_builtin_object_size): Moved to tree-object-size.h. (compute_record_mode): Moved to stor-layout.h. (constant_boolean_node): Moved to fold-const.h. (constructor_static_from_elts_p): Moved to varasm.h. (cxx11_attribute_p): Moved to attribs.h. (debug_body): Moved to print-tree.h. (debug_find_tree): Moved to tree-inline.h. (debug_fold_checksum): Moved to fold-const.h. (debug_head): Moved to print-tree.h. (debug_head): Moved to print-tree.h. (debug_raw): Moved to print-tree.h. (debug_tree): Moved to print-tree.h. (debug_vec_tree): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (decl_attributes): Moved to attribs.h. (decl_binds_to_current_def_p): Moved to varasm.h. (decl_default_tls_model): Moved to varasm.h. (decl_replaceable_p): Moved to varasm.h. (div_if_zero_remainder): Moved to fold-const.h. (double_int mem_ref_offset): Moved to fold-const.h. (dump_addr): Moved to print-tree.h. (element_precision): Moved to machmode.h. (expand_dummy_function_end): Moved to function.h. (expand_function_end): Moved to function.h. (expand_function_start): Moved to function.h. (expand_label): Moved to stmt.h. (expr_first): Moved to tree-iterator.h. (expr_last): Moved to tree-iterator.h. (finalize_size_functions): Moved to stor-layout.h. (finish_builtin_struct): Moved to stor-layout.h. (finish_record_layout): Moved to stor-layout.h. (fixup_signed_type): Moved to stor-layout.h. (fixup_unsigned_type): Moved to stor-layout.h. (flags_from_decl_or_type): Moved to calls.h. (fold): Moved to fold-const.h. (fold_abs_const): Moved to fold-const.h. (fold_binary): Moved to fold-const.h. (fold_binary_loc): Moved to fold-const.h. (fold_binary_to_constant): Moved to fold-const.h. (fold_build1): Moved to fold-const.h. (fold_build1_initializer_loc): Moved to fold-const.h. (fold_build1_loc): Moved to fold-const.h. (fold_build1_stat_loc): Moved to fold-const.h. (fold_build2): Moved to fold-const.h. (fold_build2_initializer_loc): Moved to fold-const.h. (fold_build2_loc): Moved to fold-const.h. (fold_build2_stat_loc): Moved to fold-const.h. (fold_build3): Moved to fold-const.h. (fold_build3_loc): Moved to fold-const.h. (fold_build3_stat_loc): Moved to fold-const.h. (fold_build_call_array): Moved to fold-const.h. (fold_build_call_array_initializer): Moved to fold-const.h. (fold_build_call_array_initializer_loc): Moved to fold-const.h. (fold_build_call_array_loc): Moved to fold-const.h. (fold_build_cleanup_point_expr): Moved to fold-const.h. (fold_convert): Moved to fold-const.h. (fold_convert_loc): Moved to fold-const.h. (fold_convertible_p): Moved to fold-const.h. (fold_defer_overflow_warnings): Moved to fold-const.h. (fold_deferring_overflow_warnings_p): Moved to fold-const.h. (fold_fma): Moved to fold-const.h. (fold_ignored_result): Moved to fold-const.h. (fold_indirect_ref): Moved to fold-const.h. (fold_indirect_ref_1): Moved to fold-const.h. (fold_indirect_ref_loc): Moved to fold-const.h. (fold_read_from_constant_string): Moved to fold-const.h. (fold_real_zero_addition_p): Moved to fold-const.h. (fold_single_bit_test): Moved to fold-const.h. (fold_strip_sign_ops): Moved to fold-const.h. (fold_ternary): Moved to fold-const.h. (fold_ternary_loc): Moved to fold-const.h. (fold_unary): Moved to tree-data-ref.h. (fold_unary_ignore_overflow): Moved to fold-const.h. (fold_unary_ignore_overflow_loc): Moved to fold-const.h. (fold_unary_loc): Moved to fold-const.h. (fold_unary_to_constant): Moved to fold-const.h. (fold_undefer_and_ignore_overflow_warnings): Moved to fold-const.h. (fold_undefer_overflow_warnings): Moved to fold-const.h. (folding_initializer): Moved to fold-const.h. (free_temp_slots): Moved to function.h. (generate_setjmp_warnings): Moved to function.h. (get_attribute_name): Moved to attribs.h. (get_identifier): Moved to stringpool.h. (get_identifier_with_length): Moved to stringpool.h. (get_inner_reference): Moved to tree.h. (gimple_alloca_call_p): Moved to calls.h. (gimplify_parameters): Moved to function.h. (highest_pow2_factor): Moved to expr.h. (indent_to): Moved to print-tree.h. (init_attributes): Moved to attribs.h. (init_dummy_function_start): Moved to function.h. (init_function_start): Moved to function.h. (init_inline_once): Moved to tree-inline.h. (init_object_sizes): Moved to tree-object-size.h. (init_temp_slots): Moved to function.h. (init_tree_optimization_optabs): Moved to optabs.h. (initialize_sizetypes): Moved to stor-layout.h. (initializer_constant_valid_for_bitfield_p): Moved to varasm.h. (initializer_constant_valid_p): Moved to varasm.h. (int_const_binop): Moved to fold-const.h. (internal_reference_types): Moved to stor-layout.h. (invert_tree_comparison): Moved to fold-const.h. (invert_truthvalue): Moved to fold-const.h. (invert_truthvalue_loc): Moved to fold-const.h. (is_tm_ending_fndecl): Moved to trans-mem.h. (is_tm_may_cancel_outer): Moved to trans-mem.h. (is_tm_pure): Moved to trans-mem.h. (is_tm_safe): Moved to trans-mem.h. (layout_decl): Moved to stor-layout.h. (layout_type): Moved to stor-layout.h. (lookup_attribute_spec): Moved to attribs.h. (make_accum_type): Moved to stor-layout.h. (make_decl_one_only): Moved to varasm.h. (make_decl_rtl): Moved to tree.h. (make_decl_rtl_for_debug): Moved to varasm.h. (make_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_fract_type): Moved to stor-layout.h. (make_or_reuse_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_unsigned_fract_type): Moved to stor-layout.h. (make_range): Moved to fold-const.h. (make_range_step): Moved to fold-const.h. (make_sat_signed_accum_type): Moved to stor-layout.h. (make_sat_signed_fract_type): Moved to stor-layout.h. (make_sat_unsigned_accum_type): Moved to stor-layout.h. (make_sat_unsigned_fract_type): Moved to stor-layout.h. (make_signed_accum_type): Moved to stor-layout.h. (make_signed_fract_type): Moved to stor-layout.h. (make_signed_type): Moved to stor-layout.h. (make_unsigned_accum_type): Moved to stor-layout.h. (make_unsigned_fract_type): Moved to stor-layout.h. (make_unsigned_type): Moved to stor-layout.h. (mark_decl_referenced): Moved to varasm.h. (mark_referenced): Moved to varasm.h. (may_negate_without_overflow_p): Moved to fold-const.h. (maybe_get_identifier): Moved to stringpool.h. (merge_ranges): Moved to fold-const.h. (merge_weak): Moved to varasm.h. (mode_for_size_tree): Moved to stor-layout.h. (multiple_of_p): Moved to fold-const.h. (must_pass_in_stack_var_size): Moved to calls.h. (must_pass_in_stack_var_size_or_pad): Moved to calls.h. (native_encode_expr): Moved to fold-const.h. (native_interpret_expr): Moved to fold-const.h. (non_lvalue): Moved to fold-const.h. (non_lvalue_loc): Moved to fold-const.h. (normalize_offset): Moved to stor-layout.h. (normalize_rli): Moved to stor-layout.h. (notice_global_symbol): Moved to varasm.h. (omit_one_operand): Moved to fold-const.h. (omit_one_operand_loc): Moved to fold-const.h. (omit_two_operands): Moved to fold-const.h. (omit_two_operands_loc): Moved to fold-const.h. (operand_equal_p): Moved to tree-data-ref.h. (parse_input_constraint): Moved to stmt.h. (parse_output_constraint): Moved to stmt.h. (place_field): Moved to stor-layout.h. (pop_function_context): Moved to function.h. (pop_temp_slots): Moved to function.h. (pos_from_bit): Moved to stor-layout.h. (preserve_temp_slots): Moved to function.h. (print_node): Moved to print-tree.h. (print_node_brief): Moved to print-tree.h. (print_rtl): Moved to rtl.h. (process_pending_assemble_externals): Moved to varasm.h. (ptr_difference_const): Moved to fold-const.h. (push_function_context): Moved to function.h. (push_struct_function): Moved to function.h. (push_temp_slots): Moved to function.h. (record_tm_replacement): Moved to trans-mem.h. (relayout_decl): Moved to stor-layout.h. (resolve_asm_operand_names): Moved to stmt.h. (resolve_unique_section): Moved to varasm.h. (rli_size_so_far): Moved to stor-layout.h. (rli_size_unit_so_far): Moved to stor-layout.h. (round_down): Moved to fold-const.h. (round_down_loc): Moved to fold-const.h. (round_up): Moved to fold-const.h. (round_up_loc): Moved to fold-const.h. (set_decl_incoming_rtl): Moved to emit-rtl.h. (set_decl_rtl): Moved to tree.h. (set_min_and_max_values_for_integral_type): Moved to stor-layout.h. (set_user_assembler_name): Moved to varasm.h. (setjmp_call_p): Moved to calls.h. (size_binop): Moved to fold-const.h. (size_binop_loc): Moved to fold-const.h. (size_diffop): Moved to fold-const.h. (size_diffop_loc): Moved to fold-const.h. (size_int_kind): Moved to fold-const.h. (stack_protect_epilogue): Moved to function.h. (start_record_layout): Moved to stor-layout.h. (supports_one_only): Moved to varasm.h. (swap_tree_comparison): Moved to fold-const.h. (tm_malloc_replacement): Moved to trans-mem.h. (tree build_fold_addr_expr_loc): Moved to fold-const.h. (tree build_invariant_address): Moved to fold-const.h. (tree_binary_nonnegative_warnv_p): Moved to fold-const.h. (tree_binary_nonzero_warnv_p): Moved to fold-const.h. (tree_call_nonnegative_warnv_p): Moved to fold-const.h. (tree_expr_nonnegative_p): Moved to fold-const.h. (tree_expr_nonnegative_warnv_p): Moved to fold-const.h. (tree_output_constant_def): Moved to varasm.h. (tree_overlaps_hard_reg_set): Moved to stmt.h. (tree_single_nonnegative_warnv_p): Moved to fold-const.h. (tree_single_nonzero_warnv_p): Moved to fold-const.h. (tree_swap_operands_p): Moved to fold-const.h. (tree_unary_nonnegative_warnv_p): Moved to fold-const.h. (tree_unary_nonzero_warnv_p): Moved to fold-const.h. (update_alignment_for_field): Moved to stor-layout.h. (use_register_for_decl): Moved to function.h. (variable_size): Moved to rtl.h. (vector_type_mode): Moved to stor-layout.h. * cgraph.h: Corresponding changes. * emit-rtl.h: Corresponding changes. * expr.h: Corresponding changes. * function.h: Corresponding changes. * optabs.h: Corresponding changes. * trans-mem.h: Corresponding changes. Protect against multiple inclusion. * tree-inline.h: Corresponding changes. * tree-iterator.h: Corresponding changes. * tree-dfa.h: Include expr.h. * tree-ssanames.h: Include stringpool.h. * attribs.h: New file. * calls.h: New file. * fold-const.h: New file. * gcc-symtab.h: New file. * print-rtl.h: New file. * print-tree.h: New file. * stmt.h: New file. * stor-layout.h: New file. * strinpool.h: New file. * tree-nested.h: New file * tree-object-size.h: New file. * varasm.h: New file. * Makefile.in (PLUGIN_HEADERS): Add stringpool.h. * alias.c: Include varasm.h. Include expr.h. * asan.c: Include calls.h. Include stor-layout.h. Include varasm.h. * attribs.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. * builtins.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. Include tree-object-size.h. * calls.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include attribs.h. * cfgexpand.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. * cgraph.c: Include varasm.h. Include calls.h. Include print-tree.h. * cgraphclones.c: Include stringpool.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * cgraphunit.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * cilk-common.c: Include stringpool.h. Include stor-layout.h. * combine.c: Include stor-layout.h. * config/aarch64/aarch64-builtins.c: Include stor-layout.h. Include stringpool.h. Include calls.h. * config/aarch64/aarch64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/alpha/alpha.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/arc/arc.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. Include calls.h. * config/arm/arm.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/avr/avr-c.c: Include stor-layout.h. * config/avr/avr-log.c: Include print-tree.h. * config/avr/avr.c: Include print-tree.h. Include calls.h. Include stor-layout.h. Include stringpool.h. * config/bfin/bfin.c: Include varasm.h. Include calls.h. * config/c6x/c6x.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/cr16/cr16.c: Include stor-layout.h. Include calls.h. * config/cris/cris.c: Include varasm.h. Include stor-layout.h. Include calls.h. Include stmt.h. * config/darwin.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. * config/epiphany/epiphany.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/fr30/fr30.c: Include stor-layout.h. Include varasm.h. * config/frv/frv.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * config/h8300/h8300.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/i386/i386.c: Include stringpool.h. Include attribs.h. Include calls.h. Include stor-layout.h. Include varasm.h. * config/i386/winnt-cxx.c: Include stringpool.h. Include attribs.h. * config/i386/winnt.c: Include stringpool.h. Include varasm.h. * config/ia64/ia64-c.c: Include stringpool.h. * config/ia64/ia64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/iq2000/iq2000.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/lm32/lm32.c: Include calls.h. * config/m32c/m32c.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/m32r/m32r.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/m68k/m68k.c: Include calls.h. Include stor-layout.h. Include varasm.h. * config/mcore/mcore.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/mep/mep.c: Include varasm.h. Include calls.h. Include stringpool.h. Include stor-layout.h. * config/microblaze/microblaze.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mips/mips.c: Include varasm.h. Include stringpool.h. Include stor-layout.h. Include calls.h. * config/mmix/mmix.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mn10300/mn10300.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/moxie/moxie.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/msp430/msp430.c: Include stor-layout.h. Include calls.h. * config/nds32/nds32.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/pa/pa.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include calls.h. * config/pdp11/pdp11.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/picochip/picochip.c: Include calls.h. Include stor-layout.h. Include stringpool.h. Include varasm.h. * config/rl78/rl78.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/rs6000/rs6000-c.c: Include stor-layout.h. Include stringpool.h. * config/rs6000/rs6000.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include print-tree.h. Include varasm.h. * config/rx/rx.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/s390/s390.c: Include print-tree.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/score/score.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. * config/sh/sh-c.c: Include stringpool.h. Include attribs.h.h. * config/sh/sh.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/sol2-c.c: Include stringpool.h. Include attribs.h. * config/sol2-cxx.c: Include stringpool.h. * config/sol2.c: Include stringpool.h. Include varasm.h. * config/sparc/sparc.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/spu/spu-c.c: Include stringpool.h. * config/spu/spu.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/stormy16/stormy16.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilegx/tilegx.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilepro/tilepro.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/v850/v850-c.c: Include stringpool.h. Include attribs.h. * config/v850/v850.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/vax/vax.c: Include calls.h. Include varasm.h. * config/vms/vms.c: Include stringpool.h. * config/vxworks.c: Include stringpool.h. * config/xtensa/xtensa.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * convert.c: Include stor-layout.h. * coverage.c: Include stringpool.h. Include stor-layout.h. * dbxout.c: Include varasm.h. Include stor-layout.h. * dojump.c: Include stor-layout.h. * dse.c: Include stor-layout.h. * dwarf2asm.c: Include stringpool.h. Include varasm.h. * dwarf2cfi.c: Include stor-layout.h. * dwarf2out.c: Include rtl.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * emit-rtl.c: Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * explow.c: Include stor-layout.h. * expmed.c: Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. Include varasm.h. * final.c: Include varasm.h. * fold-const.c: Include stor-layout.h. Include calls.h. Include tree-iterator.h. * function.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. * genattrtab.c (write_header): Emit includes for varasm.h, stor-layout.h and calls.h. * genautomata.c (main): Likewise. * genemit.c: Likewise. * genopinit.c: Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c: Likewise. * genpreds.c (write_insn_preds_c): Likewise. * gengtype.c (open_base_files): Add stringpool.h. * gimple-expr.c: Include stringpool.h. Include stor-layout.h. * gimple-fold.c: Include stringpool.h. Include expr.h. Include stmt.h. Include stor-layout.h. * gimple-low.c: Include tree-nested.h. Include calls.h. * gimple-pretty-print.c: Include stringpool.h. * gimple-ssa-strength-reduction.c: Include stor-layout.h. Include expr.h. * gimple-walk.c: Include stmt.h. * gimple.c: Include calls.h. Include stmt.h. Include stor-layout.h. * gimplify.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. Include expr.h. * gimplify-me.c: Include stmt.h Include stor-layout.h * internal-fn.c: Include stor-layout.h. * ipa-devirt.c: Include print-tree.h. Include calls.h. * ipa-inline-analysis.c: Include stor-layout.h. Include stringpool.h. Include print-tree.h. * ipa-inline.c: Include trans-mem.h. Include calls.h. * ipa-prop.c: Include expr.h. Include stor-layout.h. Include print-tree.h. * ipa-pure-const.c: Include print-tree.h. Include calls.h. * ipa-reference.c: Include calls.h. * ipa-split.c: Include stringpool.h. Include expr.h. Include calls.h. * ipa.c: Include calls.h. Include stringpool.h. * langhooks.c: Include stringpool.h. Include attribs.h. * lto-cgraph.c: Include stringpool.h. * lto-streamer-in.c: Include stringpool.h. * lto-streamer-out.c: Include stor-layout.h. Include stringpool.h. * omp-low.c: Include stringpool.h. Include stor-layout.h. Include expr.h. * optabs.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * passes.c: Include varasm.h. * predict.c: Include calls.h. * print-rtl.c: Include print-tree.h. * print-tree.c: Include varasm.h. Include print-rtl.h. Include stor-layout.h. * realmpfr.c: Include stor-layout.h. * reg-stack.c: Include varasm.h. * sdbout.c: Include varasm.h. Include stor-layout.h. * simplify-rtx.c: Include varasm.h. * stmt.c: Include varasm.h. Include stor-layout.h. * stor-layout.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include print-tree.h. * symtab.c: Include rtl.h. Include print-tree.h. Include varasm.h. Include function.h. Include emit-rtl.h. * targhooks.c: Include stor-layout.h. Include varasm.h. * toplev.c: Include varasm.h. Include tree-inline.h. * trans-mem.c: Include calls.h. Include function.h. Include rtl.h. Include emit-rtl.h. * tree-affine.c: Include expr.h. * tree-browser.c: Include print-tree.h. * tree-call-cdce.c: Include stor-layout.h. * tree-cfg.c: Include trans-mem.h. Include stor-layout.h. Include print-tree.h. * tree-complex.c: Include stor-layout.h. * tree-data-ref.c: Include expr.h. * tree-dfa.c: Include stor-layout.h. * tree-eh.c: Include expr.h. Include calls.h. * tree-emutls.c: Include stor-layout.h. Include varasm.h. * tree-if-conv.c: Include stor-layout.h. * tree-inline.c: Include stor-layout.h. Include calls.h. * tree-loop-distribution.c: Include stor-layout.h. * tree-nested.c: Include stringpool.h. Include stor-layout.h. * tree-object-size.c: Include tree-object-size.h. * tree-outof-ssa.c: Include stor-layout.h. * tree-parloops.c: Include stor-layout.h. Include tree-nested.h. * tree-pretty-print.c: Include stor-layout.h. Include expr.h. * tree-profile.c: Include varasm.h. Include tree-nested.h. * tree-scalar-evolution.c: Include expr.h. * tree-sra.c: Include stor-layout.h. * tree-ssa-address.c: Include stor-layout.h. * tree-ssa-ccp.c: Include stor-layout.h. * tree-ssa-dce.c: Include calls.h. * tree-ssa-dom.c: Include stor-layout.h. * tree-ssa-forwprop.c: Include stor-layout.h. * tree-ssa-ifcombine.c: Include stor-layout.h. * tree-ssa-loop-ivopts.c: Include stor-layout.h. * tree-ssa-loop-niter.c: Include calls.h. Include expr.h. * tree-ssa-loop-prefetch.c: Include stor-layout.h. * tree-ssa-math-opts.c: Include stor-layout.h. * tree-ssa-operands.c: Include stmt.h. Include print-tree.h. * tree-ssa-phiopt.c: Include stor-layout.h. * tree-ssa-reassoc.c: Include stor-layout.h. * tree-ssa-sccvn.c: Include stor-layout.h. * tree-ssa-sink.c: Include stor-layout.h. * tree-ssa-strlen.c: Include stor-layout.h. * tree-ssa-structalias.c: Include stor-layout.h. Include stmt.h. * tree-ssa-tail-merge.c: Include stor-layout.h. Include trans-mem.h. * tree-ssa-uncprop.c: Include stor-layout.h. * tree-ssa.c: Include stor-layout.h. * tree-ssanames.c: Include stor-layout.h. * tree-streamer-in.c: Include stringpool.h. * tree-streamer-out.c: Include stor-layout.h. * tree-switch-conversion.c: Include varasm.h. Include stor-layout.h. * tree-tailcall.c: Include stor-layout.h. * tree-vect-data-refs.c: Include stor-layout.h. * tree-vect-generic.c: Include stor-layout.h. * tree-vect-loop.c: Include stor-layout.h. * tree-vect-patterns.c: Include stor-layout.h. * tree-vect-slp.c: Include stor-layout.h. * tree-vect-stmts.c: Include stor-layout.h. * tree-vectorizer.c: Include stor-layout.h. * tree-vrp.c: Include stor-layout.h. Include calls.h. * tree.c: Include stor-layout.h. Include calls.h. Include attribs.h. Include varasm.h. * tsan.c: Include expr.h. * ubsan.c: Include stor-layout.h. Include stringpool.h. * value-prof.c: Include tree-nested.h. Include calls.h. * var-tracking.c: Include varasm.h. Include stor-layout.h. * varasm.c: Include stor-layout.h. Include stringpool.h. Include gcc-symtab.h. Include varasm.h. * varpool.c: Include varasm.h. * vmsdbgout.c: Include varasm.h. * xcoffout.c: Include varasm.h. ada/ChangeLog * gcc-interface/decl.c: Include stringpool.h Include stor-layout.h * gcc-interface/misc.c: Include stor-layout.h Include print-tree.h * gcc-interface/trans.c: Include stringpool.h Include stor-layout.h Include stmt.h Include varasm.h * gcc-interface/utils.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h * gcc-interface/utils2.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h c-family/ChangeLog * c-common.c: Include fold-const.h. Include stor-layout.h. Include calls.h. Include stringpool.h. Include attribs.h. Include varasm.h. Include trans-mem.h. * c-cppbuiltin.c: Include stor-layout.h. Include stringpool.h. * c-format.c: Include stringpool.h. * c-lex.c: Include stringpool.h. Include stor-layout.h. * c-pragma.c: Include stringpool.h. Include attribs.h. Include varasm.h. Include gcc-symtab.h. * c-pretty-print.c: Include stor-layout.h. Include attribs.h. * cilk.c: Include stringpool.h. Include calls.h. c/ChangeLog * c-decl.c: Include print-tree.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include stringpool.h. * c-lang.c: Include fold-const.h. * c-parser.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. Include varasm.h. Include trans-mem.h. * c-typeck.c: Include stor-layout.h. Include trans-mem.h. Include varasm.h. Include stmt.h. cp/ChangeLog * call.c: Include stor-layout.h. Include trans-mem.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * cp-gimplify.c: Include stor-layout.h. * cvt.c: Include stor-layout.h. * decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include calls.h. * decl2.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. Include calls.h. * error.c: Include stringpool.h. * except.c: Include stringpool.h. Include trans-mem.h. Include attribs.h. * init.c: Include stringpool.h. Include varasm.h. * lambda.c: Include stringpool.h. * lex.c: Include stringpool.h. * mangle.c: Include stor-layout.h. Include stringpool.h. * method.c: Include stringpool.h. Include varasm.h. * name-lookup.c: Include stringpool.h. Include print-tree.h. Include attribs.h. * optimize.c: Include stringpool.h. * parser.c: Include print-tree.h. Include stringpool.h. Include attribs.h. Include trans-mem.h. * pt.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. * ptree.c: Include print-tree.h. * repo.c: Include stringpool.h. * rtti.c: Include stringpool.h. Include stor-layout.h. * semantics.c: Include stmt.h. Include varasm.h. Include stor-layout.h. Include stringpool.h. * tree.c: Include stor-layout.h. Include print-tree.h. Include tree-iterator.h. * typeck.c: Include stor-layout.h. Include varasm.h. * typeck2.c: Include stor-layout.h. Include varasm.h. * vtable-class-hierarchy.c: Include stringpool.h. Include stor-layout.h. fortran/ChangeLog * decl.c: Include stringpool.h. * iresolve.c: Include stringpool.h. * match.c: Include stringpool.h. * module.c: Include stringpool.h. * target-memory.c: Include stor-layout.h. * trans-common.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * trans-const.c: Include stor-layout.h. * trans-decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. * trans-expr.c: Include stringpool.h. * trans-intrinsic.c: Include stringpool.h. Include tree-nested.h. Include stor-layout.h. * trans-io.c: Include stringpool.h. Include stor-layout.h. * trans-openmp.c: Include stringpool.h. * trans-stmt.c: Include stringpool.h. * trans-types.c: Include stor-layout.h. Include stringpool.h. * trans.c: Include stringpool.h. go/ChangeLog * go-backend.c: Include stor-layout.h. * go-gcc.cc: Include stringpool.h. Include stor-layout.h. Include varasm.h. * go-lang.c: Include stor-layout.h. java/ChangeLog * builtins.c: Include stor-layout.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * constants.c: Include stringpool.h. Include stor-layout.h. * decl.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. * jcf-parse.c: Include stringpool.h. * mangle.c: Include stringpool.h. * resource.c: Include stringpool.h. Include stor-layout.h. * typeck.c: Include stor-layout.h. Include stringpool.h. * verify-glue.c: Include stringpool.h. lto/ChangeLog * lto-lang.c: Include stringpool.h. Include stor-layout.h. * lto-partition.c: Include gcc-symtab.h. * lto.c: Include stor-layout.h. objc/ChangeLog * objc-act.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * objc-encoding.c: Include stringpool.h. Include stor-layout.h. * objc-gnu-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-02.c: Include stringpool.h. * objc-runtime-shared-support.c: Include stringpool.h. testsuite/ChangeLog * gcc.dg/plugin/selfassign.c: Include stringpool.h. * gcc.dg/plugin/start_unit_plugin.c: Likewise. From-SVN: r205023
2013-11-19 13:31:09 +01:00
#include "varasm.h"
#include "toplev.h"
target-def.h (TARGET_HAVE_NAMED_SECTIONS): Move to common/common-target-def.h. * target-def.h (TARGET_HAVE_NAMED_SECTIONS): Move to common/common-target-def.h. * target.def (default_target_flags, handle_option, supports_split_stack, optimization_table, init_struct, except_unwind_info, unwind_tables_default, have_named_sections): Move to common/common-target.def. * target.h (enum opt_levels, struct default_options): Move to common/common-target.h. * targhooks.c (default_except_unwind_info, dwarf2_except_unwind_info, sjlj_except_unwind_info, default_target_handle_option, empty_optimization_table): Move to common/common-targhooks.c. * targhooks.h (default_except_unwind_info, dwarf2_except_unwind_info, sjlj_except_unwind_info, default_target_handle_option, empty_optimization_table): Move to common/common-targhooks.h. * common/common-target-def.h: Include common/common-targhooks.h. (TARGET_HAVE_NAMED_SECTIONS): Define if TARGET_ASM_NAMED_SECTION defined. * common/common-target.def (handle_option, option_init_struct, option_optimization_table, default_target_flags, except_unwind_info, supports_split_stack, unwind_tables_default, have_named_sections): Move from target.def. (HOOK_PREFIX): Undefine at end of file. * common/common-target.h: Include input.h. (enum opt_levels, struct default_options): Move from target.h. * common/common-targhooks.c, common/common-targhooks.h: New. * config.gcc (target_has_targetm_common): Default to yes. (moxie*): Set target_has_targetm_common=no. (hppa*-*-*): Don't set target_has_targetm_common=yes. * doc/tm.texi: Regenerate. * Makefile.in (COMMON_TARGET_H): Add $(INPUT_H). (C_TARGET_DEF_H): Add common/common-targhooks.h. (GCC_OBJS): Remove vec.o. (OBJS): Remove hooks.o and vec.o. (OBJS-libcommon-target): Add vec.o, hooks.o and common/common-targhooks.o. (c-family/c-common.o, c-family/c-cppbuiltin.o, lto-opts.o, tree.o, tree-tailcall.o, opts.o, toplev.o, varasm.o, function.o, except.o, expr.o, explow.o, dbxout.o, dwarf2out.o, cfgrtl.o, haifa-sched.o, cfglayout.o, $(out_object_file), $(common_out_object_file)): Update dependencies. (common/common-targhooks.o): New. * common/config/default-common.c: Include tm.h. Add FIXME comment. * common/config/pa/pa-common.c: Include more headers. Take copyright dates from pa.c. (pa_option_optimization_table, pa_handle_option, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Move from pa.c. * common/config/alpha/alpha-common.c, common/config/arm/arm-common.c, common/config/avr/avr-common.c, common/config/bfin/bfin-common.c, common/config/cris/cris-common.c, common/config/fr30/fr30-common.c, common/config/frv/frv-common.c, common/config/h8300/h8300-common.c, common/config/i386/i386-common.c, common/config/ia64/ia64-common.c, common/config/iq2000/iq2000-common.c, common/config/lm32/lm32-common.c, common/config/m32c/m32c-common.c, common/config/m32r/m32r-common.c, common/config/m68k/m68k-common.c, common/config/mcore/mcore-common.c, common/config/mep/mep-common.c, common/config/microblaze/microblaze-common.c, common/config/mips/mips-common.c, common/config/mmix/mmix-common.c, common/config/mn10300/mn10300-common.c, common/config/pdp11/pdp11-common.c, common/config/picochip/picochip-common.c, common/config/rs6000/rs6000-common.c, common/config/rx/rx-common.c, common/config/s390/s390-common.c, common/config/score/score-common.c, common/config/sh/sh-common.c, common/config/sparc/sparc-common.c, common/config/spu/spu-common.c, common/config/v850/v850-common.c, common/config/vax/vax-common.c, common/config/xstormy16/xstormy16-common.c, common/config/xtensa/xtensa-common.c: New. * config/alpha/alpha.c: Include common/common-target.h. (alpha_option_optimization_table, alpha_handle_option, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE): Move to alpha-common.c. * config/arm/arm-protos.h (arm_except_unwind_info): Declare. * config/arm/arm.c (arm_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO, arm_except_unwind_info): Move to arm-common.c. * config/avr/avr.c (avr_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to avr-common.c. * config/bfin/bfin.c (struct bfin_cpu): Move to bfin.h. (bfin_cpus, bfin_handle_option, TARGET_HANDLE_OPTION, TARGET_DEFAULT_TARGET_FLAGS): Move to bfin-common.c. * config/bfin/bfin.h struct bfin_cpu): Move from bfin.c. * config/cris/cris.c (cris_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, cris_handle_option): Move to cris-common.c. * config/fr30/fr30.c (fr30_option_optimization_table, TARGET_EXCEPT_UNWIND_INFO, TARGET_OPTION_OPTIMIZATION_TABLE): Move to fr30-common.c. * config/frv/frv.c (frv_option_optimization_table, MASK_DEFAULT_ALLOC_CC, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to frv-common.c. * config/h8300/h8300.c (h8300_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to h8300-common.c. * config/i386/i386-protos.h (ix86_handle_option): Declare. * config/i386/i386.c: Include common/common-target.h. (OPTION_MASK_ISA_MMX_SET, OPTION_MASK_ISA_3DNOW_SET, OPTION_MASK_ISA_SSE_SET, OPTION_MASK_ISA_SSE2_SET, OPTION_MASK_ISA_SSE3_SET, OPTION_MASK_ISA_SSSE3_SET, OPTION_MASK_ISA_SSE4_1_SET, OPTION_MASK_ISA_SSE4_2_SET, OPTION_MASK_ISA_AVX_SET, OPTION_MASK_ISA_FMA_SET, OPTION_MASK_ISA_SSE4_SET, OPTION_MASK_ISA_SSE4A_SET, OPTION_MASK_ISA_FMA4_SET, OPTION_MASK_ISA_XOP_SET, OPTION_MASK_ISA_LWP_SET, OPTION_MASK_ISA_AES_SET, OPTION_MASK_ISA_PCLMUL_SET, OPTION_MASK_ISA_ABM_SET, OPTION_MASK_ISA_BMI_SET, OPTION_MASK_ISA_TBM_SET, OPTION_MASK_ISA_POPCNT_SET, OPTION_MASK_ISA_CX16_SET, OPTION_MASK_ISA_SAHF_SET, OPTION_MASK_ISA_MOVBE_SET, OPTION_MASK_ISA_CRC32_SET, OPTION_MASK_ISA_FSGSBASE_SET, OPTION_MASK_ISA_RDRND_SET, OPTION_MASK_ISA_F16C_SET, OPTION_MASK_ISA_MMX_UNSET, OPTION_MASK_ISA_3DNOW_UNSET, OPTION_MASK_ISA_3DNOW_A_UNSET, OPTION_MASK_ISA_SSE_UNSET, OPTION_MASK_ISA_SSE2_UNSET, OPTION_MASK_ISA_SSE3_UNSET, OPTION_MASK_ISA_SSSE3_UNSET, OPTION_MASK_ISA_SSE4_1_UNSET, OPTION_MASK_ISA_SSE4_2_UNSET, OPTION_MASK_ISA_AVX_UNSET, OPTION_MASK_ISA_FMA_UNSET, OPTION_MASK_ISA_SSE4_UNSET, OPTION_MASK_ISA_SSE4A_UNSET, OPTION_MASK_ISA_FMA4_UNSET, OPTION_MASK_ISA_XOP_UNSET, OPTION_MASK_ISA_LWP_UNSET, OPTION_MASK_ISA_AES_UNSET, OPTION_MASK_ISA_PCLMUL_UNSET, OPTION_MASK_ISA_ABM_UNSET, OPTION_MASK_ISA_BMI_UNSET, OPTION_MASK_ISA_TBM_UNSET, OPTION_MASK_ISA_POPCNT_UNSET, OPTION_MASK_ISA_CX16_UNSET, OPTION_MASK_ISA_SAHF_UNSET, OPTION_MASK_ISA_MOVBE_UNSET, OPTION_MASK_ISA_CRC32_UNSET, OPTION_MASK_ISA_FSGSBASE_UNSET, OPTION_MASK_ISA_RDRND_UNSET, OPTION_MASK_ISA_F16C_UNSET, ix86_handle_option, ix86_option_optimization_table, ix86_option_init_struct, ix86_supports_split_stack, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT, TARGET_SUPPORTS_SPLIT_STACK): Move to i386-common.c. * config/i386/t-i386 (i386.o): Update dependencies. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Declare. * config/ia64/ia64.c (ia64_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, ia64_handle_option): Move to ia64-common.c. * config/iq2000/iq2000.c (iq2000_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE): Move to iq2000-common.c. * config/lm32/lm32.c (lm32_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to lm32-common.c. * config/m32c/m32c.c (TARGET_HAVE_NAMED_SECTIONS): Move to m32c-common.c. * config/m32r/m32r.c (m32r_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO, m32r_handle_option): Move to m32r-common.c. (m32r_memory_move_cost): Remove comment referring to TARGET_HANDLE_OPTION. * config/m68k/m68k.c (TARGET_HANDLE_OPTION, m68k_handle_option): Move to m68k-common.c. * config/mcore/mcore.c (mcore_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to mcore-common.c. * config/mep/mep.c (mep_option_optimization_table, mep_handle_option, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS): Move to mep-common.c. * config/microblaze/microblaze.c (microblaze_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to microblaze-common.c. * config/mips/mips.c (mips_handle_option, mips_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Move to mips-common.c. * config/mmix/mmix.c (mmix_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to mmix-common.c. * config/mn10300/mn10300.c (mn10300_option_optimization_table, mn10300_handle_option, TARGET_EXCEPT_UNWIND_INFO, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE): Move to mn10300-common.c. * config/pa/pa.c: Include common/common-target.h. (pa_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, pa_handle_option): Move to pa-common.c. (pa_option_override): Use targetm_common.except_unwind_info. (pa_asm_output_mi_thunk, pa_function_section): Use targetm_common.have_named_sections. * config/pdp11/pdp11.c (pdp11_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT, pdp11_handle_option, pdp11_option_init_struct): Move to pdp11-common.c. * config/picochip/picochip.c (picochip_option_optimization_table, TARGET_HAVE_NAMED_SECTIONS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to picochip-common.c. * config/rs6000/rs6000.c: Include common/common-target.h. (rs6000_option_optimization_table, TARGET_HANDLE_OPTION, TARGET_OPTION_INIT_STRUCT, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, rs6000_option_init_struct, rs6000_handle_option): Move to rs6000-common.c. * config/rs6000/t-rs6000 (rs6000.o): Update dependencies. * config/rx/rx.c (rx_handle_option, rx_option_optimization_table, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to rx-common.c. * config/s390/s390.c (processor_flags_table, s390_option_optimization_table, s390_option_init_struct, s390_handle_option, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT): Move to s390-common.c. * config/s390/s390.h (processor_flags_table): Declare. * config/score/score.c (score_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, MASK_ALL_CPU_BITS, score_handle_option): Move to score-common.c. * config/sh/sh.c (sh_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, sh_handle_option, sh_option_init_struct): Move to sh-common.c. * config/sparc/sparc.c: Include common/common-target.h. (sparc_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to sparc-common.c. * config/spu/spu.c (TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_INIT_STRUCT, TARGET_EXCEPT_UNWIND_INFO, spu_option_init_struct): Move to spu-common.c. * config/stormy16/stormy16.c (xstorym16_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE): Move to xstormy16-common.c. * config/v850/v850.c (small_memory_physical_max, v850_handle_memory_optionn v850_handle_option, v850_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE): Move to v850-common.c. * config/vax/vax.c (TARGET_DEFAULT_TARGET_FLAGS): Move to vax-common.c. * config/xtensa/xtensa.c (xtensa_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to xtensa-common.c. * cfglayout.c: Include common/common-target.h. (fixup_reorder_chain): Use targetm_common.have_named_sections. * cfgrtl.c: Include common/common-target.h. (force_nonfallthru_and_redirect, commit_one_edge_insertion): Use targetm_common.have_named_sections. * dbxout.c: Include common/common-target.h. (dbxout_function_end): Use targetm_common.have_named_sections. * defaults.h (STACK_OLD_CHECK_PROTECT, STACK_CHECK_PROTECT): Use targetm_common.except_unwind_info. * dwarf2out.c: Include common/common-target.h. (dwarf2out_do_frame, dwarf2out_do_cfi_asm, dwarf2out_begin_prologue, dwarf2out_frame_init, dwarf2out_frame_finish, dwarf2out_assembly_start): Use targetm_common.except_unwind_info. * except.c: Include common/common-target.h. (init_eh, finish_eh_generation, output_one_function_exception_table): Use targetm_common.except_unwind_info. (switch_to_exception_section): Use targetm_common.have_named_sections. * explow.c: Include common/common-target.h. * expr.c: Include common/common-target.h. (build_personality_function): Use targetm_common.except_unwind_info. * function.c: Include common/common-target.h. (expand_function_end): Use targetm_common.except_unwind_info. * haifa-sched.c: Include common/common-target.h. (sched_create_recovery_edges): Use targetm_common.have_named_sections. * lto-opts.c: Include common/common-target.h instead of target.h. (lto_reissue_options): Use targetm_common.handle_option. * opts.c: Include common/common-target.h. (target_handle_option): Use targetm_common.handle_option. (init_options_struct): Update comment referring to targetm.target_option.optimization. Use targetm_common.default_target_flags, targetm_common.unwind_tables_default and targetm_common.option_init_struct. (default_options_optimization): Use targetm_common.option_optimization_table. (finish_options): Use targetm_common.except_unwind_info, targetm_common.unwind_tables_default, targetm_common.have_named_sections and targetm_common.supports_split_stack. * toplev.c: Include common/common-target.h. (process_options): Use targetm_common.have_named_sections. * tree-tailcall.c: Include common/common-target.h. (suitable_for_tail_call_opt_p): Use targetm_common.except_unwind_info. * tree.c: Include common/common-target.h. (build_common_builtin_nodes): Use targetm_common.except_unwind_info. * varasm.c: Include common/common-target.h. (resolve_unique_section, hot_function_section, default_function_section): Use targetm_common.have_named_sections. ada: * gcc-interface/Make-lang.in (gnatbind$(exeext)): Use ggc-none.o. (ada/utils.o): Update dependencies. * gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Add ../../../libcpp/libcpp.a. * gcc-interface/utils.c: Include common/common-target.h. (process_attributes): Use targetm_common.have_named_sections. c-family: * c-common.c: Include common/common-target.h. (handle_section_attribute): Use targetm_common.have_named_sections. * c-cppbuiltin.c: Include common/common-target.h. (c_cpp_builtins): Use targetm_common.except_unwind_info. cp: * Make-lang.in (cp/method.o): Update dependencies. * method.c: Include common/common-target.h. (use_thunk): Use targetm_common.have_named_sections. go: * Make-lang.in (go/go-lang.o, go/go-backend.o): Update dependencies. * go-backend.c: Include common/common-target.h. (go_write_export_data): Use targetm_common.have_named_sections. * go-lang.c: Include common/common-target.h. (go_langhook_init_options_struct): Use targetm_common.supports_split_stack. po: * exgettext: Handle common/ directory and subdirectories. From-SVN: r175064
2011-06-15 01:11:35 +02:00
#include "common/common-target.h"
1994-02-24 02:02:37 +01:00
2000-06-09 18:26:24 +02:00
/* Various flags to control the mangling process. */
enum mangling_flags
{
/* No flags. */
mf_none = 0,
/* The thing we are presently mangling is part of a template type,
rather than a fully instantiated type. Therefore, we may see
complex expressions where we would normally expect to see a
simple integer constant. */
mf_maybe_uninstantiated = 1,
/* When mangling a numeric value, use the form `_XX_' (instead of
just `XX') if the value has more than one digit. */
mf_use_underscores_around_value = 2
2000-06-09 18:26:24 +02:00
};
static void do_build_copy_assign (tree);
static void do_build_copy_constructor (tree);
static tree make_alias_for_thunk (tree);
2000-06-09 18:26:24 +02:00
/* Called once to initialize method.c. */
void
init_method (void)
2000-06-09 18:26:24 +02:00
{
init_mangle ();
2000-06-09 18:26:24 +02:00
}
/* Return a this or result adjusting thunk to FUNCTION. THIS_ADJUSTING
indicates whether it is a this or result adjusting thunk.
FIXED_OFFSET and VIRTUAL_OFFSET indicate how to do the adjustment
(see thunk_adjust). VIRTUAL_OFFSET can be NULL, but FIXED_OFFSET
never is. VIRTUAL_OFFSET is the /index/ into the vtable for this
adjusting thunks, we scale it to a byte offset. For covariant
thunks VIRTUAL_OFFSET is the virtual binfo. You must post process
the returned thunk with finish_thunk. */
tree
make_thunk (tree function, bool this_adjusting,
tree fixed_offset, tree virtual_offset)
{
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
HOST_WIDE_INT d;
tree thunk;
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (TREE_CODE (function) == FUNCTION_DECL);
/* We can have this thunks to covariant thunks, but not vice versa. */
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (!DECL_THIS_THUNK_P (function));
gcc_assert (!DECL_RESULT_THUNK_P (function) || this_adjusting);
/* Scale the VIRTUAL_OFFSET to be in terms of bytes. */
if (this_adjusting && virtual_offset)
virtual_offset
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
= size_binop (MULT_EXPR,
virtual_offset,
convert (ssizetype,
TYPE_SIZE_UNIT (vtable_entry_type)));
d = tree_to_shwi (fixed_offset);
/* See if we already have the thunk in question. For this_adjusting
thunks VIRTUAL_OFFSET will be an INTEGER_CST, for covariant thunks it
will be a BINFO. */
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
for (thunk = DECL_THUNKS (function); thunk; thunk = DECL_CHAIN (thunk))
if (DECL_THIS_THUNK_P (thunk) == this_adjusting
&& THUNK_FIXED_OFFSET (thunk) == d
&& !virtual_offset == !THUNK_VIRTUAL_OFFSET (thunk)
&& (!virtual_offset
|| (this_adjusting
? tree_int_cst_equal (THUNK_VIRTUAL_OFFSET (thunk),
virtual_offset)
: THUNK_VIRTUAL_OFFSET (thunk) == virtual_offset)))
return thunk;
/* All thunks must be created before FUNCTION is actually emitted;
the ABI requires that all thunks be emitted together with the
function to which they transfer control. */
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (!TREE_ASM_WRITTEN (function));
/* Likewise, we can only be adding thunks to a function declared in
the class currently being laid out. */
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (TYPE_SIZE (DECL_CONTEXT (function))
&& TYPE_BEING_DEFINED (DECL_CONTEXT (function)));
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. gcc/java/ * java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt. * expr.c (force_evaluation_order): Same. * typeck.c: Add location to build_decl or PUSH_FIELD calls. * class.c: Same. * decl.c: Same. * jcf-parse.c: Same. * constants.c: Same. * resource.c: Same. * except.c: Same. * builtins.c: Same. * expr.c: Same. * java-tree.h (PUSH_FIELD): Add location field. gcc/objc/ * objc-act.c (finish_var_decl): Pass location to finish_decl. (objc_get_parm_info): Same. (get_super_receiver): Same. * objc-act.c (objc_build_component_ref): Pass location to build_compound_ref. (build_module_initializer_routine): Pass location to c_end_compound_stmt. (objc_generate_static_init_call): Pass location to build_stmt. (build_typed_selector_reference): New location argument. (build_selector_reference): Same. (objc_substitute_decl): Pass location to build_array_ref. (next_sjlj_build_try_catch_finally): Pass location to build_stmt. (objc_begin_catch_clause): Same. (objc_finish_try_stmt): Same. (objc_finish_catch_clause): Pass location to c_end_compound_stmt. (objc_build_throw_stmt): New argument. (generate_shared_structures): Pass location to build_c_cast. (objc_build_message_expr): Use local location. (objc_finish_message_expr): Use input_location. (build_objc_method_call): New argument. (objc_build_selector_expr): Same. (get_super_receiver): Pass location to build_c_cast, build_modify_expr, build_compound_expr. * objc-act.c: Add location to all calls to start_struct, build_decl, finish_struct. gcc/ * tree-pretty-print.c (dump_generic_node): Dump column numbers. * gimple-pretty-print.c (dump_gimple_stmt): Same. * gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs created. * c-parser.c (c_parser_binary_expression): Use current column while building binary operations. * common.opt (fshow-column): Enable by default. * tree-vrp.c (check_array_ref): Use warning_at. (check_array_bounds): Use location from call back if expr has no location. * tree.h: Add location argument to maybe_fold_*. * tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*. (maybe_fold_offset_to_array_ref): Add location argument and use it. (maybe_fold_offset_to_component_ref): Same. (maybe_fold_offset_to_reference): Same. (maybe_fold_offset_to_address): Same. (maybe_fold_stmt_indirect): Same. (maybe_fold_stmt_addition): Same. (fold_stmt_r): Pass location to maybe_fold_*. (fold_gimple_assign): Same. * c-tree.h: Add location argument to finish_decl, default_function_array_conversion, store_init_value. * c-decl.c (define_label): Use error_at. (c_make_fname_decl): Pass location to finish_decl. (finish_decl): New location argument. (build_compound_literal): Pass location to store_init_value. (grokdeclarator): Pass location to finish_decl. (grokfield): Same. * c-typeck.c (array_to_pointer_conversion): New location argument. (function_to_pointer_conversion): Same. (default_function_array_conversion): Same. (parser_build_unary_op): Pass location to overflow_warning. (parser_build_binary_op): Same. Use warning_at. (build_unary_op): Pass location to array_to_pointer_conversion. (build_c_cast): Pass location to digest_init. (build_modify_expr): New location argument. (convert_for_assignment): Same. (store_init_value): Same. (digest_init): Same. (output_init_element): Pass location to digest_init and array_to_pointer_conversion. (c_finish_return): Pass location to convert_for_assignment. * gimplify.c (gimplify_conversion): Pass location to maybe_fold_offset_to_address. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location to maybe_fold_stmt_addition. * c-omp.c (c_finish_omp_atomic): Pass new location to build_modify_expr. (c_finish_omp_for): Same. * c-common.c (overflow_warning): New argument. * c-common.h: New argument to build_modify_expr, overflow_warning. * c-parser.c (c_parser_declaration_or_fndef): Pass location to finish_decl. (c_parser_initializer): Pass location to default_function_array_conversion. (c_parser_initelt): Same. (c_parser_initval): Same. (c_parser_asm_operands): Same. (c_parser_expr_no_commas): Same. Pass location to build_modify_expr. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Add location info to stack. Use it. (c_parser_unary_expression): Pass location to default_function_array_conversion, parser_build_unary_op, build_indirect_ref, c_parser_postfix_expression_after_primary. (c_parser_postfix_expression_after_primary): New location argument. Use it. (c_parser_expression_conv): Pass location to default_function_array_conversion. (c_parser_expr_list): Same. (c_parser_omp_atomic): Same. (c_parser_omp_for_loop): Same. * c-tree.h: (struct c_declarator): Add comment to id_loc. (build_array_declarator): New argument. * c-decl.c (build_array_declarator): Add location argument. (grokdeclarator): Set id_loc for cdk_array. * c-parser.c (c_parser_direct_declarator_inner): Pass location to build_array_declarator. * tree.c (build_omp_clause): Add location argument. * tree.h (OMP_CLAUSE_HAS_LOCATION): New macro. (OMP_CLAUSE_LOCATION): New macro. (struct tree_omp_clause): Add location field. (build_omp_clause): Add argument. * testsuite/gcc.dg/gomp/for-1.c: Fix column. * cp/pt.c (tsubst_omp_for_iterator): Pass location to build_omp_clause. * cp/parser.c (cp_parser_omp_var_list_no_open): Same. (cp_parser_omp_clause_collapse): Same. (cp_parser_omp_clause_default): Same. (cp_parser_omp_clause_if): Same. (cp_parser_omp_clause_nowait): Same. (cp_parser_omp_clause_num_threads): Same. (cp_parser_omp_clause_ordered): Same. (cp_parser_omp_clause_schedule): Same. (cp_parser_omp_clause_untied): Same. (cp_parser_omp_for_loop): Same. (cp_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (c_start_case): Add location argument. (c_process_expr_stmt): Same. (c_finish_goto_*): Same. * tree-parloops.c (initialize_reductions): Pass location to build_omp_clause. (create_parallel_loop): Same. * fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same. (gfc_trans_omp_reduction_list): Same. (gfc_trans_omp_clauses): Same. (gfc_trans_omp_do): Same. * c-typeck.c (c_finish_goto_label): Same. (c_finish_goto_ptr): New location argument. (c_start_case): Same. (emit_side_effect_warnings): Same. (c_process_expr_stmt): Same. (c_finish_stmt_expr): Same. (c_finish_omp_clauses): Use error_at instead of error. * gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to build_omp_clause. * c-omp.c (c_split_parallel_clauses): New location argument. * tree-nested.c (convert_nonlocal_reference_stmt): Pass location to build_omp_clause. (convert_local_reference_stmt): Same. (convert_gimple_call): Same. * c-common.h (c_split_parallel_clauses): New argument. * c-parser.c (c_parser_statement_after_labels): Pass location to c_finish_goto_label. (c_parser_switch_statement): Pass location to c_start_case. (c_parser_for_statement): Pass location to c_finish_expr_stmt, and c_process_expr_stmt. (c_parser_omp_variable_list): Add location argument. (c_parser_omp_clause_collapse): Pass location to build_omp_clause. (c_parser_omp_clause_default): Same. (c_parser_omp_clause_if): Same. (c_parser_omp_clause_num_threads): Same. (-c_parser_omp_clause_ordered): Same. (c_parser_omp_clause_reduction): Pass location to c_parser_omp_variable_list. (c_parser_omp_clause_schedule): Pass location to build_omp_clause. (c_parser_omp_clause_untied): Same. (c_parser_omp_for_loop): Pass location to c_process_expr_stmt. (c_parser_omp_parallel): Pass location to c_split_parallel_clauses. * c-tree.h (check_for_loop_decls, undeclared_variable, build_component_ref, build_array_ref, build_external_ref, c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op, build_conditional_expr, build_compound_expr, c_cast_expr, build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr, c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New argument. * c-semantics.c (build_stmt): Same. (build_case_label): Same. * c-decl.c (c_finish_incomplete_decl): Pass location on down. (undeclared_variable): New argument. (make_label): Same. (lookup_label): Pass location on down. (define_label): Same. (finish_decl): Same. (build_compound_literal): Same. (finish_struct): Same. (finish_function): Do not set location here. (check_for_loop_decls): New argument. * tree.c (save_expr): Set location. (build_empty_stmt): New argument. * tree.h (build_empty_stmt): New argument to build_empty_stmt. (CAN_HAVE_LOCATION_P): Make sure we have a non empty node. * builtins.c (gimplify_va_arg_expr): Use locations. (expand_builtin_sync_operation): Same. * c-typeck.c (build_component_ref): New argument. (build_array_ref): Same. (build_external_ref): Same. (c_expr_sizeof_expr): Same. (c_expr_sizeof_type): Same. (parser_build_unary_op): Same. (build_conditional_expr): Same. (build_compound_expr): Pass location on down. (build_compound_expr): New argument. (build_c_cast): Same. (c_cast_expr): Same. (build_asm_expr): Same. (c_finish_return): Same. (c_process_expr_stmt): Pass location on down. (c_finish_stmt_expr): New argument. (push_clenaup): Same. (c_finish_omp_parallel): Same. (c_finish_omp_task): Same. * gimplify.c (gimplify_call_expr): Pass location on down. * c-omp.c (c_finish_omp_master): New argument. (c_finish_omp_critical): Same. (c_finish_omp_ordered): Same. (c_finish_omp_barrier): Same. (-c_finish_omp_taskwait): Same. (c_finish_omp_atomic): Same. (c_finish_omp_flush): Same. * tree-inline.c (copy_tree_body_r): Pass location on down. (inline_forbidden_p): Remove use of input_location. * c-gimplify.c (c_build_bind_expr): New argument. * c-common.c (c_common_truthvalue_conversion): Pass location on down. (c_sizeof_or_alignof_type): New argument. (c_alignof_expr): Same. (build_va_arg): Same. (c_add_case_label): Same. * c-common.h (c_sizeof_or_alignof_type, c_alignof_expr, c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label, c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt, c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered, c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush, c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses): New argument. * stub-objc.c (objc_build_selector_expr): Same. (objc_build_throw_stmt): Same. * c-parser.c (c_parser_declaration_or_fndef): Pass location on down. (c_parser_initelt): Same. (c_parser_compound_statement): Same. (c_parser_compound_statement_nostart): Same. (c_parser_label): Same. (c_parser_statement_after_labels): Same. (c_parser_if_body): Same. (c_parser_else_body): Same. (c_parser_if_statement): Same. (c_parser_switch_statement): Same. (c_parser_while_statement): Same. (c_parser_do_statement): Same. (c_parser_for_statement): Same. (c_parser_asm_statement): Same. (c_parser_conditional_expression): Same. (c_parser_binary_expression): Same. (c_parser_cast_expression): Same. (c_parser_unary_expression): Same. (c_parser_sizeof_expression): Same. (c_parser_alignof_expression): Same. (c_parser_postfix_expression): Same. (c_parser_expression): Same. (c_parser_objc_receiver): Same. (c_parser_omp_variable_list): Same. (c_parser_omp_structured_block): Same. (c_parser_omp_atomic): New argument. (c_parser_omp_barrier): Same. (c_parser_omp_critical): Same. (c_parser_omp_flush): Pass location on down. (c_parser_omp_for_loop): New argument. (c_parser_omp_for): Same. (c_parser_omp_master): Same. (c_parser_omp_ordered): Same. (c_parser_omp_sections_scope): Same. (c_parser_omp_sections): Same. (c_parser_omp_parallel): Same. (c_parser_omp_single): Same. (c_parser_omp_task): Same. (c_parser_omp_taskwait): Pass location on down. (c_parser_omp_construct): Same. (c_parser_omp_threadprivate): Same. * dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h, builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c, tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c, c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c, c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c, emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c, rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h, tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c, config/i386/i386.c, stmt.c: Add location argument to the following function definitions and/or function calls: build_decl, objcp_start_struct, objcp_finish_struct, start_struct, finish_struct, PUSH_FIELD, create_artificial_label, cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl, build_compound_literal, parser_xref_tag, resolve_overloaded_builtin, do_case, c_finish_bc_stmt, build_compound_literal, build_function_call. * c-decl.c (build_compound_literal): Add location argument. Make all diagnostic calls use location. (start_struct): Same. (finish_struct): Same. (start_enum): Same. (build_enumerator): Same. (start_function): Same. (grokdeclarator): Make all diagnostic calls use location. (store_parm_decls_oldstyle): Same. * c-typeck.c (build_function_call): Add location argument. Make all diagnostic calls use location. (do_case): Same. (c_finish_bc_stmt): Same. * tree-nested.c (get_trampoline_type): Add argument. Pass location to build_decl. (lookup_tramp_for_decl): Pass location to get_trampoline_type. * rtl.h (RTL_LOCATION): New. * c-common.c (c_add_case_label): Add location argument. Make all diagnostic calls use location. * c-common.h: Add location argument to make_fname_decl, do_case, c_add_case_label, build_function_call, resolve_overloaded_builtin. * c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc. Set it appropriately for every case. Pass enum_loc to start_enum call. Pass value_loc first to build_enumerator. Pass enum_loc to parser_xref_tag. (c_parser_struct_or_union_specifier): Save location. Use it for start_struct, finish_struct, and parser_xref_tag. gcc/testsuite/ * gcc.dg/old-style-prom-3.c: Add column info. * gcc.dg/overflow-warn-1.c * gcc.dg/gomp/pr27415.c * gcc.dg/gomp/for-1.c: Same. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/c99-tag-3.c: Same. * gcc.dg/Wredundant-decls-2.c: Same. * gcc.dg/func-ptr-conv-1.c: Same. * gcc.dg/asm-wide-1.c: Same. * gcc.dg/nofixed-point-2.c: Same. * gcc.dg/cpp/line3.c: Same. * gcc.dg/array-10.c: Same. * gcc.dg/c99-vla-jump-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/Wshadow-3.c: Same. * gcc.dg/c90-const-expr-8.c: Same. * gcc.dg/label-decl-2.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/c90-const-expr-5.c: Same. * gcc.dg/builtins-30.c: Same. * gcc.dg/Warray-bounds.c: Same. * gcc.dg/Wcxx-compat-2.c: Same. * gcc.dg/tree-ssa/col-1.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/cast-function-1.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/vla-8.c: Same. * gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct line. * gcc.dg/label-decl-2.c: Move label diagnostic to correct line. * gcc.dg/old-style-prom-3.c: Check for error on the correct line. * gcc.dg/enum-compat-1.c: Same. * gcc.dg/dremf-type-compat-2.c: Same. * gcc.dg/old-style-prom-2.c: Same. * gcc.dg/pr15698-1.c: Same. * gcc.dg/pr20368-1.c: Same. * gcc.dg/dremf-type-compat-3.c: Same. * gcc.dg/builtins-30.c: Same. Test for columns. gcc/objcp/ * objcp-decl.h (c_end_compound_stmt): New argument. * objcp-decl.c (objcp_start_struct): Add argument. (objcp_finish_struct): Same. gcc/cp/ * typeck.c (cp_build_binary_op): Pass location to overflow_warning. (build_modify_expr): New arg. * semantics.c (finish_unary_op_expr): Pass location to overflow_warning. (handle_omp_for_class_iterator): Pass location to build_modify_expr. * typeck.c (cxx_sizeof_or_alignof_type): Pass location to c_sizeof_or_alignof_type. (build_array_ref): New argument. (build_compound_expr): Same. (build_const_cast): Same. (build_ptrmemfunc): Pass location to build_c_cast. * init.c (avoid_placement_new_aliasing): Pass location to build_stmt. (build_vec_delete_1): Pass location to cp_build_modify_expr, build_compound_expr. * class.c (build_vtbl_ref_1): Pass location to build_array_ref. * decl.c (poplevel): Pass location to c_build_bind_expr. (finish_case_label): Pass location to build_case_label. (finish_constructor_body): Same. (finish_destructor_body): Pass location to build_stmt. (cxx_maybe_build_cleanup): Same, but to build_compound_expr. * call.c (build_new_op): Pass location to build_array_ref. (build_x_va_arg): Pass location to build_va_arg. * except.c (expand_end_catch_block): Pass location to build_stmt. * cp-tree.h (build_array_ref): New argument. (build_compound_expr): Same. (build_c_cast): Same. * cp-gimplify.c (gimplify_if_stmt): Pass location on down. (gimplify_switch_stmt): Same. * typeck2.c (split_nonconstant_init_1): Same. * pt.c (tsubst_copy): Same. * semantics.c (add_decl_expr): Same. (do_poplevel): Same. (push_cleanup): Same. (finish_goto_stmt): Same. (finish_expr_stmt): Same. (begin_if_stmt): Same. (begin_while_stmt): Same. (begin_do_stmt): Same. (finish_return_stmt): Same. (begin_for_stmt): Same. (finish_break_stmt): Same. (finish_continue_stmt): Same. (begin_switch_stmt): Same. (begin_try_block): Same. (begin_handler): Same. (finish_asm_stmt): Same. (finish_label_stmt): Same. (finish_stmt_expr_expr): Same. (finalize_nrv_r): Same. (finish_omp_atomic): Same. * name-lookup.c (do_using_directive): Same. * decl2.c (grok_array_decl): Same. * parser.c (cp_parser_cast_expression): Same. (cp_parser_selection_statement): Same. (cp_parser_implicitly_scoped_statement): Same. (cp_parser_objc_selector_expression): Same. (cp_parser_objc_synchronized_statement): Same. (cp_parser_objc_throw_statement): Same. (cp_parser_omp_critical): Same. (cp_parser_omp_master): Same. * typeck.c (build_function_call): Add location argument. * init.c: Add location argument to all build_decl calls. * class.c: Same. * method.c: Same. * rtti.c: Same. * tree.c: Same. * pt.c: Same. * semantics.c: Same. * lex.c: Same. * decl2.c: Same. * cp-gimplify.c: Same. * decl.c: Same. (cp_make_fname_decl): Add location argument. Pass location ot build_decl. (finish_case_label): Same. * cp-tree.h (finish_case_label): Add location argument. * parser.c (cp_parser_label_for_labeled_statement): Pass location to finish_case_label. gcc/fortran/ * trans-array.c (gfc_trans_allocate_array_storage): Pass location on down. (gfc_trans_array_constructor_value): Same. (gfc_trans_scalarized_loop_end): Same. (gfc_conv_ss_startstride): Same. (gfc_trans_g77_array): Same. (gfc_trans_dummy_array_bias): Same. (gfc_conv_array_parameter): Same. (structure_alloc_comps): Same. * trans-expr.c (gfc_conv_function_call): Same. (fill_with_spaces): Same. (gfc_trans_string_copy): Same. (gfc_trans_scalar_assign): Same. * trans-stmt.c (gfc_trans_goto): Same. (gfc_trans_if_1): Same. (gfc_trans_simple_do): Same. (gfc_trans_do): Same. (gfc_trans_do_while): Same. (gfc_trans_logical_select): Same. (gfc_trans_select): Same. (gfc_trans_forall_loop): Same. (gfc_trans_nested_forall_loop): Same. (generate_loop_for_temp_to_lhs): Same. (generate_loop_for_rhs_to_temp): Same. (gfc_trans_forall_1): Same. (gfc_trans_where_assign): Same. (gfc_trans_where_3): Same. (gfc_trans_allocate): Same. * trans.c (gfc_finish_block): Same. (gfc_trans_runtime_check): Same. (gfc_call_malloc): Same. (gfc_allocate_with_status): Same. (gfc_call_free): Same. (gfc_deallocate_with_status): Same. (gfc_call_realloc): Same. (gfc_trans_code): Same. * trans-decl.c (gfc_init_default_dt): Same. (gfc_generate_constructors): Same. * trans-io.c (gfc_trans_io_runtime_check): Same. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same. (gfc_conv_intrinsic_fdate): Same. (gfc_conv_intrinsic_ttynam): Same. (gfc_conv_intrinsic_minmax): Same. (gfc_conv_intrinsic_minmax_char): Same. (gfc_conv_intrinsic_anyall): Same. (gfc_conv_intrinsic_count): Same. (gfc_conv_intrinsic_arith): Same. (gfc_conv_intrinsic_minmaxloc): Same. (gfc_conv_intrinsic_minmaxval): Same. (gfc_conv_intrinsic_rrspacing): Same. (gfc_conv_intrinsic_array_transfer): Same. (gfc_conv_intrinsic_trim): Same. (gfc_conv_intrinsic_repeat): Same. From-SVN: r148442
2009-06-13 00:06:47 +02:00
thunk = build_decl (DECL_SOURCE_LOCATION (function),
FUNCTION_DECL, NULL_TREE, TREE_TYPE (function));
DECL_LANG_SPECIFIC (thunk) = DECL_LANG_SPECIFIC (function);
cxx_dup_lang_specific_decl (thunk);
DECL_VIRTUAL_P (thunk) = true;
SET_DECL_THUNKS (thunk, NULL_TREE);
DECL_CONTEXT (thunk) = DECL_CONTEXT (function);
TREE_READONLY (thunk) = TREE_READONLY (function);
TREE_THIS_VOLATILE (thunk) = TREE_THIS_VOLATILE (function);
TREE_PUBLIC (thunk) = TREE_PUBLIC (function);
SET_DECL_THUNK_P (thunk, this_adjusting);
THUNK_TARGET (thunk) = function;
THUNK_FIXED_OFFSET (thunk) = d;
THUNK_VIRTUAL_OFFSET (thunk) = virtual_offset;
THUNK_ALIAS (thunk) = NULL_TREE;
DECL_INTERFACE_KNOWN (thunk) = 1;
DECL_NOT_REALLY_EXTERN (thunk) = 1;
DECL_COMDAT (thunk) = DECL_COMDAT (function);
DECL_SAVED_FUNCTION_DATA (thunk) = NULL;
/* The thunk itself is not a constructor or destructor, even if
the thing it is thunking to is. */
DECL_DESTRUCTOR_P (thunk) = 0;
DECL_CONSTRUCTOR_P (thunk) = 0;
DECL_EXTERNAL (thunk) = 1;
DECL_ARTIFICIAL (thunk) = 1;
/* The THUNK is not a pending inline, even if the FUNCTION is. */
DECL_PENDING_INLINE_P (thunk) = 0;
DECL_DECLARED_INLINE_P (thunk) = 0;
/* Nor is it a template instantiation. */
DECL_USE_TEMPLATE (thunk) = 0;
DECL_TEMPLATE_INFO (thunk) = NULL;
/* Add it to the list of thunks associated with FUNCTION. */
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
DECL_CHAIN (thunk) = DECL_THUNKS (function);
SET_DECL_THUNKS (function, thunk);
return thunk;
}
/* Finish THUNK, a thunk decl. */
void
finish_thunk (tree thunk)
{
tree function, name;
tree fixed_offset = ssize_int (THUNK_FIXED_OFFSET (thunk));
tree virtual_offset = THUNK_VIRTUAL_OFFSET (thunk);
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (!DECL_NAME (thunk) && DECL_THUNK_P (thunk));
if (virtual_offset && DECL_RESULT_THUNK_P (thunk))
virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
function = THUNK_TARGET (thunk);
name = mangle_thunk (function, DECL_THIS_THUNK_P (thunk),
fixed_offset, virtual_offset, thunk);
/* We can end up with declarations of (logically) different
covariant thunks, that do identical adjustments. The two thunks
will be adjusting between within different hierarchies, which
happen to have the same layout. We must nullify one of them to
refer to the other. */
if (DECL_RESULT_THUNK_P (thunk))
{
tree cov_probe;
for (cov_probe = DECL_THUNKS (function);
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
cov_probe; cov_probe = DECL_CHAIN (cov_probe))
if (DECL_NAME (cov_probe) == name)
{
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (!DECL_THUNKS (thunk));
THUNK_ALIAS (thunk) = (THUNK_ALIAS (cov_probe)
? THUNK_ALIAS (cov_probe) : cov_probe);
break;
}
}
DECL_NAME (thunk) = name;
SET_DECL_ASSEMBLER_NAME (thunk, name);
}
static GTY (()) int thunk_labelno;
/* Create a static alias to target. */
re PR libgcj/21692 (unexpected java.lang.NoClassDefFoundError) PR libgcj/21692 cp/ * cp-tree.h (make_alias_for): Declare. * decl2.c (build_java_method_aliases): New. (cp_finish_file): Call it. * method.c (make_alias_for): Split out from ... (make_alias_for_thunk): ... here. java/ * Make-lang.in (java/mangle.o): Depend on LANGHOOKS_DEF_H. * class.c (build_class_ref): Set DECL_CLASS_FIELD_P and DECL_CONTEXT; avoid pushdecl_top_level. (build_dtable_decl): Set DECL_VTABLE_P and DECL_CONTEXT. (layout_class): Don't SET_DECL_ASSEMBLER_NAME. (layout_class_method): Likewise. * decl.c (java_mark_cni_decl_local): New. (java_mark_class_local): Use it. * java-tree.h (DECL_LOCAL_CNI_METHOD_P): New. (DECL_CLASS_FIELD_P, DECL_VTABLE_P): New. (struct lang_decl_func): Add local_cni; (struct lang_decl_var): Add class_field, vtable. (java_mangle_decl): Declare. * lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New. * mangle.c: Remove dup obstack.h; include langhooks-def.h. (mangle_obstack_1): New. (java_mangle_decl): Remove obstack argument. Call mangle_class_field, mangle_vtable, and mangle_local_cni_method_decl. Fall back to lhd_set_decl_assembler_name for things that don't need mangling. (mangle_class_field): Rename from java_mangle_class_field, make static, don't call init_mangling or finish_mangling. (mangle_vtable): Similarly. (mangle_local_cni_method_decl): New. (init_mangling): Remove obstack argument. Use &mangle_obstack_1, gcc_assert, and MANGLE_RAW_STRING. (finish_mangling): Use gcc_assert, remove if 0 debugging code. From-SVN: r100171
2005-05-26 00:08:31 +02:00
tree
make_alias_for (tree target, tree newid)
{
tree alias = build_decl (DECL_SOURCE_LOCATION (target),
TREE_CODE (target), newid, TREE_TYPE (target));
DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (target);
cxx_dup_lang_specific_decl (alias);
DECL_CONTEXT (alias) = NULL;
TREE_READONLY (alias) = TREE_READONLY (target);
TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target);
TREE_PUBLIC (alias) = 0;
DECL_INTERFACE_KNOWN (alias) = 1;
if (DECL_LANG_SPECIFIC (alias))
{
DECL_NOT_REALLY_EXTERN (alias) = 1;
DECL_USE_TEMPLATE (alias) = 0;
DECL_TEMPLATE_INFO (alias) = NULL;
}
DECL_EXTERNAL (alias) = 0;
DECL_ARTIFICIAL (alias) = 1;
DECL_TEMPLATE_INSTANTIATED (alias) = 0;
if (TREE_CODE (alias) == FUNCTION_DECL)
{
DECL_SAVED_FUNCTION_DATA (alias) = NULL;
DECL_DESTRUCTOR_P (alias) = 0;
DECL_CONSTRUCTOR_P (alias) = 0;
DECL_PENDING_INLINE_P (alias) = 0;
DECL_DECLARED_INLINE_P (alias) = 0;
DECL_INITIAL (alias) = error_mark_node;
DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target));
}
else
TREE_STATIC (alias) = 1;
TREE_ADDRESSABLE (alias) = 1;
TREE_USED (alias) = 1;
SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
re PR libgcj/21692 (unexpected java.lang.NoClassDefFoundError) PR libgcj/21692 cp/ * cp-tree.h (make_alias_for): Declare. * decl2.c (build_java_method_aliases): New. (cp_finish_file): Call it. * method.c (make_alias_for): Split out from ... (make_alias_for_thunk): ... here. java/ * Make-lang.in (java/mangle.o): Depend on LANGHOOKS_DEF_H. * class.c (build_class_ref): Set DECL_CLASS_FIELD_P and DECL_CONTEXT; avoid pushdecl_top_level. (build_dtable_decl): Set DECL_VTABLE_P and DECL_CONTEXT. (layout_class): Don't SET_DECL_ASSEMBLER_NAME. (layout_class_method): Likewise. * decl.c (java_mark_cni_decl_local): New. (java_mark_class_local): Use it. * java-tree.h (DECL_LOCAL_CNI_METHOD_P): New. (DECL_CLASS_FIELD_P, DECL_VTABLE_P): New. (struct lang_decl_func): Add local_cni; (struct lang_decl_var): Add class_field, vtable. (java_mangle_decl): Declare. * lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New. * mangle.c: Remove dup obstack.h; include langhooks-def.h. (mangle_obstack_1): New. (java_mangle_decl): Remove obstack argument. Call mangle_class_field, mangle_vtable, and mangle_local_cni_method_decl. Fall back to lhd_set_decl_assembler_name for things that don't need mangling. (mangle_class_field): Rename from java_mangle_class_field, make static, don't call init_mangling or finish_mangling. (mangle_vtable): Similarly. (mangle_local_cni_method_decl): New. (init_mangling): Remove obstack argument. Use &mangle_obstack_1, gcc_assert, and MANGLE_RAW_STRING. (finish_mangling): Use gcc_assert, remove if 0 debugging code. From-SVN: r100171
2005-05-26 00:08:31 +02:00
return alias;
}
static tree
make_alias_for_thunk (tree function)
{
tree alias;
char buf[256];
targetm.asm_out.generate_internal_label (buf, "LTHUNK", thunk_labelno);
re PR libgcj/21692 (unexpected java.lang.NoClassDefFoundError) PR libgcj/21692 cp/ * cp-tree.h (make_alias_for): Declare. * decl2.c (build_java_method_aliases): New. (cp_finish_file): Call it. * method.c (make_alias_for): Split out from ... (make_alias_for_thunk): ... here. java/ * Make-lang.in (java/mangle.o): Depend on LANGHOOKS_DEF_H. * class.c (build_class_ref): Set DECL_CLASS_FIELD_P and DECL_CONTEXT; avoid pushdecl_top_level. (build_dtable_decl): Set DECL_VTABLE_P and DECL_CONTEXT. (layout_class): Don't SET_DECL_ASSEMBLER_NAME. (layout_class_method): Likewise. * decl.c (java_mark_cni_decl_local): New. (java_mark_class_local): Use it. * java-tree.h (DECL_LOCAL_CNI_METHOD_P): New. (DECL_CLASS_FIELD_P, DECL_VTABLE_P): New. (struct lang_decl_func): Add local_cni; (struct lang_decl_var): Add class_field, vtable. (java_mangle_decl): Declare. * lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New. * mangle.c: Remove dup obstack.h; include langhooks-def.h. (mangle_obstack_1): New. (java_mangle_decl): Remove obstack argument. Call mangle_class_field, mangle_vtable, and mangle_local_cni_method_decl. Fall back to lhd_set_decl_assembler_name for things that don't need mangling. (mangle_class_field): Rename from java_mangle_class_field, make static, don't call init_mangling or finish_mangling. (mangle_vtable): Similarly. (mangle_local_cni_method_decl): New. (init_mangling): Remove obstack argument. Use &mangle_obstack_1, gcc_assert, and MANGLE_RAW_STRING. (finish_mangling): Use gcc_assert, remove if 0 debugging code. From-SVN: r100171
2005-05-26 00:08:31 +02:00
thunk_labelno++;
alias = make_alias_for (function, get_identifier (buf));
if (!flag_syntax_only)
{
struct cgraph_node *funcn, *aliasn;
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
funcn = cgraph_node::get (function);
gcc_checking_assert (funcn);
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
aliasn = cgraph_node::create_same_body_alias (alias, function);
DECL_ASSEMBLER_NAME (function);
lto-symtab.c (lto_symtab_entry_def): Add guessed field. * lto-symtab.c (lto_symtab_entry_def): Add guessed field. (lto_symtab_resolve_symbols): Set it. (lto_symtab_merge_decls_1): Do not compute used_from_object_file; store resolution field in cgraph/varpool. * cgraph.c (cgraph_same_body_alias, cgraph_add_thunk): Return node. (cgraph_get_node_or_alias, cgraph_get_node_or_alias): Constify. (cgraph_dump_node): Drop used_from_object_file. (cgraph_clone_node, cgraph_create_virtual_clone): Likewise. (cgraph_function_body_availability): Use decl_replaceable_p. (cgraph_make_node_local): Set resolution to LDPR_PREVAILING_DEF_IRONLY. (cgraph_can_remove_if_no_direct_calls_and_refs): Use cgraph_used_from_object_file_p. (cgraph_will_be_removed_from_program_if_no_direct_calls): Use cgraph_used_from_object_file_p. (resolution_used_from_other_file_p): New functoin. (cgraph_used_from_object_file_p): New predicate. * cgraph.h: Include plugin-api.h (struct cgraph_local_info): Remove used_from_object_file. (struct cgraph_node): Add resolution field. (struct varpool_node): Likewise; remove used_from_object_file; reove const_value_known. (cgraph_get_node, cgraph_get_node_or_alias, cgraph_node, cgraph_same_body_alias, cgraph_add_thunk): Update prototypes. (resolution_used_from_other_file_p, cgraph_used_from_object_file_p, varpool_used_from_object_file_p): Declare. (varpool_get_node, varpool_extra_name_alias): Update prototype. * tree.h (DECL_REPLACEABLE_P): Remove. (decl_replaceable_p, decl_binds_to_current_def_p): Declare. * final.c (rest_of_clean_state): Use decl_binds_to_current_def_p. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_node, input_varpool_node): Stream resolution. * expr.c (expand_expr_real_1): Use const_value_known_p * ipa.c (ipa_discover_readonly_nonaddressable_var): Do not set const_value_known. (cgraph_externally_visible_p): Use cgraph_used_from_object_file_p. (function_and_variable_visibility): Set resolution for local vars and functions. use varpool_used_from_object_file_p. * varasm.c (resolution_to_local_definition_p, resolution_local_p): New static functions. (default_binds_local_p_1): Use resolutoin info. (decl_binds_to_current_def_p, decl_replaceable_p): New functions. * varpool.c (varpool_get_node): Constify. (const_value_known_p): Do not use vnode->const_value_known; use decl_replaceable_p. (varpool_finalize_decl): Do not set const_value_known. (cgraph_variable_initializer_availability): Use decl_replaceable_p (varpool_extra_name_alias): Return new node. (varpool_used_from_object_file_p): New function. * decl.c (finish_function): Use decl_replaceable_p * method.c (make_alias_for_thunk): Update call of cgraph_same_body_alias. * lto.c (lto_promote_cross_file_statics): Use const_value_known_p. From-SVN: r164610
2010-09-24 23:47:59 +02:00
gcc_assert (aliasn != NULL);
}
re PR libgcj/21692 (unexpected java.lang.NoClassDefFoundError) PR libgcj/21692 cp/ * cp-tree.h (make_alias_for): Declare. * decl2.c (build_java_method_aliases): New. (cp_finish_file): Call it. * method.c (make_alias_for): Split out from ... (make_alias_for_thunk): ... here. java/ * Make-lang.in (java/mangle.o): Depend on LANGHOOKS_DEF_H. * class.c (build_class_ref): Set DECL_CLASS_FIELD_P and DECL_CONTEXT; avoid pushdecl_top_level. (build_dtable_decl): Set DECL_VTABLE_P and DECL_CONTEXT. (layout_class): Don't SET_DECL_ASSEMBLER_NAME. (layout_class_method): Likewise. * decl.c (java_mark_cni_decl_local): New. (java_mark_class_local): Use it. * java-tree.h (DECL_LOCAL_CNI_METHOD_P): New. (DECL_CLASS_FIELD_P, DECL_VTABLE_P): New. (struct lang_decl_func): Add local_cni; (struct lang_decl_var): Add class_field, vtable. (java_mangle_decl): Declare. * lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New. * mangle.c: Remove dup obstack.h; include langhooks-def.h. (mangle_obstack_1): New. (java_mangle_decl): Remove obstack argument. Call mangle_class_field, mangle_vtable, and mangle_local_cni_method_decl. Fall back to lhd_set_decl_assembler_name for things that don't need mangling. (mangle_class_field): Rename from java_mangle_class_field, make static, don't call init_mangling or finish_mangling. (mangle_vtable): Similarly. (mangle_local_cni_method_decl): New. (init_mangling): Remove obstack argument. Use &mangle_obstack_1, gcc_assert, and MANGLE_RAW_STRING. (finish_mangling): Use gcc_assert, remove if 0 debugging code. From-SVN: r100171
2005-05-26 00:08:31 +02:00
return alias;
}
/* Emit the definition of a C++ multiple inheritance or covariant
return vtable thunk. If EMIT_P is nonzero, the thunk is emitted
immediately. */
void
use_thunk (tree thunk_fndecl, bool emit_p)
{
tree a, t, function, alias;
tree virtual_offset;
HOST_WIDE_INT fixed_offset, virtual_value;
bool this_adjusting = DECL_THIS_THUNK_P (thunk_fndecl);
struct cgraph_node *funcn, *thunk_node;
/* We should have called finish_thunk to give it a name. */
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (DECL_NAME (thunk_fndecl));
/* We should never be using an alias, always refer to the
aliased thunk. */
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (!THUNK_ALIAS (thunk_fndecl));
if (TREE_ASM_WRITTEN (thunk_fndecl))
return;
function = THUNK_TARGET (thunk_fndecl);
if (DECL_RESULT (thunk_fndecl))
/* We already turned this thunk into an ordinary function.
There's no need to process this thunk again. */
return;
if (DECL_THUNK_P (function))
/* The target is itself a thunk, process it now. */
use_thunk (function, emit_p);
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
/* Thunks are always addressable; they only appear in vtables. */
TREE_ADDRESSABLE (thunk_fndecl) = 1;
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
/* Figure out what function is being thunked to. It's referenced in
this translation unit. */
TREE_ADDRESSABLE (function) = 1;
mark_used (function);
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
if (!emit_p)
return;
if (TARGET_USE_LOCAL_THUNK_ALIAS_P (function))
alias = make_alias_for_thunk (function);
else
alias = function;
fixed_offset = THUNK_FIXED_OFFSET (thunk_fndecl);
virtual_offset = THUNK_VIRTUAL_OFFSET (thunk_fndecl);
target.h (gcc_target.asm_out): Merge output_mi_thunk and output_mi_vcall_thunk into a single hook. gcc/ * target.h (gcc_target.asm_out): Merge output_mi_thunk and output_mi_vcall_thunk into a single hook. Add can_output_mi_thunk. * target-def.h (TARGET_ASM_OUTPUT_MI_THUNK): Don't conditionalize. (TARGET_ASM_OUTPUT_MI_VCALL_THUNK): Remove. (TARGET_ASM_CAN_OUTPUT_MI_THUNK): New. (TARGET_ASM_OUT): Update. * hooks.c (hook_bool_tree_hwi_hwi_tree_false): New. (hook_bool_tree_hwi_hwi_tree_true): New. (default_can_output_mi_thunk_no_vcall): New. * hooks.h: Declare them. * system.h (ASM_OUTPUT_MI_THUNK): Poison. * config/alpha/alpha.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): New. (alpha_output_mi_thunk_osf): Add VCALL_OFFSET parameter. * config/arm/arm.c, config/cris/cris.c, config/frv/frv.c, config/i960/i960.c, config/ia64/ia64.c, config/m68k/m68k.c, config/mmix/mmix.c, config/pa/pa.c, config/sparc/sparc.c, config/stormy16/stormy16.c: Similarly. * config/i386/i386.c (x86_output_mi_thunk): Merge vcall_offset code. Handle 64-bit properly. Streamline. (x86_output_mi_vcall_thunk): Remove. (x86_this_parameter): Rename from ia32_this_parameter; handle 64-bit. (x86_can_output_mi_thunk): New. (TARGET_ASM_OUTPUT_MI_VCALL_THUNK): Remove. (TARGET_ASM_CAN_OUTPUT_MI_THUNK): New. (override_options): Don't zap targetm.asm_out.output_mi_vcall_thunk. * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Rename from output_mi_thunk; make static; always use function_section. (TARGET_ASM_OUTPUT_MI_THUNK): New. (TARGET_ASM_CAN_OUTPUT_MI_THUNK): New. (rs6000_ra_ever_killed): Test no_new_pseudos not targetm.asm_out.output_mi_thunk in conjunction with thunks. * config/rs6000/rs6000-protos.h: Update. * config/rs6000/sysv4.h (TARGET_ASM_OUTPUT_MI_THUNK): Remove. * config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Don't call xcoffout_declare_function when using rs6000_output_mi_thunk. * config/s390/s390.c (s390_output_mi_thunk): Rename from s390_output_mi_vcall_thunk. (TARGET_ASM_OUTPUT_MI_THUNK): Remove. (TARGET_ASM_CAN_OUTPUT_MI_THUNK): New. * config/vax/vax.c (vax_output_mi_thunk): Static; add vcall_offset. (TARGET_ASM_OUTPUT_MI_THUNK, TARGET_ASM_CAN_OUTPUT_MI_THUNK): New. * config/vax/vax-protos.h: Update. * config/vax/vax.h (ASM_OUTPUT_MI_THUNK): Remove. gcc/cp/ * method.c (use_thunk): Always compute vcall_value; assert that it is not zero. Use can_output_mi_thunk; use output_mi_thunk for vcall thunks as well. From-SVN: r58424
2002-10-23 01:05:28 +02:00
if (virtual_offset)
{
if (!this_adjusting)
virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
virtual_value = tree_to_shwi (virtual_offset);
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (virtual_value);
}
else
virtual_value = 0;
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
/* And, if we need to emit the thunk, it's used. */
mark_used (thunk_fndecl);
/* This thunk is actually defined. */
DECL_EXTERNAL (thunk_fndecl) = 0;
/* The linkage of the function may have changed. FIXME in linkage
rewrite. */
gcc_assert (DECL_INTERFACE_KNOWN (function));
TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function);
DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
DECL_VISIBILITY_SPECIFIED (thunk_fndecl)
= DECL_VISIBILITY_SPECIFIED (function);
DECL_COMDAT (thunk_fndecl) = DECL_COMDAT (function);
DECL_WEAK (thunk_fndecl) = DECL_WEAK (function);
if (flag_syntax_only)
{
TREE_ASM_WRITTEN (thunk_fndecl) = 1;
return;
}
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
push_to_top_level ();
if (TARGET_USE_LOCAL_THUNK_ALIAS_P (function)
target-def.h (TARGET_HAVE_NAMED_SECTIONS): Move to common/common-target-def.h. * target-def.h (TARGET_HAVE_NAMED_SECTIONS): Move to common/common-target-def.h. * target.def (default_target_flags, handle_option, supports_split_stack, optimization_table, init_struct, except_unwind_info, unwind_tables_default, have_named_sections): Move to common/common-target.def. * target.h (enum opt_levels, struct default_options): Move to common/common-target.h. * targhooks.c (default_except_unwind_info, dwarf2_except_unwind_info, sjlj_except_unwind_info, default_target_handle_option, empty_optimization_table): Move to common/common-targhooks.c. * targhooks.h (default_except_unwind_info, dwarf2_except_unwind_info, sjlj_except_unwind_info, default_target_handle_option, empty_optimization_table): Move to common/common-targhooks.h. * common/common-target-def.h: Include common/common-targhooks.h. (TARGET_HAVE_NAMED_SECTIONS): Define if TARGET_ASM_NAMED_SECTION defined. * common/common-target.def (handle_option, option_init_struct, option_optimization_table, default_target_flags, except_unwind_info, supports_split_stack, unwind_tables_default, have_named_sections): Move from target.def. (HOOK_PREFIX): Undefine at end of file. * common/common-target.h: Include input.h. (enum opt_levels, struct default_options): Move from target.h. * common/common-targhooks.c, common/common-targhooks.h: New. * config.gcc (target_has_targetm_common): Default to yes. (moxie*): Set target_has_targetm_common=no. (hppa*-*-*): Don't set target_has_targetm_common=yes. * doc/tm.texi: Regenerate. * Makefile.in (COMMON_TARGET_H): Add $(INPUT_H). (C_TARGET_DEF_H): Add common/common-targhooks.h. (GCC_OBJS): Remove vec.o. (OBJS): Remove hooks.o and vec.o. (OBJS-libcommon-target): Add vec.o, hooks.o and common/common-targhooks.o. (c-family/c-common.o, c-family/c-cppbuiltin.o, lto-opts.o, tree.o, tree-tailcall.o, opts.o, toplev.o, varasm.o, function.o, except.o, expr.o, explow.o, dbxout.o, dwarf2out.o, cfgrtl.o, haifa-sched.o, cfglayout.o, $(out_object_file), $(common_out_object_file)): Update dependencies. (common/common-targhooks.o): New. * common/config/default-common.c: Include tm.h. Add FIXME comment. * common/config/pa/pa-common.c: Include more headers. Take copyright dates from pa.c. (pa_option_optimization_table, pa_handle_option, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Move from pa.c. * common/config/alpha/alpha-common.c, common/config/arm/arm-common.c, common/config/avr/avr-common.c, common/config/bfin/bfin-common.c, common/config/cris/cris-common.c, common/config/fr30/fr30-common.c, common/config/frv/frv-common.c, common/config/h8300/h8300-common.c, common/config/i386/i386-common.c, common/config/ia64/ia64-common.c, common/config/iq2000/iq2000-common.c, common/config/lm32/lm32-common.c, common/config/m32c/m32c-common.c, common/config/m32r/m32r-common.c, common/config/m68k/m68k-common.c, common/config/mcore/mcore-common.c, common/config/mep/mep-common.c, common/config/microblaze/microblaze-common.c, common/config/mips/mips-common.c, common/config/mmix/mmix-common.c, common/config/mn10300/mn10300-common.c, common/config/pdp11/pdp11-common.c, common/config/picochip/picochip-common.c, common/config/rs6000/rs6000-common.c, common/config/rx/rx-common.c, common/config/s390/s390-common.c, common/config/score/score-common.c, common/config/sh/sh-common.c, common/config/sparc/sparc-common.c, common/config/spu/spu-common.c, common/config/v850/v850-common.c, common/config/vax/vax-common.c, common/config/xstormy16/xstormy16-common.c, common/config/xtensa/xtensa-common.c: New. * config/alpha/alpha.c: Include common/common-target.h. (alpha_option_optimization_table, alpha_handle_option, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE): Move to alpha-common.c. * config/arm/arm-protos.h (arm_except_unwind_info): Declare. * config/arm/arm.c (arm_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO, arm_except_unwind_info): Move to arm-common.c. * config/avr/avr.c (avr_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to avr-common.c. * config/bfin/bfin.c (struct bfin_cpu): Move to bfin.h. (bfin_cpus, bfin_handle_option, TARGET_HANDLE_OPTION, TARGET_DEFAULT_TARGET_FLAGS): Move to bfin-common.c. * config/bfin/bfin.h struct bfin_cpu): Move from bfin.c. * config/cris/cris.c (cris_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, cris_handle_option): Move to cris-common.c. * config/fr30/fr30.c (fr30_option_optimization_table, TARGET_EXCEPT_UNWIND_INFO, TARGET_OPTION_OPTIMIZATION_TABLE): Move to fr30-common.c. * config/frv/frv.c (frv_option_optimization_table, MASK_DEFAULT_ALLOC_CC, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to frv-common.c. * config/h8300/h8300.c (h8300_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to h8300-common.c. * config/i386/i386-protos.h (ix86_handle_option): Declare. * config/i386/i386.c: Include common/common-target.h. (OPTION_MASK_ISA_MMX_SET, OPTION_MASK_ISA_3DNOW_SET, OPTION_MASK_ISA_SSE_SET, OPTION_MASK_ISA_SSE2_SET, OPTION_MASK_ISA_SSE3_SET, OPTION_MASK_ISA_SSSE3_SET, OPTION_MASK_ISA_SSE4_1_SET, OPTION_MASK_ISA_SSE4_2_SET, OPTION_MASK_ISA_AVX_SET, OPTION_MASK_ISA_FMA_SET, OPTION_MASK_ISA_SSE4_SET, OPTION_MASK_ISA_SSE4A_SET, OPTION_MASK_ISA_FMA4_SET, OPTION_MASK_ISA_XOP_SET, OPTION_MASK_ISA_LWP_SET, OPTION_MASK_ISA_AES_SET, OPTION_MASK_ISA_PCLMUL_SET, OPTION_MASK_ISA_ABM_SET, OPTION_MASK_ISA_BMI_SET, OPTION_MASK_ISA_TBM_SET, OPTION_MASK_ISA_POPCNT_SET, OPTION_MASK_ISA_CX16_SET, OPTION_MASK_ISA_SAHF_SET, OPTION_MASK_ISA_MOVBE_SET, OPTION_MASK_ISA_CRC32_SET, OPTION_MASK_ISA_FSGSBASE_SET, OPTION_MASK_ISA_RDRND_SET, OPTION_MASK_ISA_F16C_SET, OPTION_MASK_ISA_MMX_UNSET, OPTION_MASK_ISA_3DNOW_UNSET, OPTION_MASK_ISA_3DNOW_A_UNSET, OPTION_MASK_ISA_SSE_UNSET, OPTION_MASK_ISA_SSE2_UNSET, OPTION_MASK_ISA_SSE3_UNSET, OPTION_MASK_ISA_SSSE3_UNSET, OPTION_MASK_ISA_SSE4_1_UNSET, OPTION_MASK_ISA_SSE4_2_UNSET, OPTION_MASK_ISA_AVX_UNSET, OPTION_MASK_ISA_FMA_UNSET, OPTION_MASK_ISA_SSE4_UNSET, OPTION_MASK_ISA_SSE4A_UNSET, OPTION_MASK_ISA_FMA4_UNSET, OPTION_MASK_ISA_XOP_UNSET, OPTION_MASK_ISA_LWP_UNSET, OPTION_MASK_ISA_AES_UNSET, OPTION_MASK_ISA_PCLMUL_UNSET, OPTION_MASK_ISA_ABM_UNSET, OPTION_MASK_ISA_BMI_UNSET, OPTION_MASK_ISA_TBM_UNSET, OPTION_MASK_ISA_POPCNT_UNSET, OPTION_MASK_ISA_CX16_UNSET, OPTION_MASK_ISA_SAHF_UNSET, OPTION_MASK_ISA_MOVBE_UNSET, OPTION_MASK_ISA_CRC32_UNSET, OPTION_MASK_ISA_FSGSBASE_UNSET, OPTION_MASK_ISA_RDRND_UNSET, OPTION_MASK_ISA_F16C_UNSET, ix86_handle_option, ix86_option_optimization_table, ix86_option_init_struct, ix86_supports_split_stack, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT, TARGET_SUPPORTS_SPLIT_STACK): Move to i386-common.c. * config/i386/t-i386 (i386.o): Update dependencies. * config/ia64/ia64-protos.h (ia64_except_unwind_info): Declare. * config/ia64/ia64.c (ia64_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, ia64_handle_option): Move to ia64-common.c. * config/iq2000/iq2000.c (iq2000_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE): Move to iq2000-common.c. * config/lm32/lm32.c (lm32_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to lm32-common.c. * config/m32c/m32c.c (TARGET_HAVE_NAMED_SECTIONS): Move to m32c-common.c. * config/m32r/m32r.c (m32r_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO, m32r_handle_option): Move to m32r-common.c. (m32r_memory_move_cost): Remove comment referring to TARGET_HANDLE_OPTION. * config/m68k/m68k.c (TARGET_HANDLE_OPTION, m68k_handle_option): Move to m68k-common.c. * config/mcore/mcore.c (mcore_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to mcore-common.c. * config/mep/mep.c (mep_option_optimization_table, mep_handle_option, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS): Move to mep-common.c. * config/microblaze/microblaze.c (microblaze_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to microblaze-common.c. * config/mips/mips.c (mips_handle_option, mips_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION): Move to mips-common.c. * config/mmix/mmix.c (mmix_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to mmix-common.c. * config/mn10300/mn10300.c (mn10300_option_optimization_table, mn10300_handle_option, TARGET_EXCEPT_UNWIND_INFO, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE): Move to mn10300-common.c. * config/pa/pa.c: Include common/common-target.h. (pa_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, pa_handle_option): Move to pa-common.c. (pa_option_override): Use targetm_common.except_unwind_info. (pa_asm_output_mi_thunk, pa_function_section): Use targetm_common.have_named_sections. * config/pdp11/pdp11.c (pdp11_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT, pdp11_handle_option, pdp11_option_init_struct): Move to pdp11-common.c. * config/picochip/picochip.c (picochip_option_optimization_table, TARGET_HAVE_NAMED_SECTIONS, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to picochip-common.c. * config/rs6000/rs6000.c: Include common/common-target.h. (rs6000_option_optimization_table, TARGET_HANDLE_OPTION, TARGET_OPTION_INIT_STRUCT, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_DEFAULT_TARGET_FLAGS, rs6000_option_init_struct, rs6000_handle_option): Move to rs6000-common.c. * config/rs6000/t-rs6000 (rs6000.o): Update dependencies. * config/rx/rx.c (rx_handle_option, rx_option_optimization_table, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_EXCEPT_UNWIND_INFO): Move to rx-common.c. * config/s390/s390.c (processor_flags_table, s390_option_optimization_table, s390_option_init_struct, s390_handle_option, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT): Move to s390-common.c. * config/s390/s390.h (processor_flags_table): Declare. * config/score/score.c (score_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE, MASK_ALL_CPU_BITS, score_handle_option): Move to score-common.c. * config/sh/sh.c (sh_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE, TARGET_OPTION_INIT_STRUCT, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, sh_handle_option, sh_option_init_struct): Move to sh-common.c. * config/sparc/sparc.c: Include common/common-target.h. (sparc_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to sparc-common.c. * config/spu/spu.c (TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_INIT_STRUCT, TARGET_EXCEPT_UNWIND_INFO, spu_option_init_struct): Move to spu-common.c. * config/stormy16/stormy16.c (xstorym16_option_optimization_table, TARGET_OPTION_OPTIMIZATION_TABLE): Move to xstormy16-common.c. * config/v850/v850.c (small_memory_physical_max, v850_handle_memory_optionn v850_handle_option, v850_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_HANDLE_OPTION, TARGET_OPTION_OPTIMIZATION_TABLE): Move to v850-common.c. * config/vax/vax.c (TARGET_DEFAULT_TARGET_FLAGS): Move to vax-common.c. * config/xtensa/xtensa.c (xtensa_option_optimization_table, TARGET_DEFAULT_TARGET_FLAGS, TARGET_OPTION_OPTIMIZATION_TABLE): Move to xtensa-common.c. * cfglayout.c: Include common/common-target.h. (fixup_reorder_chain): Use targetm_common.have_named_sections. * cfgrtl.c: Include common/common-target.h. (force_nonfallthru_and_redirect, commit_one_edge_insertion): Use targetm_common.have_named_sections. * dbxout.c: Include common/common-target.h. (dbxout_function_end): Use targetm_common.have_named_sections. * defaults.h (STACK_OLD_CHECK_PROTECT, STACK_CHECK_PROTECT): Use targetm_common.except_unwind_info. * dwarf2out.c: Include common/common-target.h. (dwarf2out_do_frame, dwarf2out_do_cfi_asm, dwarf2out_begin_prologue, dwarf2out_frame_init, dwarf2out_frame_finish, dwarf2out_assembly_start): Use targetm_common.except_unwind_info. * except.c: Include common/common-target.h. (init_eh, finish_eh_generation, output_one_function_exception_table): Use targetm_common.except_unwind_info. (switch_to_exception_section): Use targetm_common.have_named_sections. * explow.c: Include common/common-target.h. * expr.c: Include common/common-target.h. (build_personality_function): Use targetm_common.except_unwind_info. * function.c: Include common/common-target.h. (expand_function_end): Use targetm_common.except_unwind_info. * haifa-sched.c: Include common/common-target.h. (sched_create_recovery_edges): Use targetm_common.have_named_sections. * lto-opts.c: Include common/common-target.h instead of target.h. (lto_reissue_options): Use targetm_common.handle_option. * opts.c: Include common/common-target.h. (target_handle_option): Use targetm_common.handle_option. (init_options_struct): Update comment referring to targetm.target_option.optimization. Use targetm_common.default_target_flags, targetm_common.unwind_tables_default and targetm_common.option_init_struct. (default_options_optimization): Use targetm_common.option_optimization_table. (finish_options): Use targetm_common.except_unwind_info, targetm_common.unwind_tables_default, targetm_common.have_named_sections and targetm_common.supports_split_stack. * toplev.c: Include common/common-target.h. (process_options): Use targetm_common.have_named_sections. * tree-tailcall.c: Include common/common-target.h. (suitable_for_tail_call_opt_p): Use targetm_common.except_unwind_info. * tree.c: Include common/common-target.h. (build_common_builtin_nodes): Use targetm_common.except_unwind_info. * varasm.c: Include common/common-target.h. (resolve_unique_section, hot_function_section, default_function_section): Use targetm_common.have_named_sections. ada: * gcc-interface/Make-lang.in (gnatbind$(exeext)): Use ggc-none.o. (ada/utils.o): Update dependencies. * gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Add ../../../libcpp/libcpp.a. * gcc-interface/utils.c: Include common/common-target.h. (process_attributes): Use targetm_common.have_named_sections. c-family: * c-common.c: Include common/common-target.h. (handle_section_attribute): Use targetm_common.have_named_sections. * c-cppbuiltin.c: Include common/common-target.h. (c_cpp_builtins): Use targetm_common.except_unwind_info. cp: * Make-lang.in (cp/method.o): Update dependencies. * method.c: Include common/common-target.h. (use_thunk): Use targetm_common.have_named_sections. go: * Make-lang.in (go/go-lang.o, go/go-backend.o): Update dependencies. * go-backend.c: Include common/common-target.h. (go_write_export_data): Use targetm_common.have_named_sections. * go-lang.c: Include common/common-target.h. (go_langhook_init_options_struct): Use targetm_common.supports_split_stack. po: * exgettext: Handle common/ directory and subdirectories. From-SVN: r175064
2011-06-15 01:11:35 +02:00
&& targetm_common.have_named_sections)
{
varasm.c (set_implicit_section): New function. * varasm.c (set_implicit_section): New function. (resolve_unique_section): Use it to set implicit section for aliases, too. (get_named_text_section): Use symtab_get_node (decl)->implicit_section (default_function_section): Likewise. (decl_binds_to_current_def_p): Constify argument. * varasm.h (decl_binds_to_current_def_p): Update prototype. * asan.c (asan_protect_global): Use symtab_get_node (decl)->implicit_section. * symtab.c (dump_symtab_base): Dump implicit sections. (verify_symtab_base): Verify sanity of sectoins and comdats. (symtab_resolve_alias): Alias share the section of its target. (set_section_1): New function. (symtab_node::set_section): Move here, recurse to aliases. (verify_symtab): Check for duplicated symtab lists. * tree-core.h (implicit_section_name_p): Remove. * tree-vect-data-refs.c: Include varasm.h. (vect_can_force_dr_alignment_p): Fix conditional on when decl bints to current definition; use symtab_get_node (decl)->implicit_section. * cgraph.c (cgraph_make_node_local_1): Fix section set. * cgraph.h (struct symtab_node): Add implicit_section. (set_section): Rename to ... (set_section_for_node): ... this one. (set_section): Declare. * tree.h (DECL_HAS_IMPLICIT_SECTION_NAME_P): Remove. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Stream implicit_section. * ipa.c (symtab_remove_unreachable_nodes): Do not check symtab before removal; it will fail in LTO. * vtable-class-hierarchy.c: Use symtab_get_node (var_decl)->implicit_section. * optimize.c (cdtor_comdat_group): Fix handling of aliases. (maybe_clone_body): Move symbol across comdat groups. * method.c (use_thunk): Copy implicit section flag. * go/go-gcc.cc (Gcc_backend::global_variable_set_init): Use symtab_get_node(var_decl)->implicit_section. * lto.c (read_cgraph_and_symbols): Remove unreachable symbols. (do_whole_program_analysis): Use verify_symtab. From-SVN: r211434
2014-06-11 07:51:23 +02:00
tree fn = function;
struct symtab_node *symbol;
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
if ((symbol = symtab_node::get (function))
varasm.c (set_implicit_section): New function. * varasm.c (set_implicit_section): New function. (resolve_unique_section): Use it to set implicit section for aliases, too. (get_named_text_section): Use symtab_get_node (decl)->implicit_section (default_function_section): Likewise. (decl_binds_to_current_def_p): Constify argument. * varasm.h (decl_binds_to_current_def_p): Update prototype. * asan.c (asan_protect_global): Use symtab_get_node (decl)->implicit_section. * symtab.c (dump_symtab_base): Dump implicit sections. (verify_symtab_base): Verify sanity of sectoins and comdats. (symtab_resolve_alias): Alias share the section of its target. (set_section_1): New function. (symtab_node::set_section): Move here, recurse to aliases. (verify_symtab): Check for duplicated symtab lists. * tree-core.h (implicit_section_name_p): Remove. * tree-vect-data-refs.c: Include varasm.h. (vect_can_force_dr_alignment_p): Fix conditional on when decl bints to current definition; use symtab_get_node (decl)->implicit_section. * cgraph.c (cgraph_make_node_local_1): Fix section set. * cgraph.h (struct symtab_node): Add implicit_section. (set_section): Rename to ... (set_section_for_node): ... this one. (set_section): Declare. * tree.h (DECL_HAS_IMPLICIT_SECTION_NAME_P): Remove. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Stream implicit_section. * ipa.c (symtab_remove_unreachable_nodes): Do not check symtab before removal; it will fail in LTO. * vtable-class-hierarchy.c: Use symtab_get_node (var_decl)->implicit_section. * optimize.c (cdtor_comdat_group): Fix handling of aliases. (maybe_clone_body): Move symbol across comdat groups. * method.c (use_thunk): Copy implicit section flag. * go/go-gcc.cc (Gcc_backend::global_variable_set_init): Use symtab_get_node(var_decl)->implicit_section. * lto.c (read_cgraph_and_symbols): Remove unreachable symbols. (do_whole_program_analysis): Use verify_symtab. From-SVN: r211434
2014-06-11 07:51:23 +02:00
&& symbol->alias)
{
if (symbol->analyzed)
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
fn = symtab_node::get (function)->ultimate_alias_target ()->decl;
varasm.c (set_implicit_section): New function. * varasm.c (set_implicit_section): New function. (resolve_unique_section): Use it to set implicit section for aliases, too. (get_named_text_section): Use symtab_get_node (decl)->implicit_section (default_function_section): Likewise. (decl_binds_to_current_def_p): Constify argument. * varasm.h (decl_binds_to_current_def_p): Update prototype. * asan.c (asan_protect_global): Use symtab_get_node (decl)->implicit_section. * symtab.c (dump_symtab_base): Dump implicit sections. (verify_symtab_base): Verify sanity of sectoins and comdats. (symtab_resolve_alias): Alias share the section of its target. (set_section_1): New function. (symtab_node::set_section): Move here, recurse to aliases. (verify_symtab): Check for duplicated symtab lists. * tree-core.h (implicit_section_name_p): Remove. * tree-vect-data-refs.c: Include varasm.h. (vect_can_force_dr_alignment_p): Fix conditional on when decl bints to current definition; use symtab_get_node (decl)->implicit_section. * cgraph.c (cgraph_make_node_local_1): Fix section set. * cgraph.h (struct symtab_node): Add implicit_section. (set_section): Rename to ... (set_section_for_node): ... this one. (set_section): Declare. * tree.h (DECL_HAS_IMPLICIT_SECTION_NAME_P): Remove. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Stream implicit_section. * ipa.c (symtab_remove_unreachable_nodes): Do not check symtab before removal; it will fail in LTO. * vtable-class-hierarchy.c: Use symtab_get_node (var_decl)->implicit_section. * optimize.c (cdtor_comdat_group): Fix handling of aliases. (maybe_clone_body): Move symbol across comdat groups. * method.c (use_thunk): Copy implicit section flag. * go/go-gcc.cc (Gcc_backend::global_variable_set_init): Use symtab_get_node(var_decl)->implicit_section. * lto.c (read_cgraph_and_symbols): Remove unreachable symbols. (do_whole_program_analysis): Use verify_symtab. From-SVN: r211434
2014-06-11 07:51:23 +02:00
else
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
fn = symtab_node::get (function)->alias_target;
varasm.c (set_implicit_section): New function. * varasm.c (set_implicit_section): New function. (resolve_unique_section): Use it to set implicit section for aliases, too. (get_named_text_section): Use symtab_get_node (decl)->implicit_section (default_function_section): Likewise. (decl_binds_to_current_def_p): Constify argument. * varasm.h (decl_binds_to_current_def_p): Update prototype. * asan.c (asan_protect_global): Use symtab_get_node (decl)->implicit_section. * symtab.c (dump_symtab_base): Dump implicit sections. (verify_symtab_base): Verify sanity of sectoins and comdats. (symtab_resolve_alias): Alias share the section of its target. (set_section_1): New function. (symtab_node::set_section): Move here, recurse to aliases. (verify_symtab): Check for duplicated symtab lists. * tree-core.h (implicit_section_name_p): Remove. * tree-vect-data-refs.c: Include varasm.h. (vect_can_force_dr_alignment_p): Fix conditional on when decl bints to current definition; use symtab_get_node (decl)->implicit_section. * cgraph.c (cgraph_make_node_local_1): Fix section set. * cgraph.h (struct symtab_node): Add implicit_section. (set_section): Rename to ... (set_section_for_node): ... this one. (set_section): Declare. * tree.h (DECL_HAS_IMPLICIT_SECTION_NAME_P): Remove. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Stream implicit_section. * ipa.c (symtab_remove_unreachable_nodes): Do not check symtab before removal; it will fail in LTO. * vtable-class-hierarchy.c: Use symtab_get_node (var_decl)->implicit_section. * optimize.c (cdtor_comdat_group): Fix handling of aliases. (maybe_clone_body): Move symbol across comdat groups. * method.c (use_thunk): Copy implicit section flag. * go/go-gcc.cc (Gcc_backend::global_variable_set_init): Use symtab_get_node(var_decl)->implicit_section. * lto.c (read_cgraph_and_symbols): Remove unreachable symbols. (do_whole_program_analysis): Use verify_symtab. From-SVN: r211434
2014-06-11 07:51:23 +02:00
}
resolve_unique_section (fn, 0, flag_function_sections);
if (DECL_SECTION_NAME (fn) != NULL && DECL_ONE_ONLY (fn))
{
resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
/* Output the thunk into the same section as function. */
varasm.c (set_implicit_section): New function. * varasm.c (set_implicit_section): New function. (resolve_unique_section): Use it to set implicit section for aliases, too. (get_named_text_section): Use symtab_get_node (decl)->implicit_section (default_function_section): Likewise. (decl_binds_to_current_def_p): Constify argument. * varasm.h (decl_binds_to_current_def_p): Update prototype. * asan.c (asan_protect_global): Use symtab_get_node (decl)->implicit_section. * symtab.c (dump_symtab_base): Dump implicit sections. (verify_symtab_base): Verify sanity of sectoins and comdats. (symtab_resolve_alias): Alias share the section of its target. (set_section_1): New function. (symtab_node::set_section): Move here, recurse to aliases. (verify_symtab): Check for duplicated symtab lists. * tree-core.h (implicit_section_name_p): Remove. * tree-vect-data-refs.c: Include varasm.h. (vect_can_force_dr_alignment_p): Fix conditional on when decl bints to current definition; use symtab_get_node (decl)->implicit_section. * cgraph.c (cgraph_make_node_local_1): Fix section set. * cgraph.h (struct symtab_node): Add implicit_section. (set_section): Rename to ... (set_section_for_node): ... this one. (set_section): Declare. * tree.h (DECL_HAS_IMPLICIT_SECTION_NAME_P): Remove. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Stream implicit_section. * ipa.c (symtab_remove_unreachable_nodes): Do not check symtab before removal; it will fail in LTO. * vtable-class-hierarchy.c: Use symtab_get_node (var_decl)->implicit_section. * optimize.c (cdtor_comdat_group): Fix handling of aliases. (maybe_clone_body): Move symbol across comdat groups. * method.c (use_thunk): Copy implicit section flag. * go/go-gcc.cc (Gcc_backend::global_variable_set_init): Use symtab_get_node(var_decl)->implicit_section. * lto.c (read_cgraph_and_symbols): Remove unreachable symbols. (do_whole_program_analysis): Use verify_symtab. From-SVN: r211434
2014-06-11 07:51:23 +02:00
set_decl_section_name (thunk_fndecl, DECL_SECTION_NAME (fn));
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
symtab_node::get (thunk_fndecl)->implicit_section
= symtab_node::get (fn)->implicit_section;
}
}
/* Set up cloned argument trees for the thunk. */
t = NULL_TREE;
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
for (a = DECL_ARGUMENTS (function); a; a = DECL_CHAIN (a))
{
tree x = copy_node (a);
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
DECL_CHAIN (x) = t;
DECL_CONTEXT (x) = thunk_fndecl;
Makefile.in (EXCEPT_H): Fix typo. gcc/ChangeLog: * Makefile.in (EXCEPT_H): Fix typo. objc/ChangeLog: * objc-act.h: Do not include gimple.h. * objc-act.c: Do not include rtl.h, expr.h, libfuncs.h, and tm_p.h. Include gimple.h. Explain why except.h has to be included. * objc-lang.c: Do not include diagnostics.h. * Make-lang.in: Update dependencies. objcp/ChangeLog: * objcp-decl.c: Do not include tm.h, rtl.h, expr.h, c-common.h, flags.h, input.h, except.h, output.h, toplev.h, cpplib.h, debug.h, and target.h. * objcp-lang.c: Do not include tm.h, toplev.h, diagnostics.h, and debug.h. Explain why except.h has to be included. * Make-lang.in: Update dependencies. cp/ChangeLog: * cp-tree.h: Do not include splay-tree.h. (struct prtmem_cst): Remove unused field and false comment. * typeck.c: Do not include rtl.h, expr.h, and tm_p.h. * optimize.c: Do not inclde rtl.h, insn-config.h, and integrate.h. * init.c: Do not include rtl.h and expr.h. * class.c: Do not include rtl.h. Include splay-tree.h. (build_clone): Use plain NULL instead of NULL_RTX. * decl.c: Do not include expr.h. Explain why rtl.h has to be included. Include splay-tree.h. * method.c: Do not include rtl.h and expr.h. (use_thunk): Use plain NULL instead of NULL_RTX. * except.c: Do not include rtl.h, expr.h, and libfuncs.h. * tree.c: Do not include rtl.h, insn-config.h, integrate.h, and target.h. Include splay-tree.h. * expr.c: Do not include rtl.h and expr.h. * pt.c: Do not include obstack.h and rtl.h. (tsubst_friend_function): Use plain NULL instead of NULL_RTX. (tsubst_decl): Likewise. (instantiate_decl): Likewise. * semantics.c: Do not include exprt.h and debug.h. Explain why rtl.h has to be included. * decl2.c: Do not include rtl.h and expr.h. Include splay-tree.h. * call.c: Do not include rtl.h and expr.h. * search.c: Do not include obstack.h and rtl.h. * friend.c: Do not include rtl.h and expr.h. * Make-lang.in: Update dependencies. From-SVN: r159839
2010-05-25 20:14:23 +02:00
SET_DECL_RTL (x, NULL);
DECL_HAS_VALUE_EXPR_P (x) = 0;
TREE_ADDRESSABLE (x) = 0;
t = x;
}
a = nreverse (t);
DECL_ARGUMENTS (thunk_fndecl) = a;
TREE_ASM_WRITTEN (thunk_fndecl) = 1;
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
funcn = cgraph_node::get (function);
gcc_checking_assert (funcn);
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
thunk_node = funcn->create_thunk (thunk_fndecl, function,
this_adjusting, fixed_offset, virtual_value,
virtual_offset, alias);
if (DECL_ONE_ONLY (function))
IPA C++ refactoring 1/N * cgraph.h (symtab_node): (void register_symbol (void)): created from symtab_register_node (void remove (void)): created from symtab_remove_node (void dump (FILE *f)): created from dump_symtab_node (void DEBUG_FUNCTION debug (void)): created from debug_symtab_node (void DEBUG_FUNCTION verify (void)): created from verify_symtab_node (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type)): created from add_reference (struct ipa_ref *add_reference (symtab_node *referred_node, enum ipa_ref_use use_type, gimple stmt)): created from add_reference (struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type, gimple stmt)): created from maybe_add_reference (bool semantically_equivalent_p (symtab_node *target)): created from symtab_semantically_equivalent_p (void remove_from_same_comdat_group (void)): created from remove_from_same_comdat_group (void add_to_same_comdat_group (symtab_node *old_node)): created from symtab_add_to_same_comdat_group (void dissolve_same_comdat_group_list (void)): created from symtab_dissolve_same_comdat_group_list (bool used_from_object_file_p (void)): created from symtab_used_from_object_file_p (symtab_node *ultimate_alias_target (enum availability *avail = NULL)): created from symtab_alias_ultimate_target (inline symtab_node *next_defined_symbol (void)): created from symtab_next_defined_symbol (bool resolve_alias (symtab_node *target)): created from symtab_resolve_alias (bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), void *data, bool include_overwrite)): created from symtab_for_node_and_aliases (symtab_node *noninterposable_alias (void)): created from symtab_nonoverwritable_alias (inline symtab_node *get_alias_target (void)): created from symtab_alias_target (void set_section (const char *section)): created from set_section_1 (enum availability get_availability (void)): created from symtab_node_availability (void make_decl_local (void)): created from symtab_make_decl_local (bool real_symbol_p (void)): created from symtab_read_node (can_be_discarded_p (void)): created from symtab_can_be_discarded (inline bool comdat_local_p (void)): created from symtab_comdat_local_p (inline bool in_same_comdat_group_p (symtab_node *target)): created from symtab_in_same_comdat_p; (bool address_taken_from_non_vtable_p (void)): created from address_taken_from_non_vtable_p (static inline symtab_node *get (const_tree decl)): created from symtab_get_node (static void dump_table (FILE *)): created from dump_symtab (static inline DEBUG_FUNCTION void debug_symtab (void)): created from debug_symtab (static DEBUG_FUNCTION void verify_symtab_nodes (void)): created from verify_symtab (static bool used_from_object_file_p_worker (symtab_node *node)): created from symtab_used_from_object_file_p (void dump_base (FILE *)): created from dump_symtab_base (bool DEBUG_FUNCTION verify_base (void)): created from verify_symtab_base (void unregister (void)): created from symtab_unregister_node (struct symbol_priority_map *priority_info (void)): created from symtab_priority_info (static bool set_implicit_section (symtab_node *n, void *)): created from set_implicit_section (static bool noninterposable_alias (symtab_node *node, void *data)): created from symtab_nonoverwritable_alias_1 * cgraph.h (cgraph_node): (bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL)): created from cgraph_remove_node_and_inline_clones (void record_stmt_references (gimple stmt)): created from ipa_record_stmt_references (void set_call_stmt_including_clones (gimple old_stmt, gimple new_stmt, bool update_speculative = true)): created from cgraph_set_call_stmt_including_clones (cgraph_node *function_symbol (enum availability *avail = NULL)): created from cgraph_function_node (cgraph_node *create_clone (tree decl, gcov_type count, int freq, bool update_original, vec<cgraph_edge *> redirect_callers, bool call_duplication_hook, struct cgraph_node *new_inlined_to, bitmap args_to_skip)): created from cgraph_create_clone (cgraph_node *create_virtual_clone (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, const char * suffix)): created from cgraph_create_virtual_clone (cgraph_node *find_replacement (void)): created from cgraph_find_replacement_node (cgraph_node *create_version_clone (tree new_decl, vec<cgraph_edge *> redirect_callers, bitmap bbs_to_copy)): created from cgraph_copy_node_for_versioning (cgraph_node *create_version_clone_with_body (vec<cgraph_edge *> redirect_callers, vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip, bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, const char *clone_name)): created from cgraph_function_version_info (struct cgraph_function_version_info *insert_new_function_version (void)): created from insert_new_cgraph_node_version (struct cgraph_function_version_info *function_version (void)): created from get_cgraph_node_version (void analyze (void)): created from analyze_function (cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias) cgraph_add_thunk (inline cgraph_node *get_alias_target (void)): created from cgraph_alias_target (cgraph_node *ultimate_alias_target (availability *availability = NULL)): created from cgraph_function_or_thunk_node (bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)): created from expand_thunk (void reset (void)): created from cgraph_reset_node (void create_wrapper (cgraph_node *target)): created from cgraph_make_wrapper (void DEBUG_FUNCTION verify_node (void)): created from verify_cgraph_node (void remove (void)): created from cgraph_remove_node (void dump (FILE *f)): created from dump_cgraph_node (void DEBUG_FUNCTION debug (void)): created from debug_cgraph_node (bool get_body (void)): created from cgraph_get_body (void release_body (void)): created from cgraph_release_function_body (void unnest (void)): created from cgraph_unnest_node (void make_local (void)): created from cgraph_make_node_local (void mark_address_taken (void)): created from cgraph_mark_address_taken_node (struct cgraph_edge *create_edge (cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)): created from cgraph_create_edge (struct cgraph_edge *create_indirect_edge (gimple call_stmt, int ecf_flags, gcov_type count, int freq)): created from cgraph_create_indirect_edge (void create_edge_including_clones (struct cgraph_node *callee, gimple old_stmt, gimple stmt, gcov_type count, int freq, cgraph_inline_failed_t reason)): created from cgraph_create_edge_including_clones (cgraph_edge *get_edge (gimple call_stmt)): created from cgraph_edge (vec<cgraph_edge *> collect_callers (void)): created from collect_callers_of_node (void remove_callers (void)): created from cgraph_node_remove_callers (void remove_callees (void)): created from cgraph_node_remove_callees (enum availability get_availability (void)): created from cgraph_function_body_availability (void set_nothrow_flag (bool nothrow)): created from cgraph_set_nothrow_flag (void set_const_flag (bool readonly, bool looping)): created from cgraph_set_const_flag (void set_pure_flag (bool pure, bool looping)): created from cgraph_set_pure_flag (void call_duplication_hooks (cgraph_node *node2)): created from cgraph_call_node_duplication_hooks (bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, void *), void *data, bool include_overwritable)): created from cgraph_for_node_and_aliases (bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, void *data), void *data, bool include_overwritable)): created from cgraph_for_node_thunks_and_aliases (void call_function_insertion_hooks (void)): created from cgraph_call_function_insertion_hooks (inline void mark_force_output (void)): created from cgraph_mark_force_output_node (bool local_p (void)): created from cgraph_local_node (bool can_be_local_p (void)): created from cgraph_node_can_be_local_p (bool cannot_return_p (void)): created from cgraph_node_cannot_return (bool only_called_directly_p (void)): created from cgraph_only_called_directly_p (inline bool only_called_directly_or_aliased_p (void)): created from cgraph_only_called_directly_or_aliased_p (bool will_be_removed_from_program_if_no_direct_calls_p (void)): created from cgraph_will_be_removed_from_program_if_no_direct_calls (bool can_remove_if_no_direct_calls_and_refs_p (void)): created from cgraph_can_remove_if_no_direct_calls_and_refs_p (bool can_remove_if_no_direct_calls_p (void)): created from cgraph_can_remove_if_no_direct_calls_p (inline bool has_gimple_body_p (void)): created from cgraph_function_with_gimple_body_p (bool optimize_for_size_p (void)): created from cgraph_optimize_for_size_p (static void dump_cgraph (FILE *f)): created from dump_cgraph (static inline void debug_cgraph (void)): created from debug_cgraph (static void record_function_versions (tree decl1, tree decl2)): created from record_function_versions (static void delete_function_version (tree decl)): created from delete_function_version (static void add_new_function (tree fndecl, bool lowered)): created from cgraph_add_new_function (static inline cgraph_node *get (const_tree decl)): created from cgraph_get_node (static cgraph_node * create (tree decl)): created from cgraph_create_node (static cgraph_node * create_empty (void)): created from cgraph_create_empty_node (static cgraph_node * get_create (tree)): created from cgraph_get_create_node (static cgraph_node *get_for_asmname (tree asmname)): created from cgraph_node_for_asm (static cgraph_node * create_same_body_alias (tree alias, tree decl)): created from cgraph_same_body_alias (static bool used_from_object_file_p_worker (cgraph_node *node, void *): new function (static bool non_local_p (cgraph_node *node, void *)): created from cgraph_non_local_node_p_1 (static void DEBUG_FUNCTION verify_cgraph_nodes (void)): created from verify_cgraph (static bool make_local (cgraph_node *node, void *)): created from cgraph_make_node_local (static cgraph_node *create_alias (tree alias, tree target)): created from cgraph_create_function_alias (static cgraph_edge * create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt, gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_create_edge_1 * cgraph.h (varpool_node): (void remove (void)): created from varpool_remove_node (void dump (FILE *f)): created from dump_varpool_node From-SVN: r212982
2014-07-24 14:07:13 +02:00
thunk_node->add_to_same_comdat_group (funcn);
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
pop_from_top_level ();
}
/* Code for synthesizing methods which have default semantics defined. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* True iff CTYPE has a trivial SFK. */
static bool
type_has_trivial_fn (tree ctype, special_function_kind sfk)
{
switch (sfk)
{
case sfk_constructor:
return !TYPE_HAS_COMPLEX_DFLT (ctype);
case sfk_copy_constructor:
return !TYPE_HAS_COMPLEX_COPY_CTOR (ctype);
case sfk_move_constructor:
return !TYPE_HAS_COMPLEX_MOVE_CTOR (ctype);
case sfk_copy_assignment:
return !TYPE_HAS_COMPLEX_COPY_ASSIGN (ctype);
case sfk_move_assignment:
return !TYPE_HAS_COMPLEX_MOVE_ASSIGN (ctype);
case sfk_destructor:
return !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype);
case sfk_inheriting_constructor:
return false;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
default:
gcc_unreachable ();
}
}
/* Note that CTYPE has a non-trivial SFK even though we previously thought
it was trivial. */
static void
type_set_nontrivial_flag (tree ctype, special_function_kind sfk)
{
switch (sfk)
{
case sfk_constructor:
TYPE_HAS_COMPLEX_DFLT (ctype) = true;
return;
case sfk_copy_constructor:
TYPE_HAS_COMPLEX_COPY_CTOR (ctype) = true;
return;
case sfk_move_constructor:
TYPE_HAS_COMPLEX_MOVE_CTOR (ctype) = true;
return;
case sfk_copy_assignment:
TYPE_HAS_COMPLEX_COPY_ASSIGN (ctype) = true;
return;
case sfk_move_assignment:
TYPE_HAS_COMPLEX_MOVE_ASSIGN (ctype) = true;
return;
case sfk_destructor:
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype) = true;
return;
case sfk_inheriting_constructor:
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
default:
gcc_unreachable ();
}
}
/* True iff FN is a trivial defaulted member function ([cd]tor, op=). */
bool
trivial_fn_p (tree fn)
{
if (TREE_CODE (fn) == TEMPLATE_DECL)
return false;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (!DECL_DEFAULTED_FN (fn))
return false;
/* If fn is a clone, get the primary variant. */
re PR c++/41090 (Using static label reference in c++ class constructor produces wrong code) PR c++/41090 Add -fdeclone-ctor-dtor. gcc/cp/ * optimize.c (can_alias_cdtor, populate_clone_array): Split out from maybe_clone_body. (maybe_thunk_body): New function. (maybe_clone_body): Call it. * mangle.c (write_mangled_name): Remove code to suppress writing of mangled name for cloned constructor or destructor. (write_special_name_constructor): Handle decloned constructor. (write_special_name_destructor): Handle decloned destructor. * method.c (trivial_fn_p): Handle decloning. * semantics.c (expand_or_defer_fn_1): Clone after setting linkage. gcc/c-family/ * c.opt: Add -fdeclone-ctor-dtor. * c-opts.c (c_common_post_options): Default to on iff -Os. gcc/ * cgraph.h (struct cgraph_node): Add calls_comdat_local. (symtab_comdat_local_p, symtab_in_same_comdat_p): New. * cif-code.def: Add USES_COMDAT_LOCAL. * symtab.c (verify_symtab_base): Make sure we don't refer to a comdat-local symbol from outside its comdat. * cgraph.c (verify_cgraph_node): Likewise. * cgraphunit.c (mark_functions_to_output): Don't mark comdat-locals. * ipa.c (symtab_remove_unreachable_nodes): Likewise. (function_and_variable_visibility): Handle comdat-local fns. * ipa-cp.c (determine_versionability): Don't clone comdat-locals. * ipa-inline-analysis.c (compute_inline_parameters): Update calls_comdat_local. * ipa-inline-transform.c (inline_call): Likewise. (save_inline_function_body): Don't clear DECL_COMDAT_GROUP. * ipa-inline.c (can_inline_edge_p): Check calls_comdat_local. * lto-cgraph.c (input_overwrite_node): Read calls_comdat_local. (lto_output_node): Write it. * symtab.c (symtab_dissolve_same_comdat_group_list): Clear DECL_COMDAT_GROUP for comdat-locals. include/ * demangle.h (enum gnu_v3_ctor_kinds): Added literal gnu_v3_unified_ctor. (enum gnu_v3_ctor_kinds): Added literal gnu_v3_unified_dtor. libiberty/ * cp-demangle.c (cplus_demangle_fill_ctor,cplus_demangle_fill_dtor): Handle unified ctor/dtor. (d_ctor_dtor_name): Handle unified ctor/dtor. From-SVN: r206182
2013-12-23 18:49:47 +01:00
if (tree prim = DECL_CLONED_FUNCTION (fn))
fn = prim;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
return type_has_trivial_fn (DECL_CONTEXT (fn), special_function_p (fn));
}
/* PARM is a PARM_DECL for a function which we want to forward to another
function without changing its value category, a la std::forward. */
tree
forward_parm (tree parm)
{
tree exp = convert_from_reference (parm);
tree type = TREE_TYPE (parm);
if (DECL_PACK_P (parm))
type = PACK_EXPANSION_PATTERN (type);
if (TREE_CODE (type) != REFERENCE_TYPE)
type = cp_build_reference_type (type, /*rval=*/true);
exp = build_static_cast (type, exp, tf_warning_or_error);
if (DECL_PACK_P (parm))
exp = make_pack_expansion (exp);
return exp;
}
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
/* Strip all inheriting constructors, if any, to return the original
constructor from a (possibly indirect) base class. */
tree
strip_inheriting_ctors (tree dfn)
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
{
gcc_assert (flag_new_inheriting_ctors);
tree fn = dfn;
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
while (tree inh = DECL_INHERITED_CTOR (fn))
{
inh = OVL_CURRENT (inh);
fn = inh;
}
if (TREE_CODE (fn) == TEMPLATE_DECL
&& TREE_CODE (dfn) == FUNCTION_DECL)
fn = DECL_TEMPLATE_RESULT (fn);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
return fn;
}
/* Find the binfo for the base subobject of BINFO being initialized by
inherited constructor FNDECL (a member of a direct base of BINFO). */
static tree inherited_ctor_binfo (tree, tree);
static tree
inherited_ctor_binfo_1 (tree binfo, tree fndecl)
{
tree base = DECL_CONTEXT (fndecl);
tree base_binfo;
for (int i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
if (BINFO_TYPE (base_binfo) == base)
return inherited_ctor_binfo (base_binfo, fndecl);
gcc_unreachable();
}
/* Find the binfo for the base subobject of BINFO being initialized by
inheriting constructor FNDECL (a member of BINFO), or BINFO if FNDECL is not
an inheriting constructor. */
static tree
inherited_ctor_binfo (tree binfo, tree fndecl)
{
tree inh = DECL_INHERITED_CTOR (fndecl);
if (!inh)
return binfo;
tree results = NULL_TREE;
for (; inh; inh = OVL_NEXT (inh))
{
tree one = inherited_ctor_binfo_1 (binfo, OVL_CURRENT (inh));
if (!results)
results = one;
else if (one != results)
results = tree_cons (NULL_TREE, one, results);
}
return results;
}
/* Find the binfo for the base subobject being initialized by inheriting
constructor FNDECL, or NULL_TREE if FNDECL is not an inheriting
constructor. */
tree
inherited_ctor_binfo (tree fndecl)
{
if (!DECL_INHERITED_CTOR (fndecl))
return NULL_TREE;
tree binfo = TYPE_BINFO (DECL_CONTEXT (fndecl));
return inherited_ctor_binfo (binfo, fndecl);
}
/* True if we should omit all user-declared parameters from constructor FN,
because it is a base clone of a ctor inherited from a virtual base. */
bool
ctor_omit_inherited_parms (tree fn)
{
if (!flag_new_inheriting_ctors)
/* We only optimize away the parameters in the new model. */
return false;
if (!DECL_BASE_CONSTRUCTOR_P (fn)
|| !CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fn)))
return false;
tree binfo = inherited_ctor_binfo (fn);
for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
if (BINFO_VIRTUAL_P (binfo))
return true;
return false;
}
/* True iff constructor(s) INH inherited into BINFO initializes INIT_BINFO.
This can be true for multiple virtual bases as well as one direct
non-virtual base. */
static bool
binfo_inherited_from (tree binfo, tree init_binfo, tree inh)
{
/* inh is an OVERLOAD if we inherited the same constructor along
multiple paths, check all of them. */
for (; inh; inh = OVL_NEXT (inh))
{
tree fn = OVL_CURRENT (inh);
tree base = DECL_CONTEXT (fn);
tree base_binfo = NULL_TREE;
for (int i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
if (BINFO_TYPE (base_binfo) == base)
break;
if (base_binfo == init_binfo
|| (flag_new_inheriting_ctors
&& binfo_inherited_from (base_binfo, init_binfo,
DECL_INHERITED_CTOR (fn))))
return true;
}
return false;
}
/* Subroutine of do_build_copy_constructor: Add a mem-initializer for BINFO
given the parameter or parameters PARM, possibly inherited constructor
base INH, or move flag MOVE_P. */
static tree
add_one_base_init (tree binfo, tree parm, bool move_p, tree inh,
tree member_init_list)
{
tree init;
if (inh)
{
/* An inheriting constructor only has a mem-initializer for
the base it inherits from. */
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
if (!binfo_inherited_from (TYPE_BINFO (current_class_type), binfo, inh))
return member_init_list;
tree *p = &init;
init = NULL_TREE;
for (; parm; parm = DECL_CHAIN (parm))
{
tree exp = forward_parm (parm);
*p = build_tree_list (NULL_TREE, exp);
p = &TREE_CHAIN (*p);
}
}
else
{
init = build_base_path (PLUS_EXPR, parm, binfo, 1,
tf_warning_or_error);
if (move_p)
init = move (init);
init = build_tree_list (NULL_TREE, init);
}
return tree_cons (binfo, init, member_init_list);
}
/* Generate code for default X(X&) or X(X&&) constructor or an inheriting
constructor. */
1996-07-11 03:13:25 +02:00
static void
do_build_copy_constructor (tree fndecl)
{
Do put the VTT parameter in DECL_ARGUMENTS. * cp-tree.h (struct cp_language_function): Add x_vtt_parm. (current_vtt_parm): New macro. (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm. (DECL_HAS_VTT_PARM_P): New macro. (DECL_VTT_PARM): Remove. (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros. * decl.c (duplicate_decls): Only copy the operator code if appropriate. (start_function): Set current_vtt_parm. (lang_mark_tree): Don't mark vtt_parm. * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P. * class.c (build_clone): Maybe remove the VTT parm. * optimize.c (maybe_clone_body): Set up the VTT parm. * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm. * call.c (build_over_call): Just allow the VTT arg. * method.c (make_thunk): Don't set DECL_VTT_PARM. (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM. (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE. * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise. * error.c (dump_function_decl): Likewise. * call.c (build_user_type_conversion_1, convert_like_real): Abort if we try to call a constructor with in-charge or VTT parms. * method.c (skip_artificial_parms_for): New fn. * call.c (add_function_candidate, build_over_call): Call it. * call.c (build_new_method_call): Use current_vtt_parm. * init.c (expand_virtual_init): Likewise. * class.c (same_signature_p): No longer static. * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. From-SVN: r39841
2001-02-18 20:08:00 +01:00
tree parm = FUNCTION_FIRST_USER_PARM (fndecl);
bool move_p = DECL_MOVE_CONSTRUCTOR_P (fndecl);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
bool trivial = trivial_fn_p (fndecl);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
tree inh = DECL_INHERITED_CTOR (fndecl);
if (!inh)
parm = convert_from_reference (parm);
if (trivial)
{
if (is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
else if (tree_int_cst_equal (TYPE_SIZE (current_class_type),
CLASSTYPE_SIZE (current_class_type)))
{
tree t = build2 (INIT_EXPR, void_type_node, current_class_ref, parm);
finish_expr_stmt (t);
}
else
{
/* We must only copy the non-tail padding parts. */
tree base_size = CLASSTYPE_SIZE_UNIT (current_class_type);
base_size = size_binop (MINUS_EXPR, base_size, size_int (1));
tree array_type = build_array_type (unsigned_char_type_node,
build_index_type (base_size));
tree alias_set = build_int_cst (TREE_TYPE (current_class_ptr), 0);
tree lhs = build2 (MEM_REF, array_type,
current_class_ptr, alias_set);
tree rhs = build2 (MEM_REF, array_type,
TREE_OPERAND (parm, 0), alias_set);
tree t = build2 (INIT_EXPR, void_type_node, lhs, rhs);
finish_expr_stmt (t);
}
}
else
{
tree fields = TYPE_FIELDS (current_class_type);
cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list. * cp-tree.h (struct language_function): Remove x_base_init_list and x_member_init_list. (current_base_init_list): Remove. (current_member_init_list): Likewise. (setup_vtbl_ptr): Change prototype. (emit_base_init): Likewise. (expand_member_init): Likewise. (reinit_parse_for_function): Remove. * decl.c (save_function_data): Don't clear x_base_init_list and x_member_init_list. (mark_language_function): Don't mark them. * init.c (perform_member_init): Tweak comment. (sort_member_init): Take the list of initializers as an argument. (sort_base_init): Likewise. (emit_base_init): Likewise. (expand_member_init): Return the initializer. Don't use global variables. * lex.c (reinit_parse_for_function): Remove. * method.c (build_template_parm_names): Correct substitution. (do_build_copy_constructor): Don't use current_member_init_list and current_base_init_list. (synthesize_method): Likewise. * parse.y (base_init): Split mem-initializers into base-initializers and field-initializers. (member_init_list): Build up the list here. (member_init): Return the initializer. (fn.depfn): Don't use reinit_parse_for_function. * parse.c: Regenerated. * pt.c (convert_nontype_argument): Don't make an ADDR_EXPR of the ERROR_MARK. (tsubst_expr): Don't use current_member_init_list and current_base_init_list. (tsubst_expr_values): Rename to ... (tsubst_initializer_list): ... this. Use convert_from_reference. * semantics.c (setup_vtbl_ptr): Don't use current_member_init_list and current_base_init_list. (begin_function_definition): Don't call reinit_parse_for_function. * dump.c (dequeue_and_dump): Use TREE_VEC_LENGTH with vectors. * error.c (dump_expr): Handle ADDR_EXPRs with REFERENCE_TYPE correctly. From-SVN: r34571
2000-06-16 09:34:51 +02:00
tree member_init_list = NULL_TREE;
2001-11-22 03:33:02 +01:00
int cvquals = cp_type_quals (TREE_TYPE (parm));
int i;
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
tree binfo, base_binfo;
tree init;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *vbases;
/* Initialize all the base-classes with the parameter converted
to their type so that we get their copy constructor and not
another constructor that takes current_class_type. We must
deal with the binfo's directly as a direct base might be
inaccessible due to ambiguity. */
for (vbases = CLASSTYPE_VBASECLASSES (current_class_type), i = 0;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_iterate (vbases, i, &binfo); i++)
{
member_init_list = add_one_base_init (binfo, parm, move_p, inh,
member_init_list);
}
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
for (binfo = TYPE_BINFO (current_class_type), i = 0;
BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
{
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
if (BINFO_VIRTUAL_P (base_binfo))
continue;
member_init_list = add_one_base_init (base_binfo, parm, move_p,
inh, member_init_list);
}
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
for (; fields; fields = DECL_CHAIN (fields))
{
tree field = fields;
tree expr_type;
if (TREE_CODE (field) != FIELD_DECL)
continue;
if (inh)
continue;
expr_type = TREE_TYPE (field);
if (DECL_NAME (field))
{
if (VFIELD_NAME_P (DECL_NAME (field)))
continue;
}
else if (ANON_AGGR_TYPE_P (expr_type) && TYPE_FIELDS (expr_type))
/* Just use the field; anonymous types can't have
nontrivial copy ctors or assignment ops or this
function would be deleted. */;
else
continue;
/* Compute the type of "init->field". If the copy-constructor
parameter is, for example, "const S&", and the type of
the field is "T", then the type will usually be "const
T". (There are no cv-qualified variants of reference
types.) */
if (TREE_CODE (expr_type) != REFERENCE_TYPE)
{
int quals = cvquals;
if (DECL_MUTABLE_P (field))
quals &= ~TYPE_QUAL_CONST;
quals |= cp_type_quals (expr_type);
expr_type = cp_build_qualified_type (expr_type, quals);
}
init = build3 (COMPONENT_REF, expr_type, parm, field, NULL_TREE);
if (move_p && TREE_CODE (expr_type) != REFERENCE_TYPE
/* 'move' breaks bit-fields, and has no effect for scalars. */
&& !scalarish_type_p (expr_type))
init = move (init);
init = build_tree_list (NULL_TREE, init);
member_init_list = tree_cons (field, init, member_init_list);
}
finish_mem_initializers (member_init_list);
}
}
static void
do_build_copy_assign (tree fndecl)
{
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
tree parm = DECL_CHAIN (DECL_ARGUMENTS (fndecl));
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
tree compound_stmt;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
bool move_p = move_fn_p (fndecl);
bool trivial = trivial_fn_p (fndecl);
int flags = LOOKUP_NORMAL | LOOKUP_NONVIRTUAL | LOOKUP_DEFAULTED;
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
compound_stmt = begin_compound_stmt (0);
parm = convert_from_reference (parm);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (trivial
&& is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
else if (trivial)
{
call.c (build_vfield_ref, [...]): Replace calls to build with calls to buildN. * call.c (build_vfield_ref, build_call, build_conditional_expr, convert_arg_to_ellipsis, build_x_va_arg, build_over_call, build_java_interface_fn_ref, build_special_member_call, build_new_method_call, initialize_reference): Replace calls to build with calls to buildN. * class.c (build_base_path, convert_to_base_statically, build_vfn_ref, instantiate_type, dfs_accumulate_vtbl_inits, build_vtbl_initializer): Likewise. * cp-gimplify.c (genericize_try_block, genericize_catch_block, gimplify_if_stmt, cp_genericize_r): Likewise. * cvt.c (convert_to_void): Likewise. * decl.c (check_initializer, finish_constructor_body, finish_destructor_body): Likewise. * error.c (dump_expr): Likewise. * except.c (build_exc_ptr, expand_start_catch_block, build_throw): Likewise. * init.c (perform_member_init, expand_virtual_init, expand_cleanup_for_base, build_init, expand_default_init, build_offset_ref, decl_constant_value, build_new, build_new_1, build_vec_delete_1, build_vec_init, build_delete, push_base_cleanups, build_vec_delete): Likewise. * mangle.c (write_integer_cst): Likewise. * method.c (thunk_adjust, do_build_copy_constructor, do_build_assign_ref): Likewise. * pt.c (lookup_template_function, tsubst, tsubst_copy_and_build, unify, build_non_dependent_expr): Likewise. * rtti.c (build_headof, build_typeid, ifnonnull, build_dyanmic_cast_1, tinfo_base_init): Likewise. * semantics.c (begin_compound_stmt, finish_call_expr, finish_pseudo_destructor_expr, finish_id_expression, simplify_aggr_init_expr, finalize_nrv_r): Likewise. * tree.c (build_target_expr, build_cplus_new, array_type_nelts_top, array_type_nelts_total, stabilize_call): Likewise. * typeck.c (decay_conversion, build_class_member_access_expr, lookup_destructor, build_ptrmemfunc_access_expr, build_array_ref, get_member_function_from_ptrfunc, build_binary_op, pointer_diff, build_x_unary_op, build_unary_op, unary_complex_lvalue, build_compound_expr, build_modify_expr, expand_ptrmemfunc_cst, check_return_expr): Likewise. * typeck2.c (split_nonconstant_1, split_nonconstant_init_1, split_nonconstant_init, store_init_value, build_m_component_ref): Likewise. From-SVN: r86047
2004-08-16 04:08:06 +02:00
tree t = build2 (MODIFY_EXPR, void_type_node, current_class_ref, parm);
cp-tree.def (SUBOBJECT): New tree node. * cp-tree.def (SUBOBJECT): New tree node. * cp-tree.h (CLEANUP_P): New macro. (SUBOBJECT_CLEANUP): Likewise. (keep_next_level): Add parameter. (get_temp_regvar): Don't declare. (emit_base_init): Remove parameter. (expand_aggr_init): Rename to build_aggr_init. (expand_vec_init): Rename to build_vec_init. (do_pushlevel): Remove. (do_poplevel): Likewise. (finish_cleanup): New function. (finish_subobject): Likewise. (stmts_are_full_exprs_p): New variable. * decl.c (keep_next_level): Add parameter. (cp_finish_decl): Use build_aggr_init, not expand_aggr_init. Use finish_expr_stmt to expand the code. (expand_static_init): Use tree-generating, not RTL-generating, functions to handle the initialization. (start_function): Remove dead code. Always have a momentary obstack inside the function, even before hitting the first curly brace. (cplus_expand_expr_stmt): Move calls to expand_{start,end}_target_temps into semantics.c. (cp_function): Add stmts_are_full_exprs_p. (push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * decl2.c (get_temp_regvar): Move to init.c. (do_static_initialization): Use build_{aggr,vec}_init. (do_static_destruction): Fix typo in comment. * dump.c (dequeue_and_dump): Handle INIT_EXPR. * except.c (expand_throw): Use create_temporary_var. * expr.c (cplus_expand_expr): Use build_{aggr,vec}_init. * init.c (expand_vec_init_try_block): Remove. (expand_vec_init_catch_clause): Likewise. (get_temp_regvar): New function. (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (perform_member_init): Use build_{aggr,vec}_init. Build up tree structure here. (emit_base_init): Likewise. Remove unused parameter. (expand_virtual_init): Likewise. (expand_cleanup_for_base): Use finish_subobject. (expand_aggr_vbase_init_1): Simplify. (construct_virtual_bases): Use tree-generating functions to build up initialization. (expand_aggr_init): Likewise. Rename to build_aggr_init. (expand_default_init): Likewise. (expand_aggr_init_1): Likewise. (expand_vec_init): Rename to build_vec_init. * method.c (do_build_copy_constructor): Use tree-generating functions. Don't call clear_last_expr. (do_build_assign_ref): Likewise. (synthesize_method): Call clear_last_expr here. * parse.y (base_init): Don't call clear_last_expr here. (nodecls): Likewise. * pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set. * semantics.c (do_pushlevel): Move to here. (do_poplevel): Likewise. (stmts_are_full_exprs_p): New variable. (finish_expr_stmt): Handle logic for temoprary cleanup here. (finish_for_stmt): Use finish_expr_stmt. (finish_cleanup): New function. (finish_function_try_block): Fix indentation. (finish_subobject): New function. (setup_vtbl_ptr): Call keep_next_level here. (finish_stmt_expr): Handle a block with no scope inside the statement-expression. (expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set. Handle SUBOBJECT. * tree.c (search_tree): Handle INIT_EXPR. (mapcar): Likewise. * typeck.c (build_modify_expr): Don't build an RTL_EXPR. * typeck2.c (store_init_value): Change expand_aggr_init to build_aggr_init in comment. From-SVN: r28878
1999-08-26 00:07:18 +02:00
finish_expr_stmt (t);
}
else
{
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
tree fields;
2001-11-22 03:33:02 +01:00
int cvquals = cp_type_quals (TREE_TYPE (parm));
int i;
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
tree binfo, base_binfo;
/* Assign to each of the direct base classes. */
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
for (binfo = TYPE_BINFO (current_class_type), i = 0;
BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
{
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
tree converted_parm;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *parmvec;
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
/* We must convert PARM directly to the base class
explicitly since the base class may be ambiguous. */
converted_parm = build_base_path (PLUS_EXPR, parm, base_binfo, 1,
tf_warning_or_error);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (move_p)
converted_parm = move (converted_parm);
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
/* Call the base class assignment operator. */
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
parmvec = make_tree_vector_single (converted_parm);
finish_expr_stmt
(build_special_member_call (current_class_ref,
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
cp_assignment_operator_id (NOP_EXPR),
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
&parmvec,
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
base_binfo,
flags,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tf_warning_or_error));
tree.c (build_tree_list_vec_stat): New function. ./: * tree.c (build_tree_list_vec_stat): New function. (ctor_to_vec): New function. (build_nt_call_vec): New function. (build_call_array): Change args to be a const pointer. (build_call_vec): New function. * tree.h (build_nt_call_vec): Declare. (build_tree_list_vec_stat): Declare. (build_tree_list_vec): Define. (build_call_array): Update declaration. (build_call_vec): Declare. (ctor_to_vec): Declare. * c-common.c (tree_vector_cache): New static variable. (make_tree_vector): New function. (release_tree_vector): New function. (make_tree_vector_single): New function. (make_tree_vector_copy): New function. * c-common.h (tree_vector_cache, make_tree_vector): Declare. (make_tree_vector_single, make_tree_vector_copy): Declare. * c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove. (c_parser_expr_list): Don't manage cache here, instead call make_tree_vector. (c_parser_release_expr_list): Remove static function. (c_parser_vec_to_tree_list): Remove static function. (c_parser_attributes): Call build_tree_list_vec instead of c_parser_vec_to_tree_list. Call release_tree_vector instead of c_parser_release_expr_list. (c_parser_postfix_expression_after_primary): Likewise. (c_parser_objc_keywordexpr): Likewise. cp/: * parser.c (cp_parser_postfix_expression): Change args to a vec. Release it when done. (tree_vector): Define typedef. Define VEC functions. (cp_parser_parenthesized_expression_list): Change return type to vec. Change all callers. (cp_parser_new_expression): Change placement and initializer to vecs. Release them when done. (cp_parser_new_placement): Change return type to vec. Change all callers. (cp_parser_new_initializer): Likewise. * typeck.c (build_function_call_vec): Just call cp_build_function_call_vec. (cp_build_function_call): Just build a vec and call cp_build_function_call_vec. (cp_build_function_call_vec): New function based on old cp_build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a vec. Change caller. (build_x_compound_expr_from_vec): New function. (cp_build_modify_expr): Build vec to pass to build_special_member_call. * call.c (struct z_candidate): Add first_arg field. Change args field to vec. (convert_class_to_reference): Handle first argument separately. (add_candidate): Add first_arg parameter. Change args parameter to vec. Change all callers. (add_function_candidate, add_conv_candidate): Likewise. (add_template_candidate_real, add_template_candidate): Likewise. (add_template_conv_candidate): Likewise. (build_user_type_conversion_1): Handle first argument separately. (resolve_args): Change return type and parameter type to vecs. Change all callers. (perform_overload_resolution): Change args parameter to vec. Change all callers. (build_new_function_call, build_operator_new_call): Likewise. (add_candidates): Likewise. (build_op_call): New globally visible function, built from and replacing static function build_object_call. (build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list, of arguments. (build_op_delete_call): Build vec to pass to cp_build_function_call_vec. (build_temp): Build vec to pass to build_special_member_call. (convert_like_real): Likewise. (perform_direct_initialization_if_possible): Likewise. (build_over_call): Handle first_arg field. Use build_call_array rather than build_call_list. (build_special_member_call): Change args parameter to vec. Change all callers. (build_new_method_call): Likewise. * init.c (expand_default_init): Change parms to vec. (build_raw_new_expr): Change placement and init to vecs. Change all callers. (build_new_1, build_new): Likewise. * class.c (resolve_address_of_overloaded_function): Build array to pass to fn_type_unification. * pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to build_new. For CALL_EXPR create a vec rather than a tree_list; expand a pack if necessary. (fn_type_unification): Change args parameter to const tree *. Add nargs parameter. Change all callers. (type_unification_real): Likewise. (unify): Build array to pass to type_unification_real. (get_bindings): Build array to pass to fn_type_unification. (any_type_dependent_arguments_p): Change args parameter to a vec. Change all callers. (make_args_non_dependent): Renamed from build_non_dependent_args. Change return type to void. Change parameter type to vec. Change all callers. (do_auto_deduction): Pass an array to type_unification_real. * semantics.c (perform_koenig_lookup): Change args to vec. Change all callers. (finish_call_expr): Change args to vec. Change all callers. Call build_op_call instead of passing CALL_EXPR to build_new_op. (cxx_omp_create_clause_info): Allocate vec to pass to build_special_member_call. * decl2.c (build_offset_ref_call_from_tree): Change args parameter to vec. Change all callers. * name-lookup.c (lookup_function_nonclass): Likewise. (struct arg_lookup): Change args to vec. (arg_assoc_namespace): Handle args as a vec. (arg_assoc_args_vec): New static function. (lookup_arg_dependent): Change args parameter to vec. Change all callers. * method.c (do_build_assign_ref): Allocate vec to pass to build_special_member_call. * except.c (build_throw): Likewise. * typeck2.c (build_functional_cast): Likewise. * cvt.c (ocp_convert): Likewise. * tree.c (build_min_non_dep_call_vec): Change last parameter to vec. Change all callers. * cp-tree.h: Update declarations. * name-lookup.h: Update declarations. objc/: * objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather than NULL_TREE to build_special_member_call. From-SVN: r147759
2009-05-21 07:58:39 +02:00
release_tree_vector (parmvec);
}
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
/* Assign to each of the non-static data members. */
for (fields = TYPE_FIELDS (current_class_type);
fields;
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
fields = DECL_CHAIN (fields))
{
tree comp = current_class_ref;
tree init = parm;
tree field = fields;
tree expr_type;
int quals;
store-layout.c (finish_record_layout): Add free_p parameter. * store-layout.c (finish_record_layout): Add free_p parameter. (layout_type): Pass it. * tree.h (finish_record_layout): Update prototype. * class.c (walk_subobject_offsets): Correct the calculation of offsets for virtual bases. Correct the counting of array elements. (layout_nonempty_base_or_field): Simplify. Correct the calculation of offsets to be propagated through the binfo hierarchy. (build_base_field): Avoid creating a FIELD_DECL for empty bases. Add the FIELD_DECL to TYPE_FIELDS. (build_base_fields): Adjust accordingly. (layout_virtual_bases): Use build_base_field. (end_of_class): Return a tree, not an integer. (warn_about_ambiguous_direct_bases): Rename to ... (warn_about_ambiguous_bases): ... this. (include_empty_classes): New function. (layout_class_type): Create an alternative version of the type to be used when as a base class type. Do not call finish_record_layout until we are done laying out the class. * cp-tree.h (lang_type_class): Remove size, size_unit. Add as_base. (CLASSTYPE_SIZE): Reimplement. (CLASSTYPE_SIZE_UNIT): Likewise. (CLASSTYPE_ALIGN): Likweise. (CLASSTYPE_USER_ALIGN): Likewise. (CLASSTYPE_AS_BASE): New macro. (DECL_INITIALIZED_P): Likewise. (extract_init): Remove prototype. (build_forced_zero_init): Rename to ... (build_zero_init): ... this. (force_store_init_value): Remove. * decl.c (obscure_complex_init): Remove. (duplicate_decls): Copy DECL_INITIALIZED_P. (check_initializer): Do not leave junk in DECL_INITIAL. (cp_finish_decl): Handle zero-initialization of entities with static storage duration. * expr.c (extract_init): Remove. * init.c (build_forced_zero_init): Remove. (build_zero_init): New function. (build_default_init): Use it. (build_field_list): Skip FIELD_DECLs for base subobjects. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. (synthesize_exception_spec): Likewise. * pt.c (tsubst_decl): Clear DECL_INITIALIZED_P. (regenerate_decl_from_template): To not set DECL_INITIAL for a static data member whose initialization took place in its class. (instantiate_decl): Do not pass an initializer to cp_finish_decl in that situation. * search.c (dfs_push_decls): Skip FIELD_DECLs for base subobjects. (dfs_unuse_fields): Likewise. * tree.c (pod_type_p): Handle error_mark_node. (zero_init_p): Likewise. * typeck.c (lookup_anon_field): Skip FIELD_DECLs for base subobjects. * typeck2.c (store_init_value): Remove #if 0'd code. (force_store_init_value): Remove. (process_init_constructor): Use build_zero_init. * g++.dg/abi/empty7.C: New test. * g++.dg/init/pm2.C: Likewise. From-SVN: r57654
2002-09-30 18:52:19 +02:00
if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
continue;
expr_type = TREE_TYPE (field);
if (CP_TYPE_CONST_P (expr_type))
{
cfgloop.c (verify_loop_structure): Use %' in diagnostics. * cfgloop.c (verify_loop_structure): Use %' in diagnostics. Start diagnostics with lowercase letters. * cgraphunit.c (verify_cgraph_node): Start diagnostics with lowercase letters. * collect2.c (maybe_run_lto_and_relink): Remove trailing '.' from diagnostic. * config/alpha/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/arm/arm.c (arm_get_pcs_model): Start diagnostics with lowercase letters. * config/arm/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. Remove trailing ' ' from diagnostic. * config/avr/avr.c (print_operand_address): Start diagnostic with a lowercase letter and remove trailing '.'. * config/avr/avr.opt (mpmem-wrap-around): Fix typo in help text. * config/bfin/bfin.c (bfin_option_override): Start diagnostics with lowercase letters. Use %' in diagnostics. Remove trailing '.' from diagnostics. (bfin_handle_longcall_attribute): Use %' in diagnostic. * config/cris/cris.c (cris_split_movdx, cris_expand_pic_call_address): Start diagnostics with lowercase letters. (cris_asm_output_label_ref): Use %' in diagnostic. * config/cris/cris.h (ASM_SPEC): Start diagnostic with a lowercase letter. * config/crx/crx.h (FUNCTION_PROFILER): Start diagnostic with a lowercase letter. * config/darwin-c.c (version_as_macro): Start diagnostic with a lowercase letter. * config/darwin-driver.c (darwin_default_min_version): Use %' in diagnostic. * config/host-darwin.c (darwin_gt_pch_use_address): Use %' in diagnostic. * config/i386/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/i386/host-cygwin.c (cygwin_gt_pch_get_address): Use %' in diagnostics. * config/i386/i386.c (ix86_option_override_internal): Write diagnostic as a single sentence without trailing '.'. Use %' in diagnostics. (ix86_function_sseregparm, classify_argument): Start diagnostics with lowercase letters. (ix86_expand_prologue): Use %' in diagnostic. * config/i386/i386.h (CC1_CPU_SPEC_1): Remove trailing '.' from diagnostic. * config/i386/nwld.h (LINK_SPEC): Start diagnostic with a lowercase letter. * config/i386/winnt.c (i386_pe_determine_dllimport_p): Use %' in diagnostic. * config/ia64/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/ia64/ia64.opt (msched-max-memory-insns-hard-limit): Avoid '`' in help text. * config/lm32/lm32.c (lm32_print_operand): Start diagnostic with a lowercase letter. * config/mep/mep.c (mep_validate_vliw): Start diagnostics with lowercase letters. * config/microblaze/microblaze.c (microblaze_handle_option): Remove trailing '.' from diagnostic. (print_operand): Start diagnostic with a lowercase letter. * config/pa/pa-hpux10.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa-hpux11.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa64-hpux.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/picochip/picochip.c (picochip_option_override, picochip_emit_save_register, picochip_function_arg, picochip_output_label, picochip_output_internal_label, picochip_asm_output_opcode, picochip_output_cbranch, picochip_output_compare, picochip_output_branch, picochip_get_vliw_alu_id): Remove trailing '.' and '\n' from diagnostics. Start diagnostics with lowercase letters. Use %' in diagnostics. * config/rs6000/rs6000.c (rs6000_option_override_internal): Use "SPE" capitalization. Start diagnostic with a lowercase letter. (rs6000_handle_option): Start diagnostics with lowercase letters. (def_builtin): Remove trailing '.' from diagnostic. (rs6000_savres_routine_name): Start diagnostic with a lowercase letter. * config/rs6000/sysv4.h (LINK_OS_FREEBSD_SPEC): Avoid '`' in diagnostic. * config/rx/rx.c (rx_handle_option): Start diagnostic with a lowercase letter. * config/s390/s390.c (s390_option_override) Start diagnostics with lowercase letters. Use %' in diagnostic. * config/sh/sh.c (sh_output_mi_thunk): Start diagnostics with lowercase letters. * config/sh/symbian-base.c (sh_symbian_mark_dllimport): Use %' in diagnostic. * config/sh/symbian-c.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sh/symbian-cxx.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sparc/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/spu/spu.c (spu_option_override): Start diagnostics with lowercase letters. Use %qs for quoting in diagnostics. (spu_check_builtin_parm): Remove trailing '.' from diagnostics. Use %wd instead of HOST_WIDE_INT_PRINT_DEC in diagnostic . * config/v850/v850.c (construct_save_jarl): Remove trailing '\n' from diagnostic. * convert.c (convert_to_integer, convert_to_vector): Use %' in diagnostics. * dbgcnt.c (dbg_cnt_process_opt): Start diagnostic with lowercase letter and use "cannot" spelling. * expmed.c (extract_fixed_bit_field): Start diagnostic with lowercase letter and format as a single sentence without '.'. * ggc-common.c (write_pch_globals, gt_pch_save, gt_pch_restore): Use %' in diagnostics. * ggc-page.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * ggc-zone.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * graph.c (clean_graph_dump_file): Use %' in diagnostic. * graphite-poly.c (graphite_read_scop_file): Start diagnostics with lowercase letters and remove tailing '.' and '\n'. * lto-cgraph.c (input_profile_summary): Start diagnostic with lowercase letter and remove trailing '.'. (input_cgraph): Start diagnostics with lowercase letters and remove trailing '\n'. * opts.c (finish_options, common_handle_option): Start diagnostics with lowercase letters and remove trailing '.'. Fix typo in diagnostic. * passes.c (position_pass): Start diagnostic with lowercase letter. * plugin.c (add_new_plugin, parse_plugin_arg_opt, register_callback, try_init_one_plugin): Start diagnostics with lowercase letters. * reload1.c (spill_failure): Use %' in diagnostic. (gen_reload): Start diagnostic with a lowercase letter. * stor-layout.c (place_field): Start diagnostic with a lowercase letter. * toplev.c (open_auxiliary_file): Use %' in diagnostic. * tree-cfg.c (verify_expr, verify_types_in_gimple_reference, verify_gimple_call, verify_gimple_phi, verify_eh_throw_stmt_node): Start diagnostics with lowercase letters, remove trailing '.' and use %' in diagnostics. * tree-ssa.c (verify_def): Remove trailing '.' from diagnostic. (verify_ssa): Don't split diagnostic across two error calls. Spell out "number" and use %' in diagnostic. * value-prof.c (visit_hist, check_counter): Start diagnostics with lowercase letters. c-family: * c-common.c (handle_mode_attribute): Use %' and word "signedness" in diagnostic. * c-opts.c (c_common_parse_file): Start diagnostics with lowercase letter. * c-pragma.c (handle_pragma_target, handle_pragma_optimize): Remove trailing '.' from diagnostics. * c.opt (Wwrite-strings_: Avoid '`' in help text. cp: * cvt.c (cp_convert_to_pointer): Use %' in diagnostic. * decl.c (layout_var_decl, maybe_commonize_var, grokdeclarator): Use %' in diagnostics. * decl2.c (check_classfn): Use %' in diagnostic. * init.c (build_java_class_ref): Use %' in diagnostic. (build_delete): Remove trailing '.' from diagnostic. * method.c (do_build_copy_assign, walk_field_subobs): Use %' in diagnostics. * name-lookup.c (pushdecl_maybe_friend): Use %' in diagnostic. * parser.c (cp_parser_exception_specification_opt): Remove trailing '.' from diagnostic. (cp_parser_objc_interstitial_code): Use %qs for quoting in diagnostic. * pt.c (check_valid_ptrmem_cst_expr): Use %< and %> for quoting in diagnostic. * repo.c (reopen_repo_file_for_write): Use %' in diagnostic. fortran: * trans-array.c (gfc_trans_deferred_array): Use "front-end" spelling in diagnostic. * trans.c (gfc_allocate_array_with_status): Add missing space in diagnostic. java: * expr.c (expand_java_field_op): Use %' in diagnostic. * jcf-parse.c (java_parse_file): Use %' in diagnostics. * jvspec.c (lang_specific_driver): Use %' in diagnostic. * lang.c (java_post_options): Use %' in diagnostics. lto: * lto.c (lto_resolution_read): Start diagnostics with lowercase letters and remove trailing '.'. (lto_file_finalize): Start diagnostic with a lowercase letter. objc: * objc-act.c (objc_init): Use %' in diagnostic. (objc_set_method_opt): Remove trailing '.' from diagnostic. From-SVN: r166570
2010-11-11 00:23:15 +01:00
error ("non-static const member %q#D, can%'t use default "
"assignment operator", field);
continue;
}
else if (TREE_CODE (expr_type) == REFERENCE_TYPE)
{
cfgloop.c (verify_loop_structure): Use %' in diagnostics. * cfgloop.c (verify_loop_structure): Use %' in diagnostics. Start diagnostics with lowercase letters. * cgraphunit.c (verify_cgraph_node): Start diagnostics with lowercase letters. * collect2.c (maybe_run_lto_and_relink): Remove trailing '.' from diagnostic. * config/alpha/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/arm/arm.c (arm_get_pcs_model): Start diagnostics with lowercase letters. * config/arm/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. Remove trailing ' ' from diagnostic. * config/avr/avr.c (print_operand_address): Start diagnostic with a lowercase letter and remove trailing '.'. * config/avr/avr.opt (mpmem-wrap-around): Fix typo in help text. * config/bfin/bfin.c (bfin_option_override): Start diagnostics with lowercase letters. Use %' in diagnostics. Remove trailing '.' from diagnostics. (bfin_handle_longcall_attribute): Use %' in diagnostic. * config/cris/cris.c (cris_split_movdx, cris_expand_pic_call_address): Start diagnostics with lowercase letters. (cris_asm_output_label_ref): Use %' in diagnostic. * config/cris/cris.h (ASM_SPEC): Start diagnostic with a lowercase letter. * config/crx/crx.h (FUNCTION_PROFILER): Start diagnostic with a lowercase letter. * config/darwin-c.c (version_as_macro): Start diagnostic with a lowercase letter. * config/darwin-driver.c (darwin_default_min_version): Use %' in diagnostic. * config/host-darwin.c (darwin_gt_pch_use_address): Use %' in diagnostic. * config/i386/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/i386/host-cygwin.c (cygwin_gt_pch_get_address): Use %' in diagnostics. * config/i386/i386.c (ix86_option_override_internal): Write diagnostic as a single sentence without trailing '.'. Use %' in diagnostics. (ix86_function_sseregparm, classify_argument): Start diagnostics with lowercase letters. (ix86_expand_prologue): Use %' in diagnostic. * config/i386/i386.h (CC1_CPU_SPEC_1): Remove trailing '.' from diagnostic. * config/i386/nwld.h (LINK_SPEC): Start diagnostic with a lowercase letter. * config/i386/winnt.c (i386_pe_determine_dllimport_p): Use %' in diagnostic. * config/ia64/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/ia64/ia64.opt (msched-max-memory-insns-hard-limit): Avoid '`' in help text. * config/lm32/lm32.c (lm32_print_operand): Start diagnostic with a lowercase letter. * config/mep/mep.c (mep_validate_vliw): Start diagnostics with lowercase letters. * config/microblaze/microblaze.c (microblaze_handle_option): Remove trailing '.' from diagnostic. (print_operand): Start diagnostic with a lowercase letter. * config/pa/pa-hpux10.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa-hpux11.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa64-hpux.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/picochip/picochip.c (picochip_option_override, picochip_emit_save_register, picochip_function_arg, picochip_output_label, picochip_output_internal_label, picochip_asm_output_opcode, picochip_output_cbranch, picochip_output_compare, picochip_output_branch, picochip_get_vliw_alu_id): Remove trailing '.' and '\n' from diagnostics. Start diagnostics with lowercase letters. Use %' in diagnostics. * config/rs6000/rs6000.c (rs6000_option_override_internal): Use "SPE" capitalization. Start diagnostic with a lowercase letter. (rs6000_handle_option): Start diagnostics with lowercase letters. (def_builtin): Remove trailing '.' from diagnostic. (rs6000_savres_routine_name): Start diagnostic with a lowercase letter. * config/rs6000/sysv4.h (LINK_OS_FREEBSD_SPEC): Avoid '`' in diagnostic. * config/rx/rx.c (rx_handle_option): Start diagnostic with a lowercase letter. * config/s390/s390.c (s390_option_override) Start diagnostics with lowercase letters. Use %' in diagnostic. * config/sh/sh.c (sh_output_mi_thunk): Start diagnostics with lowercase letters. * config/sh/symbian-base.c (sh_symbian_mark_dllimport): Use %' in diagnostic. * config/sh/symbian-c.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sh/symbian-cxx.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sparc/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/spu/spu.c (spu_option_override): Start diagnostics with lowercase letters. Use %qs for quoting in diagnostics. (spu_check_builtin_parm): Remove trailing '.' from diagnostics. Use %wd instead of HOST_WIDE_INT_PRINT_DEC in diagnostic . * config/v850/v850.c (construct_save_jarl): Remove trailing '\n' from diagnostic. * convert.c (convert_to_integer, convert_to_vector): Use %' in diagnostics. * dbgcnt.c (dbg_cnt_process_opt): Start diagnostic with lowercase letter and use "cannot" spelling. * expmed.c (extract_fixed_bit_field): Start diagnostic with lowercase letter and format as a single sentence without '.'. * ggc-common.c (write_pch_globals, gt_pch_save, gt_pch_restore): Use %' in diagnostics. * ggc-page.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * ggc-zone.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * graph.c (clean_graph_dump_file): Use %' in diagnostic. * graphite-poly.c (graphite_read_scop_file): Start diagnostics with lowercase letters and remove tailing '.' and '\n'. * lto-cgraph.c (input_profile_summary): Start diagnostic with lowercase letter and remove trailing '.'. (input_cgraph): Start diagnostics with lowercase letters and remove trailing '\n'. * opts.c (finish_options, common_handle_option): Start diagnostics with lowercase letters and remove trailing '.'. Fix typo in diagnostic. * passes.c (position_pass): Start diagnostic with lowercase letter. * plugin.c (add_new_plugin, parse_plugin_arg_opt, register_callback, try_init_one_plugin): Start diagnostics with lowercase letters. * reload1.c (spill_failure): Use %' in diagnostic. (gen_reload): Start diagnostic with a lowercase letter. * stor-layout.c (place_field): Start diagnostic with a lowercase letter. * toplev.c (open_auxiliary_file): Use %' in diagnostic. * tree-cfg.c (verify_expr, verify_types_in_gimple_reference, verify_gimple_call, verify_gimple_phi, verify_eh_throw_stmt_node): Start diagnostics with lowercase letters, remove trailing '.' and use %' in diagnostics. * tree-ssa.c (verify_def): Remove trailing '.' from diagnostic. (verify_ssa): Don't split diagnostic across two error calls. Spell out "number" and use %' in diagnostic. * value-prof.c (visit_hist, check_counter): Start diagnostics with lowercase letters. c-family: * c-common.c (handle_mode_attribute): Use %' and word "signedness" in diagnostic. * c-opts.c (c_common_parse_file): Start diagnostics with lowercase letter. * c-pragma.c (handle_pragma_target, handle_pragma_optimize): Remove trailing '.' from diagnostics. * c.opt (Wwrite-strings_: Avoid '`' in help text. cp: * cvt.c (cp_convert_to_pointer): Use %' in diagnostic. * decl.c (layout_var_decl, maybe_commonize_var, grokdeclarator): Use %' in diagnostics. * decl2.c (check_classfn): Use %' in diagnostic. * init.c (build_java_class_ref): Use %' in diagnostic. (build_delete): Remove trailing '.' from diagnostic. * method.c (do_build_copy_assign, walk_field_subobs): Use %' in diagnostics. * name-lookup.c (pushdecl_maybe_friend): Use %' in diagnostic. * parser.c (cp_parser_exception_specification_opt): Remove trailing '.' from diagnostic. (cp_parser_objc_interstitial_code): Use %qs for quoting in diagnostic. * pt.c (check_valid_ptrmem_cst_expr): Use %< and %> for quoting in diagnostic. * repo.c (reopen_repo_file_for_write): Use %' in diagnostic. fortran: * trans-array.c (gfc_trans_deferred_array): Use "front-end" spelling in diagnostic. * trans.c (gfc_allocate_array_with_status): Add missing space in diagnostic. java: * expr.c (expand_java_field_op): Use %' in diagnostic. * jcf-parse.c (java_parse_file): Use %' in diagnostics. * jvspec.c (lang_specific_driver): Use %' in diagnostic. * lang.c (java_post_options): Use %' in diagnostics. lto: * lto.c (lto_resolution_read): Start diagnostics with lowercase letters and remove trailing '.'. (lto_file_finalize): Start diagnostic with a lowercase letter. objc: * objc-act.c (objc_init): Use %' in diagnostic. (objc_set_method_opt): Remove trailing '.' from diagnostic. From-SVN: r166570
2010-11-11 00:23:15 +01:00
error ("non-static reference member %q#D, can%'t use "
"default assignment operator", field);
continue;
}
if (DECL_NAME (field))
{
if (VFIELD_NAME_P (DECL_NAME (field)))
continue;
}
else if (ANON_AGGR_TYPE_P (expr_type)
&& TYPE_FIELDS (expr_type) != NULL_TREE)
/* Just use the field; anonymous types can't have
nontrivial copy ctors or assignment ops or this
function would be deleted. */;
else
continue;
comp = build3 (COMPONENT_REF, expr_type, comp, field, NULL_TREE);
/* Compute the type of init->field */
quals = cvquals;
if (DECL_MUTABLE_P (field))
quals &= ~TYPE_QUAL_CONST;
expr_type = cp_build_qualified_type (expr_type, quals);
init = build3 (COMPONENT_REF, expr_type, init, field, NULL_TREE);
if (move_p && TREE_CODE (expr_type) != REFERENCE_TYPE
/* 'move' breaks bit-fields, and has no effect for scalars. */
&& !scalarish_type_p (expr_type))
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
init = move (init);
if (DECL_NAME (field))
re PR c/70756 (Wrong column number shown for "error: invalid use of flexible array member") PR c/70756 * c-common.c (pointer_int_sum): Call size_in_bytes_loc instead of size_in_bytes and pass LOC to it. * c-decl.c (build_compound_literal): Pass LOC down to c_incomplete_type_error. * c-tree.h (require_complete_type): Adjust declaration. (c_incomplete_type_error): Likewise. * c-typeck.c (require_complete_type): Add location parameter, pass it down to c_incomplete_type_error. (c_incomplete_type_error): Add location parameter, pass it down to error_at. (build_component_ref): Pass location down to c_incomplete_type_error. (default_conversion): Pass location down to require_complete_type. (build_array_ref): Likewise. (build_function_call_vec): Likewise. (convert_arguments): Likewise. (build_unary_op): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (c_finish_omp_clauses): Likewise. * call.c (build_new_op_1): Pass LOC to cp_build_modify_expr. * cp-tree.h (cp_build_modify_expr): Update declaration. (cxx_incomplete_type_error, cxx_incomplete_type_diagnostic): New inline overloads. * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Pass INPUT_LOCATION to cp_build_modify_expr. * decl2.c (set_guard): Likewise. (handle_tls_init): Likewise. * init.c (perform_member_init): Likewise. (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (get_temp_regvar): Likewise. (build_vec_init): Likewise. * method.c (do_build_copy_assign): Likewise. (assignable_expr): Likewise. * semantics.c (finish_omp_for): Likewise. * typeck.c (cp_build_binary_op): Pass LOCATION to pointer_diff and cp_pointer_int_sum. (cp_pointer_int_sum): Add location parameter. Pass it down to pointer_int_sum. (pointer_diff): Add location parameter. Use it. (build_modify_expr): Pass location down to cp_build_modify_expr. (cp_build_modify_expr): Add location parameter. Use it. (build_x_modify_expr): Pass location down to cp_build_modify_expr. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Add location parameter. * langhooks-def.h (lhd_incomplete_type_error): Adjust declaration. * langhooks.c (lhd_incomplete_type_error): Add location parameter. * langhooks.h (incomplete_type_error): Likewise. * tree.c (size_in_bytes_loc): Renamed from size_in_bytes. Add location parameter, pass it down to incomplete_type_error. * tree.h (size_in_bytes): New inline overload. (size_in_bytes_loc): Renamed from size_in_bytes. * c-c++-common/pr70756-2.c: New test. * c-c++-common/pr70756.c: New test. From-SVN: r236180
2016-05-12 17:28:08 +02:00
init = cp_build_modify_expr (input_location, comp, NOP_EXPR, init,
typeck.c (composite_pointer_type_r): Add SFINAE support. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (composite_pointer_type_r): Add SFINAE support. (composite_pointer_type): Ditto. (common_type): Fix call to composite_pointer_type. (cxx_sizeof_nowarn): New; used to be a macro. (cxx_sizeof_expr): Add SFINAE support. (cxx_alignof_expr): Ditto. (decay_conversion): Fix calls for SFINAE support. (rationalize_conditional_expr): Add SFINAE support. (build_class_member_access_expr): Ditto. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (build_indirect_ref): Original version renamed to cp_build_indirect_ref; new version provides a bridge from c-common. (cp_build_indirect_ref): Was build_indirect_ref; added SFINAE support. (get_member_function_from_ptrfunc): Fix calls for SFINAE support. (build_function_call): Original version renamed to cp_build_function_call; new version provides a bridge from c-common. (cp_build_function_call): Was build_function_call; added SFINAE support. (convert_arguments): Add SFINAE support. (build_x_binary_op): Ditto. (build_binary_op): Original version renamed to cp_build_binary_op; new version provides a bridge from c-common. (cp_build_binary_op): Was build_binary_op; added SFINAE support. (pointer_diff): Fix calls for SFINAE. (build_x_unary_op): Add SFINAE support. (condition_conversion): Fix calls for SFINAE. (build_unary_op): Original version renamed to cp_build_unary_op; new version provides a bridge from c-common. (cp_build_unary_op): Was build_unary_op; added SFINAE support. (unary_complex_lvalue): Fix calls for SFINAE. (build_x_conditional_expr): Add SFINAE support. (build_x_compound_expr_from_list): Fix calls for SFINAE. (build_x_compound_expr): Add SFINAE support. (convert_ptrmem): Fix calls for SFINAE. (build_static_cast_1): Add SFINAE support. (build_static_cast): Ditto. (build_reinterpret_cast_1): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast_1): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_modify_expr): Original version renamed to cp_build_modify_expr; new version provides a bridge from c-common. (cp_build_modify_expr): Was build_modify_expr; added SFINAE support. (build_x_modify_expr): Add SFINAE support. (build_ptrmemfunc): Fix calls for SFINAE. (convert_for_assignment): Add SFINAE support. (convert_for_initialization): Ditto. (check_return_expr): Fix calls for SFINAE. (lvalue_or_else): Add SFINAE support. * init.c (perform_member_init): Fix calls for SFINAE. (emit_mem_initializers): Ditto. (expand_virtual_init): Ditto. (expand_cleanup_for_base): Ditto. (build_aggr_init): Add SFINAE support. (expand_default_init): Ditto. (expand_aggr_init_1): Fix calls for SFINAE. (build_offset_ref): Ditto. (build_new_1): Add SFINAE support. (build_new): Ditto. (build_vec_delete_1): Fix calls for SFINAE. (get_temp_regvar): Ditto. (build_vec_init): Add SFINAE support. (build_dtor_call): Fix calls for SFINAE. (build_delete): Ditto. (push_base_cleanups): Ditto. (build_vec_delete_1): Ditto. * class.c (build_base_path): Fix calls for SFINAE. (build_simple_base_path): Ditto. (convert_to_base_statically): Ditto. (build_vfn_ref): Ditto. (resolve_address_of_overloaded_function): Ditto. * decl.c (check_initializer): Fix calls for SFINAE. (register_dtor_fn): Ditto. (compute_array_index_type): Ditto. (finish_enum): Ditto. (start_preparsed_function): Ditto. (cxx_maybe_build_cleanup): Ditto. * call.c (convert_like): Add COMPLAIN argument. (convert_like_with_context): Ditto. (build_this): Fix calls for SFINAE. (build_user_type_conversion): Ditto. (resolve_args): Ditto. (build_new_function_call): Add SFINAE support. (build_operator_new_call): Fix calls for SFINAE. (build_object_call): Add SFINAE support. (build_conditional_expr): Ditto. (build_new_op): Ditto. (build_op_delete_call): Fix calls for SFINAE. (build_temp): Ditto. (convert_like_real): Add SFINAE support. (build_x_va_arg): Fix calls for SFINAE. (convert_default_arg): Ditto. (build_over_call): Add SFINAE support. (build_java_interface_fn_ref): Fix calls for SFINAE. (build_special_member_call): Add SFINAE support. (build_new_method_call): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (initialize_reference): Fix calls for SFINAE. * method.c (do_build_assign_ref): Fix calls for SFINAE. * rtti.c (build_headof): Fix calls for SFINAE. (get_tinfo_decl_dynamic): Ditto. (get_typeid): Ditto. (build_dynamic_cast_1): Add SFINAE support. (build_dynamic_cast): Ditto. (tinfo_base_init): Fix calls for SFINAE. * except.c (do_get_exception_ptr): Fix calls for SFINAE. (do_end_catch): Ditto. (initialize_handler_parm): Ditto. (expand_start_catch_block): Ditto. (do_allocate_exception): Ditto. (do_free_exception): Ditto. (build_throw): Ditto. * cvt.c (build_up_reference): Fix calls for SFINAE. (convert_to_reference): Ditto. (ocp_convert): Ditto. (convert_to_void): Add SFINAE support. * tree.c (build_dummy_object): Fix calls for SFINAE. (stabilize_expr): Ditto. * cp-tree.h (build_conditional_expr): Add tsubst_flags_t parameter. (build_new_method_call): Ditto. (build_special_member_call): Ditto. (build_new_op): Ditto. (perform_implicit_conversion): Ditto. (perform_direct_initialization_if_possible): Ditto. (convert_to_void): Ditto. (build_aggr_init): Ditto. (build_new): Ditto. (build_vec_init): Ditto. (build_dynamic_cast): Ditto. (finish_call_expr): Ditto (cxx_sizeof_or_alignof_expr): Add COMPLAIN parameter. (cxx_sizeof_nowarn): Remove macro; add function declaration. (build_class_member_access_expr): Add tsubst_flags_t parameter. (finish_class_member_access_expr): Ditto. (build_x_indirect_ref): Ditto. (cp_build_indirect_ref): New. (cp_build_function_call): Add tsubst_flags_t parameter. (build_x_unary_op): Ditto. (cp_build_unary_op): New. (build_x_conditional_expr): Add tsubst_flags_t parameter. (build_x_compound_expr): Ditto. (build_compound_expr): Ditto. (build_static_cast): Ditto. (build_reinterpret_cast): Ditto. (build_const_cast): Ditto. (build_c_cast): Ditto. (build_x_modify_expr): Ditto. (cp_build_modify_expr): New. (convert_for_initialization): Add tsubst_flags_t parameter. (cp_build_binary_op): Remove macro; add function declaration. (invalid_nonstatic_memfn_p): Add tsubst_flags_t parameter. (lvalue_or_else): Ditto. (build_functional_cast): Ditto. * typeck2.c (digest_init): Fix calls for SFINAE. (process_init_constructor_array): Ditto. (process_init_constructor_record): Ditto. (build_x_arrow): Ditto. (build_m_component_ref): Ditto. (build_functional_cast): Add SFINAE support. * pt.c (tsubst_copy_and_build): Add (more) SFINAE support. * semantics.c (simplify_loop_decl_cond): Fix calls for SFINAE. (finish_expr_stmt): Ditto. (finish_for_expr): Ditto. (finish_asm_stmt): Ditto. (finish_non_static_data_member): Ditto. (finish_qualified_id_expr): Ditto. (finish_call_expr): Add SFINAE support. (finish_increment_expr): Fix calls for SFINAE. (finish_unary_op_expr): Ditto. (simplify_aggr_init_expr): Ditto. (finish_omp_clauses): Ditto. (finish_omp_for): Ditto. (finish_omp_barrier): Ditto. (finish_omo_flush): Ditto. * decl2.c (grok_array_decl): Fix calls or SFINAE. (build_anon_union_vars): Ditto. (get_guard_cond): Ditto. (set_guard): Ditto. (one_static_initialization_or_destruction): Ditto. (do_static_initialization_or_destruction): Ditto. (generate_ctor_or_dtor_function): Ditto. (build_offset_ref_call_from_tree): Ditto. * parser.c (cp_parser_postfix_expression): Fix calls for SFINAE. (cp_parser_postfix_dot_deref_expression): Ditto. (cp_parser_unary_expression): Ditto. (cp_parser_new_expression): Ditto. (cp_parser_cast_expression): Ditto. (cp_parser_binary_expression): Ditto. (cp_parser_question_colon_clause): Ditto. (cp_parser_assignment_expression): Ditto. (cp_parser_expression): Ditto. (cp_parser_builtin_offsetof): Ditto. (cp_parser_template_argument): Ditto. (cp_parser_functional_cast): Ditto. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * c-common.c (c_sizeof_or_alignof_type): If we're not allowed to complain when we hit an error, return ERROR_MARK_NODE. 2008-03-25 Douglas Gregor <doug.gregor@gmail.com> * g++.dg/template/sfinae4.C: New. * g++.dg/template/sfinae5.C: New. * g++.dg/template/sfinae6.C: New. * g++.dg/template/sfinae6_neg.C: New. * g++.dg/template/sfinae7.C: New. * g++.dg/template/sfinae8.C: New. * g++.dg/template/sfinae9.C: New. * g++.dg/template/sfinae10.C: New. * g++.dg/template/sfinae11.C: New. * g++.dg/template/sfinae12.C: New. * g++.dg/template/sfinae13.C: New. * g++.dg/template/sfinae14C: New. From-SVN: r133519
2008-03-25 14:53:58 +01:00
tf_warning_or_error);
else
init = build2 (MODIFY_EXPR, TREE_TYPE (comp), comp, init);
finish_expr_stmt (init);
}
}
finish_return_stmt (current_class_ref);
finish_compound_stmt (compound_stmt);
}
/* Synthesize FNDECL, a non-static member function. */
void
synthesize_method (tree fndecl)
{
bool nested = (current_function_decl != NULL_TREE);
Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function. Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function. * cp-tree.h (DECL_CLASS_CONTEXT): Adjust. (DECL_FRIEND_CONTEXT): New macro. (DECL_REAL_CONTEXT): Remove. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Adjust. (DECL_CLASS_SCOPE_P): Use TYPE_P. (add_friends): Remove. (hack_decl_function_context): Likewise. * call.c (build_new_function_call): Replace DECL_REAL_CONTEXT with CP_DECL_CONTEXT. (build_over_call): Fix indentation. Use DECL_CONTEXT instead of DECL_CLASS_CONTEXT. * class.c (dfs_build_vcall_offset_vtbl_entries): Likewise. (add_method): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. (strictly_overrides): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (build_vtbl_or_vbase_field): Don't set DECL_CLASS_CONTEXT. (build_base_field): Likewise. (finish_struct_1): Likewise. (build_self_reference): Likewise. * decl.c (push_class_binding): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (pushtag): Use decl_function_context, not hack_decl_function_context. (decls_match): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (duplicate_decls): Use DECL_VIRTUAL_CONTEXT. (pushdecl): Remove bogus code. (start_decl): Use DECL_CONTEXT rather than DECL_CLASS_CONTEXT. (cp_finish_decl): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (grokfndecl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. Use decl_function_context, nothack_decl_function_context. (grokvardecl): Don't set DECL_CLASS_CONTEXT. (grokdeclarator): Likewise. Use decl_function_context, not hack_decl_function_context. (copy_args_p): Document. Don't use DECL_CLASS_CONTEXT. (start_function): Use DECL_FRIEND_CONTEXT, not DECL_CLASS_CONTEXT. Use decl_function_context, not hack_decl_function_context. (finish_function): Use decl_function_context, not hack_decl_function_context. (maybe_retrofit_in_chrg): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (grokclassfn): Set DECL_VIRTUAL_CONTEXT, not DECL_CONTEXT. (finish_static_data_member_decl): Don't set DECL_CLASS_CONTEXT. (grokfield): Likewise. (finish_builtin_type): Likewise. (finish_vtable_vardec): Use decl_function_context, not hack_decl_function_context. (import_export_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (start_static_initialization_or_destruction): Likewise. (finish_static_initialization_or_destruction): Likewise. (mark_used): Adjust logic for deciding when to synthesize methods. * dump.c (dequeue_and_dump): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. * error.c (dump_function_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * friend.c (is_friend): Likewise. (add_friends): Remove. (do_friend): Use SET_DECL_FRIEND_CONTEXT. * lex.c (begin_definition_of_inclass_inline): Use decl_function_context, not hack_decl_function_context. (process_next_inline): Likewise. (do_identifier): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. * method.c (set_mangled_name_for_decl): Use DECL_CONTEXT, not DECL_CLASSS_CONTEXT. (hack_identifier): Likewise. (synthesize_method): Use decl_function_context, not hack_decl_function_context. * pt.c (template_class_depth_real): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (is_member_template): Use decl_function_context, not hack_decl_function_context. Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (build_template_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. (check_default_tmpl_args): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (push_template_decl_real): Likewise. (instantiate_class_template): Don't call add_friends. (tsubst_default_argument): Use DECL_CONTEXT, not DECL_REAL_CONTEXT. (tsubst_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT. Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (set_meangled_name_for_template_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * repo.c (repo_inline_used): Likewise. * search.c (current_scope): Adjust for new _CONTEXT macros. (context_for_name_lookup): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT. (friend_accessible_p): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. (lookup_fnfields_here):Likewise. (check_final_overrider): Likewise. (init_vbase_pointers): Likewise. (virtual_context): Likewise. * semantics.c (finish_member_declaration): Just set DECL_CONTEXT. (expand_body): Use decl_function_context, not hack_decl_function_context. * tree.c (hack_decl_function_context): Remove. * typeck.c (build_x_function_call): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT. * typeck2.c (error_not_base_type): Likewise. From-SVN: r32018
2000-02-17 00:54:23 +01:00
tree context = decl_function_context (fndecl);
bool need_body = true;
tree stmt;
location_t save_input_location = input_location;
int error_count = errorcount;
int warning_count = warningcount + werrorcount;
/* Reset the source location, we might have been previously
deferred, and thus have saved where we were first needed. */
DECL_SOURCE_LOCATION (fndecl)
= DECL_SOURCE_LOCATION (TYPE_NAME (DECL_CONTEXT (fndecl)));
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* If we've been asked to synthesize a clone, just synthesize the
cloned function instead. Doing so will automatically fill in the
body for the clone. */
if (DECL_CLONED_FUNCTION_P (fndecl))
fndecl = DECL_CLONED_FUNCTION (fndecl);
cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_DTOR_IDENTIFIER. (complete_dtor_identifier): New macro. (CLASSTYPE_FIRST_CONVERSION): Remove. (CLASSTYPE_CONSTRUCTOR_SLOT): New macro. (CLASSTYPE_DESTRUCTOR_SLOT): Likewise. (CLASSTYPE_FIRST_CONVERSION_SLOT): Likewise. (CLASSTYPE_CONSTRUCTORS): Likewise. (CLASSTYPE_DESTRUCTORS): Likewise. (lang_decl): Add cloned_function. (DECL_COMPLETE_CONSTRUCTOR_P): New macro. (DECL_BASE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise. (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise. (DECL_CLONED_FUNCTION_P): Likewise. (DECL_CLONED_FUNCTION): Likewise. (clone_function_decl): Declare. (maybe_clone_body): Likewise. * call.c (build_user_type_conversion_1): Call complete object constructors in the new ABI. (build_new_method_call): Don't add in-charge parameters under the new ABI. * class.c (add_method): Use DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P, CLASSTYPE_CONSTRUCTOR_SLOT, and CLASSTYPE_DESTRUCTOR_SLOT. (build_clone): New function. (clone_function_decl): Likewise. (clone_constructors_and_destructors): Likewise. (check_bases_and_members): Use it. * decl.c (iniitialize_predefined_identifiers): Initialize complete_dtor_identifier. (finish_function): Don't add extra code to a clone. (lang_mark_tree): Mark cloned_function. * decl2.c (mark_used): Don't bother trying to instantiate things we synthesized. * dump.c (dequeue_and_dump): Don't dump CP_DECL_CONTEXT twice. * method.c (set_mangled_name_for_decl): Don't treat clones as constructors. (synthesize_method): Sythesize cloned functions, not the clones. * optimize.c (inline_data): Update comment on ret_label. (remap_block): Don't assume DECL_INITIAL exists. (copy_body_r): Allow ret_label to be NULL. (maybe_clone_body): Define. * pt.c (tsubst_decl): Handle clones. (instantiate_clone): New function. (instantiate_template): Use it. (set_mangled_name_for_template_decl): Don't treat clones as constructors. * search.c (lookup_fnfields_1): Use CLASSTYPE_CONSTRUCTOR_SLOT, CLASSTYPE_DESTRUCTOR_SLOT, and CLASSTYPE_FIRST_CONVERSION_SLOT. * semantics.c (expand_body): Clone function bodies as necessary. From-SVN: r33084
2000-04-11 22:16:36 +02:00
/* We may be in the middle of deferred access check. Disable
it now. */
push_deferring_access_checks (dk_no_deferred);
if (! context)
push_to_top_level ();
else if (nested)
push_function_context ();
input_location = DECL_SOURCE_LOCATION (fndecl);
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
start_preparsed_function (fndecl, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED);
stmt = begin_function_body ();
cp-tree.h (ansi_opname): Make it a macro. 2000-05-27 Alex Samuel <samuel@codesourcery.com> Mark Mitchell <mark@codesourcery.com> * cp-tree.h (ansi_opname): Make it a macro. (ansi_assopname): Likewise. (struct lang_decl_flags): Add assignment_operator_p. (struct lang_decl): Add operator_code. (DECL_VTT_PARM): Adjust. (DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an overloaded operator. (SET_OVERLOADED_OPERATOR_CODE): New macro. (DECL_ASSIGNMENT_OPERATOR_P): New macro. (DECL_ARRAY_DELETE_OPERATOR_P): Adjust. (opname_tab): Remove. (assignop_tab): Likewise. (operator_name_info_t): New type. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (build_cp_library_fn): Remove declaration. (push_cp_library_fn): Likewise. (operator_name_string): Likewise. (build_decl_overload): Likewise. * call.c (print_z_candidates): Simplify. (build_object_call): Adjust usage of ansi_opname. Use DECL_OVERLOADED_OPERATOR_P. (op_error): Adjust operator name lookup. (build_conditional_expr): Adjust usage of ansi_opname. (build_new_op): Likewise. (build_op_delete_call): Likewise. (build_over_call): Likewise. (joust): Use DECL_OVERLOADED_OPERATOR_P. * decl.c (duplicate_decls): Copy operator_code. (init_decl_processing): Adjust parameters to push_cp_library_fn. (builtin_function): Adjust parameters to build_library_fn_1. (build_library_fn_1): Accept an overloaded operator code. (build_library_fn): Pass ERROR_MARK. (build_cp_library_fn): Accept an overloaded operator code. (push_cp_library_fn): Likewise. (grokfndecl): Tweak. (grokdeclarator): Simplify code to compute names of overloaded operators. Adjust use of ansi_opname. (ambi_op_p): Work on tree_codes, not identifiers. (unary_op_p): Likewise. (grok_op_properties): Likewise. (start_function): Use DECL_OVERLOADED_OPERATOR_P. (lang_mark_tree): Don't try to mark the operator_code. * decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P. * error.c (dump_decl): Remove special handling for operator names. (dump_function_name): Likewise. (dump_expr): Adjust name lookup of operators. (op_to_string): Simplify. (assop_to_string): Likewise. * init.c (build_new_1): Adjust use of ansi_opname. * lex.c (opname_tab): Remove. (assignop_tab): Likewise. (ansi_opname): Likewise. (ansi_assopname): Likewise. (operator_name_string): Likewise. (reinit_lang_specific): Likewise. (operator_name_info): New variable. (assignment_operator_name_info): Likewise. (init_operators): New function. (init_parse): Use it. (do_identifier): Adjust use of ansi_opname. * method.c (mangle_expression): Don't use ansi_opname for mangling. (build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P. (build_decl_overload): Remove. (build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly. (do_build_assign_ref): Adjust use of ansi_opname. (synthesize_method): Likewise. (implicitly_declare_fn): Likewise. * operators.def: New file. * parse.y (operator): Adjust use of ansi_opname. * pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P. (set_mangled_name_for_template_decl): Don't play games with current_namespace. (special_function_p): Adjust use of ansi_opname. * typeck.c (check_return_expr): Likewise. * Make-lang.in (cc1plus): Depend on operators.def. * Makefile.in (lex.o): Likewise. (decl.o): Likewise. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r34223
2000-05-28 04:58:19 +02:00
if (DECL_OVERLOADED_OPERATOR_P (fndecl) == NOP_EXPR)
{
do_build_copy_assign (fndecl);
need_body = false;
}
else if (DECL_CONSTRUCTOR_P (fndecl))
{
Do put the VTT parameter in DECL_ARGUMENTS. * cp-tree.h (struct cp_language_function): Add x_vtt_parm. (current_vtt_parm): New macro. (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm. (DECL_HAS_VTT_PARM_P): New macro. (DECL_VTT_PARM): Remove. (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros. * decl.c (duplicate_decls): Only copy the operator code if appropriate. (start_function): Set current_vtt_parm. (lang_mark_tree): Don't mark vtt_parm. * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P. * class.c (build_clone): Maybe remove the VTT parm. * optimize.c (maybe_clone_body): Set up the VTT parm. * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm. * call.c (build_over_call): Just allow the VTT arg. * method.c (make_thunk): Don't set DECL_VTT_PARM. (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM. (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE. * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise. * error.c (dump_function_decl): Likewise. * call.c (build_user_type_conversion_1, convert_like_real): Abort if we try to call a constructor with in-charge or VTT parms. * method.c (skip_artificial_parms_for): New fn. * call.c (add_function_candidate, build_over_call): Call it. * call.c (build_new_method_call): Use current_vtt_parm. * init.c (expand_virtual_init): Likewise. * class.c (same_signature_p): No longer static. * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. From-SVN: r39841
2001-02-18 20:08:00 +01:00
tree arg_chain = FUNCTION_FIRST_USER_PARMTYPE (fndecl);
if (arg_chain != void_list_node)
do_build_copy_constructor (fndecl);
else
finish_mem_initializers (NULL_TREE);
}
/* If we haven't yet generated the body of the function, just
generate an empty compound statement. */
if (need_body)
{
tree compound_stmt;
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
compound_stmt = begin_compound_stmt (BCS_FN_BODY);
finish_compound_stmt (compound_stmt);
}
finish_function_body (stmt);
expand_or_defer_fn (finish_function (0));
input_location = save_input_location;
if (! context)
pop_from_top_level ();
else if (nested)
pop_function_context ();
pop_deferring_access_checks ();
if (error_count != errorcount || warning_count != warningcount + werrorcount)
inform (input_location, "synthesized method %qD first required here ",
fndecl);
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Build a reference to type TYPE with cv-quals QUALS, which is an
rvalue if RVALUE is true. */
static tree
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
build_stub_type (tree type, int quals, bool rvalue)
{
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
tree argtype = cp_build_qualified_type (type, quals);
return cp_build_reference_type (argtype, rvalue);
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Build a dummy glvalue from dereferencing a dummy reference of type
REFTYPE. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
static tree
build_stub_object (tree reftype)
{
if (TREE_CODE (reftype) != REFERENCE_TYPE)
reftype = cp_build_reference_type (reftype, /*rval*/true);
tree stub = build1 (CONVERT_EXPR, reftype, integer_one_node);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
return convert_from_reference (stub);
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Determine which function will be called when looking up NAME in TYPE,
called with a single ARGTYPE argument, or no argument if ARGTYPE is
null. FLAGS and COMPLAIN are as for build_new_method_call.
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
Returns a FUNCTION_DECL if all is well.
Returns NULL_TREE if overload resolution failed.
Returns error_mark_node if the chosen function cannot be called. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
static tree
locate_fn_flags (tree type, tree name, tree argtype, int flags,
tsubst_flags_t complain)
{
tree ob, fn, fns, binfo, rval;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *args;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (TYPE_P (type))
binfo = TYPE_BINFO (type);
else
{
binfo = type;
type = BINFO_TYPE (binfo);
}
ob = build_stub_object (cp_build_reference_type (type, false));
args = make_tree_vector ();
if (argtype)
{
if (TREE_CODE (argtype) == TREE_LIST)
{
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
for (tree elt = argtype; elt && elt != void_list_node;
elt = TREE_CHAIN (elt))
{
tree type = TREE_VALUE (elt);
tree arg = build_stub_object (type);
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_push (args, arg);
}
}
else
{
tree arg = build_stub_object (argtype);
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
args->quick_push (arg);
}
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
fns = lookup_fnfields (binfo, name, 0);
rval = build_new_method_call (ob, fns, &args, binfo, flags, &fn, complain);
release_tree_vector (args);
if (fn && rval == error_mark_node)
return rval;
else
return fn;
}
/* Locate the dtor of TYPE. */
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
tree
get_dtor (tree type, tsubst_flags_t complain)
{
tree fn = locate_fn_flags (type, complete_dtor_identifier, NULL_TREE,
LOOKUP_NORMAL, complain);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (fn == error_mark_node)
return NULL_TREE;
return fn;
}
/* Locate the default ctor of TYPE. */
re PR c++/26099 (support for type traits is not available) gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-30 21:45:57 +02:00
tree
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
locate_ctor (tree type)
{
tree fn;
push_deferring_access_checks (dk_no_check);
fn = locate_fn_flags (type, complete_ctor_identifier, NULL_TREE,
LOOKUP_SPECULATIVE, tf_none);
pop_deferring_access_checks ();
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (fn == error_mark_node)
return NULL_TREE;
return fn;
}
/* Likewise, but give any appropriate errors. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
tree
get_default_ctor (tree type)
{
tree fn = locate_fn_flags (type, complete_ctor_identifier, NULL_TREE,
LOOKUP_NORMAL, tf_warning_or_error);
if (fn == error_mark_node)
return NULL_TREE;
return fn;
}
/* Locate the copy ctor of TYPE. */
tree
get_copy_ctor (tree type, tsubst_flags_t complain)
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
{
int quals = (TYPE_HAS_CONST_COPY_CTOR (type)
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED);
tree argtype = build_stub_type (type, quals, false);
tree fn = locate_fn_flags (type, complete_ctor_identifier, argtype,
LOOKUP_NORMAL, complain);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (fn == error_mark_node)
return NULL_TREE;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
return fn;
}
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Locate the copy assignment operator of TYPE. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
tree
get_copy_assign (tree type)
{
int quals = (TYPE_HAS_CONST_COPY_ASSIGN (type)
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED);
tree argtype = build_stub_type (type, quals, false);
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
tree fn = locate_fn_flags (type, cp_assignment_operator_id (NOP_EXPR), argtype,
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
LOOKUP_NORMAL, tf_warning_or_error);
if (fn == error_mark_node)
return NULL_TREE;
return fn;
}
/* walk_tree helper function for is_trivially_xible. If *TP is a call,
return it if it calls something other than a trivial special member
function. */
static tree
check_nontriv (tree *tp, int *, void *)
{
tree fn = cp_get_callee (*tp);
if (fn == NULL_TREE)
return NULL_TREE;
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
if (TREE_CODE (fn) != FUNCTION_DECL
|| !trivial_fn_p (fn))
return fn;
return NULL_TREE;
}
/* Return declval<T>() = declval<U>() treated as an unevaluated operand. */
static tree
assignable_expr (tree to, tree from)
{
++cp_unevaluated_operand;
to = build_stub_object (to);
from = build_stub_object (from);
re PR c/70756 (Wrong column number shown for "error: invalid use of flexible array member") PR c/70756 * c-common.c (pointer_int_sum): Call size_in_bytes_loc instead of size_in_bytes and pass LOC to it. * c-decl.c (build_compound_literal): Pass LOC down to c_incomplete_type_error. * c-tree.h (require_complete_type): Adjust declaration. (c_incomplete_type_error): Likewise. * c-typeck.c (require_complete_type): Add location parameter, pass it down to c_incomplete_type_error. (c_incomplete_type_error): Add location parameter, pass it down to error_at. (build_component_ref): Pass location down to c_incomplete_type_error. (default_conversion): Pass location down to require_complete_type. (build_array_ref): Likewise. (build_function_call_vec): Likewise. (convert_arguments): Likewise. (build_unary_op): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (c_finish_omp_clauses): Likewise. * call.c (build_new_op_1): Pass LOC to cp_build_modify_expr. * cp-tree.h (cp_build_modify_expr): Update declaration. (cxx_incomplete_type_error, cxx_incomplete_type_diagnostic): New inline overloads. * cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Pass INPUT_LOCATION to cp_build_modify_expr. * decl2.c (set_guard): Likewise. (handle_tls_init): Likewise. * init.c (perform_member_init): Likewise. (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (get_temp_regvar): Likewise. (build_vec_init): Likewise. * method.c (do_build_copy_assign): Likewise. (assignable_expr): Likewise. * semantics.c (finish_omp_for): Likewise. * typeck.c (cp_build_binary_op): Pass LOCATION to pointer_diff and cp_pointer_int_sum. (cp_pointer_int_sum): Add location parameter. Pass it down to pointer_int_sum. (pointer_diff): Add location parameter. Use it. (build_modify_expr): Pass location down to cp_build_modify_expr. (cp_build_modify_expr): Add location parameter. Use it. (build_x_modify_expr): Pass location down to cp_build_modify_expr. * typeck2.c (cxx_incomplete_type_diagnostic, cxx_incomplete_type_error): Add location parameter. * langhooks-def.h (lhd_incomplete_type_error): Adjust declaration. * langhooks.c (lhd_incomplete_type_error): Add location parameter. * langhooks.h (incomplete_type_error): Likewise. * tree.c (size_in_bytes_loc): Renamed from size_in_bytes. Add location parameter, pass it down to incomplete_type_error. * tree.h (size_in_bytes): New inline overload. (size_in_bytes_loc): Renamed from size_in_bytes. * c-c++-common/pr70756-2.c: New test. * c-c++-common/pr70756.c: New test. From-SVN: r236180
2016-05-12 17:28:08 +02:00
tree r = cp_build_modify_expr (input_location, to, NOP_EXPR, from, tf_none);
--cp_unevaluated_operand;
return r;
}
/* The predicate condition for a template specialization
is_constructible<T, Args...> shall be satisfied if and only if the
following variable definition would be well-formed for some invented
variable t: T t(create<Args>()...);
Return something equivalent in well-formedness and triviality. */
static tree
constructible_expr (tree to, tree from)
{
tree expr;
if (CLASS_TYPE_P (to))
{
tree ctype = to;
vec<tree, va_gc> *args = NULL;
if (TREE_CODE (to) != REFERENCE_TYPE)
to = cp_build_reference_type (to, /*rval*/false);
tree ob = build_stub_object (to);
for (; from; from = TREE_CHAIN (from))
vec_safe_push (args, build_stub_object (TREE_VALUE (from)));
expr = build_special_member_call (ob, complete_ctor_identifier, &args,
ctype, LOOKUP_NORMAL, tf_none);
if (expr == error_mark_node)
return error_mark_node;
/* The current state of the standard vis-a-vis LWG 2116 is that
is_*constructible involves destruction as well. */
if (type_build_dtor_call (ctype))
{
tree dtor = build_special_member_call (ob, complete_dtor_identifier,
NULL, ctype, LOOKUP_NORMAL,
tf_none);
if (dtor == error_mark_node)
return error_mark_node;
if (!TYPE_HAS_TRIVIAL_DESTRUCTOR (ctype))
expr = build2 (COMPOUND_EXPR, void_type_node, expr, dtor);
}
}
else
{
if (from == NULL_TREE)
return build_value_init (to, tf_none);
else if (TREE_CHAIN (from))
return error_mark_node; // too many initializers
from = build_stub_object (TREE_VALUE (from));
expr = perform_direct_initialization_if_possible (to, from,
/*cast*/false,
tf_none);
}
return expr;
}
/* Returns true iff TO is trivially assignable (if CODE is MODIFY_EXPR) or
constructible (otherwise) from FROM, which is a single type for
assignment or a list of types for construction. */
bool
is_trivially_xible (enum tree_code code, tree to, tree from)
{
tree expr;
if (code == MODIFY_EXPR)
expr = assignable_expr (to, from);
else if (from && TREE_CHAIN (from))
return false; // only 0- and 1-argument ctors can be trivial
else
expr = constructible_expr (to, from);
if (expr == error_mark_node)
return false;
tree nt = cp_walk_tree_without_duplicates (&expr, check_nontriv, NULL);
return !nt;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Subroutine of synthesized_method_walk. Update SPEC_P, TRIVIAL_P and
DELETED_P or give an error message MSG with argument ARG. */
static void
process_subob_fn (tree fn, tree *spec_p, bool *trivial_p,
bool *deleted_p, bool *constexpr_p,
bool diag, tree arg, bool dtor_from_ctor = false)
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
{
if (!fn || fn == error_mark_node)
{
if (deleted_p)
*deleted_p = true;
return;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (spec_p)
{
maybe_instantiate_noexcept (fn);
tree raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
*spec_p = merge_exception_specifiers (*spec_p, raises);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
}
if (!trivial_fn_p (fn) && !dtor_from_ctor)
{
if (trivial_p)
*trivial_p = false;
if (TREE_CODE (arg) == FIELD_DECL
&& TREE_CODE (DECL_CONTEXT (arg)) == UNION_TYPE)
{
if (deleted_p)
*deleted_p = true;
if (diag)
error ("union member %q+D with non-trivial %qD", arg, fn);
}
}
if (constexpr_p && !DECL_DECLARED_CONSTEXPR_P (fn))
{
*constexpr_p = false;
if (diag)
{
inform (DECL_SOURCE_LOCATION (fn),
"defaulted constructor calls non-constexpr %qD", fn);
explain_invalid_constexpr_fn (fn);
}
}
}
/* Subroutine of synthesized_method_walk to allow recursion into anonymous
aggregates. If DTOR_FROM_CTOR is true, we're walking subobject destructors
called from a synthesized constructor, in which case we don't consider
the triviality of the subobject destructor. */
static void
walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
int quals, bool copy_arg_p, bool move_p,
bool assign_p, tree *spec_p, bool *trivial_p,
bool *deleted_p, bool *constexpr_p,
bool diag, int flags, tsubst_flags_t complain,
bool dtor_from_ctor)
{
tree field;
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
for (field = fields; field; field = DECL_CHAIN (field))
{
tree mem_type, argtype, rval;
if (TREE_CODE (field) != FIELD_DECL
|| DECL_ARTIFICIAL (field))
continue;
mem_type = strip_array_types (TREE_TYPE (field));
if (assign_p)
{
bool bad = true;
if (CP_TYPE_CONST_P (mem_type) && !CLASS_TYPE_P (mem_type))
{
if (diag)
cfgloop.c (verify_loop_structure): Use %' in diagnostics. * cfgloop.c (verify_loop_structure): Use %' in diagnostics. Start diagnostics with lowercase letters. * cgraphunit.c (verify_cgraph_node): Start diagnostics with lowercase letters. * collect2.c (maybe_run_lto_and_relink): Remove trailing '.' from diagnostic. * config/alpha/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/arm/arm.c (arm_get_pcs_model): Start diagnostics with lowercase letters. * config/arm/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. Remove trailing ' ' from diagnostic. * config/avr/avr.c (print_operand_address): Start diagnostic with a lowercase letter and remove trailing '.'. * config/avr/avr.opt (mpmem-wrap-around): Fix typo in help text. * config/bfin/bfin.c (bfin_option_override): Start diagnostics with lowercase letters. Use %' in diagnostics. Remove trailing '.' from diagnostics. (bfin_handle_longcall_attribute): Use %' in diagnostic. * config/cris/cris.c (cris_split_movdx, cris_expand_pic_call_address): Start diagnostics with lowercase letters. (cris_asm_output_label_ref): Use %' in diagnostic. * config/cris/cris.h (ASM_SPEC): Start diagnostic with a lowercase letter. * config/crx/crx.h (FUNCTION_PROFILER): Start diagnostic with a lowercase letter. * config/darwin-c.c (version_as_macro): Start diagnostic with a lowercase letter. * config/darwin-driver.c (darwin_default_min_version): Use %' in diagnostic. * config/host-darwin.c (darwin_gt_pch_use_address): Use %' in diagnostic. * config/i386/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/i386/host-cygwin.c (cygwin_gt_pch_get_address): Use %' in diagnostics. * config/i386/i386.c (ix86_option_override_internal): Write diagnostic as a single sentence without trailing '.'. Use %' in diagnostics. (ix86_function_sseregparm, classify_argument): Start diagnostics with lowercase letters. (ix86_expand_prologue): Use %' in diagnostic. * config/i386/i386.h (CC1_CPU_SPEC_1): Remove trailing '.' from diagnostic. * config/i386/nwld.h (LINK_SPEC): Start diagnostic with a lowercase letter. * config/i386/winnt.c (i386_pe_determine_dllimport_p): Use %' in diagnostic. * config/ia64/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/ia64/ia64.opt (msched-max-memory-insns-hard-limit): Avoid '`' in help text. * config/lm32/lm32.c (lm32_print_operand): Start diagnostic with a lowercase letter. * config/mep/mep.c (mep_validate_vliw): Start diagnostics with lowercase letters. * config/microblaze/microblaze.c (microblaze_handle_option): Remove trailing '.' from diagnostic. (print_operand): Start diagnostic with a lowercase letter. * config/pa/pa-hpux10.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa-hpux11.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa64-hpux.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/picochip/picochip.c (picochip_option_override, picochip_emit_save_register, picochip_function_arg, picochip_output_label, picochip_output_internal_label, picochip_asm_output_opcode, picochip_output_cbranch, picochip_output_compare, picochip_output_branch, picochip_get_vliw_alu_id): Remove trailing '.' and '\n' from diagnostics. Start diagnostics with lowercase letters. Use %' in diagnostics. * config/rs6000/rs6000.c (rs6000_option_override_internal): Use "SPE" capitalization. Start diagnostic with a lowercase letter. (rs6000_handle_option): Start diagnostics with lowercase letters. (def_builtin): Remove trailing '.' from diagnostic. (rs6000_savres_routine_name): Start diagnostic with a lowercase letter. * config/rs6000/sysv4.h (LINK_OS_FREEBSD_SPEC): Avoid '`' in diagnostic. * config/rx/rx.c (rx_handle_option): Start diagnostic with a lowercase letter. * config/s390/s390.c (s390_option_override) Start diagnostics with lowercase letters. Use %' in diagnostic. * config/sh/sh.c (sh_output_mi_thunk): Start diagnostics with lowercase letters. * config/sh/symbian-base.c (sh_symbian_mark_dllimport): Use %' in diagnostic. * config/sh/symbian-c.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sh/symbian-cxx.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sparc/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/spu/spu.c (spu_option_override): Start diagnostics with lowercase letters. Use %qs for quoting in diagnostics. (spu_check_builtin_parm): Remove trailing '.' from diagnostics. Use %wd instead of HOST_WIDE_INT_PRINT_DEC in diagnostic . * config/v850/v850.c (construct_save_jarl): Remove trailing '\n' from diagnostic. * convert.c (convert_to_integer, convert_to_vector): Use %' in diagnostics. * dbgcnt.c (dbg_cnt_process_opt): Start diagnostic with lowercase letter and use "cannot" spelling. * expmed.c (extract_fixed_bit_field): Start diagnostic with lowercase letter and format as a single sentence without '.'. * ggc-common.c (write_pch_globals, gt_pch_save, gt_pch_restore): Use %' in diagnostics. * ggc-page.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * ggc-zone.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * graph.c (clean_graph_dump_file): Use %' in diagnostic. * graphite-poly.c (graphite_read_scop_file): Start diagnostics with lowercase letters and remove tailing '.' and '\n'. * lto-cgraph.c (input_profile_summary): Start diagnostic with lowercase letter and remove trailing '.'. (input_cgraph): Start diagnostics with lowercase letters and remove trailing '\n'. * opts.c (finish_options, common_handle_option): Start diagnostics with lowercase letters and remove trailing '.'. Fix typo in diagnostic. * passes.c (position_pass): Start diagnostic with lowercase letter. * plugin.c (add_new_plugin, parse_plugin_arg_opt, register_callback, try_init_one_plugin): Start diagnostics with lowercase letters. * reload1.c (spill_failure): Use %' in diagnostic. (gen_reload): Start diagnostic with a lowercase letter. * stor-layout.c (place_field): Start diagnostic with a lowercase letter. * toplev.c (open_auxiliary_file): Use %' in diagnostic. * tree-cfg.c (verify_expr, verify_types_in_gimple_reference, verify_gimple_call, verify_gimple_phi, verify_eh_throw_stmt_node): Start diagnostics with lowercase letters, remove trailing '.' and use %' in diagnostics. * tree-ssa.c (verify_def): Remove trailing '.' from diagnostic. (verify_ssa): Don't split diagnostic across two error calls. Spell out "number" and use %' in diagnostic. * value-prof.c (visit_hist, check_counter): Start diagnostics with lowercase letters. c-family: * c-common.c (handle_mode_attribute): Use %' and word "signedness" in diagnostic. * c-opts.c (c_common_parse_file): Start diagnostics with lowercase letter. * c-pragma.c (handle_pragma_target, handle_pragma_optimize): Remove trailing '.' from diagnostics. * c.opt (Wwrite-strings_: Avoid '`' in help text. cp: * cvt.c (cp_convert_to_pointer): Use %' in diagnostic. * decl.c (layout_var_decl, maybe_commonize_var, grokdeclarator): Use %' in diagnostics. * decl2.c (check_classfn): Use %' in diagnostic. * init.c (build_java_class_ref): Use %' in diagnostic. (build_delete): Remove trailing '.' from diagnostic. * method.c (do_build_copy_assign, walk_field_subobs): Use %' in diagnostics. * name-lookup.c (pushdecl_maybe_friend): Use %' in diagnostic. * parser.c (cp_parser_exception_specification_opt): Remove trailing '.' from diagnostic. (cp_parser_objc_interstitial_code): Use %qs for quoting in diagnostic. * pt.c (check_valid_ptrmem_cst_expr): Use %< and %> for quoting in diagnostic. * repo.c (reopen_repo_file_for_write): Use %' in diagnostic. fortran: * trans-array.c (gfc_trans_deferred_array): Use "front-end" spelling in diagnostic. * trans.c (gfc_allocate_array_with_status): Add missing space in diagnostic. java: * expr.c (expand_java_field_op): Use %' in diagnostic. * jcf-parse.c (java_parse_file): Use %' in diagnostics. * jvspec.c (lang_specific_driver): Use %' in diagnostic. * lang.c (java_post_options): Use %' in diagnostics. lto: * lto.c (lto_resolution_read): Start diagnostics with lowercase letters and remove trailing '.'. (lto_file_finalize): Start diagnostic with a lowercase letter. objc: * objc-act.c (objc_init): Use %' in diagnostic. (objc_set_method_opt): Remove trailing '.' from diagnostic. From-SVN: r166570
2010-11-11 00:23:15 +01:00
error ("non-static const member %q#D, can%'t use default "
"assignment operator", field);
}
else if (TREE_CODE (mem_type) == REFERENCE_TYPE)
{
if (diag)
cfgloop.c (verify_loop_structure): Use %' in diagnostics. * cfgloop.c (verify_loop_structure): Use %' in diagnostics. Start diagnostics with lowercase letters. * cgraphunit.c (verify_cgraph_node): Start diagnostics with lowercase letters. * collect2.c (maybe_run_lto_and_relink): Remove trailing '.' from diagnostic. * config/alpha/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/arm/arm.c (arm_get_pcs_model): Start diagnostics with lowercase letters. * config/arm/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. Remove trailing ' ' from diagnostic. * config/avr/avr.c (print_operand_address): Start diagnostic with a lowercase letter and remove trailing '.'. * config/avr/avr.opt (mpmem-wrap-around): Fix typo in help text. * config/bfin/bfin.c (bfin_option_override): Start diagnostics with lowercase letters. Use %' in diagnostics. Remove trailing '.' from diagnostics. (bfin_handle_longcall_attribute): Use %' in diagnostic. * config/cris/cris.c (cris_split_movdx, cris_expand_pic_call_address): Start diagnostics with lowercase letters. (cris_asm_output_label_ref): Use %' in diagnostic. * config/cris/cris.h (ASM_SPEC): Start diagnostic with a lowercase letter. * config/crx/crx.h (FUNCTION_PROFILER): Start diagnostic with a lowercase letter. * config/darwin-c.c (version_as_macro): Start diagnostic with a lowercase letter. * config/darwin-driver.c (darwin_default_min_version): Use %' in diagnostic. * config/host-darwin.c (darwin_gt_pch_use_address): Use %' in diagnostic. * config/i386/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/i386/host-cygwin.c (cygwin_gt_pch_get_address): Use %' in diagnostics. * config/i386/i386.c (ix86_option_override_internal): Write diagnostic as a single sentence without trailing '.'. Use %' in diagnostics. (ix86_function_sseregparm, classify_argument): Start diagnostics with lowercase letters. (ix86_expand_prologue): Use %' in diagnostic. * config/i386/i386.h (CC1_CPU_SPEC_1): Remove trailing '.' from diagnostic. * config/i386/nwld.h (LINK_SPEC): Start diagnostic with a lowercase letter. * config/i386/winnt.c (i386_pe_determine_dllimport_p): Use %' in diagnostic. * config/ia64/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/ia64/ia64.opt (msched-max-memory-insns-hard-limit): Avoid '`' in help text. * config/lm32/lm32.c (lm32_print_operand): Start diagnostic with a lowercase letter. * config/mep/mep.c (mep_validate_vliw): Start diagnostics with lowercase letters. * config/microblaze/microblaze.c (microblaze_handle_option): Remove trailing '.' from diagnostic. (print_operand): Start diagnostic with a lowercase letter. * config/pa/pa-hpux10.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa-hpux11.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/pa/pa64-hpux.h (LINK_SPEC): Start diagnostics with lowercase letters. Avoid '`' in diagnostics. * config/picochip/picochip.c (picochip_option_override, picochip_emit_save_register, picochip_function_arg, picochip_output_label, picochip_output_internal_label, picochip_asm_output_opcode, picochip_output_cbranch, picochip_output_compare, picochip_output_branch, picochip_get_vliw_alu_id): Remove trailing '.' and '\n' from diagnostics. Start diagnostics with lowercase letters. Use %' in diagnostics. * config/rs6000/rs6000.c (rs6000_option_override_internal): Use "SPE" capitalization. Start diagnostic with a lowercase letter. (rs6000_handle_option): Start diagnostics with lowercase letters. (def_builtin): Remove trailing '.' from diagnostic. (rs6000_savres_routine_name): Start diagnostic with a lowercase letter. * config/rs6000/sysv4.h (LINK_OS_FREEBSD_SPEC): Avoid '`' in diagnostic. * config/rx/rx.c (rx_handle_option): Start diagnostic with a lowercase letter. * config/s390/s390.c (s390_option_override) Start diagnostics with lowercase letters. Use %' in diagnostic. * config/sh/sh.c (sh_output_mi_thunk): Start diagnostics with lowercase letters. * config/sh/symbian-base.c (sh_symbian_mark_dllimport): Use %' in diagnostic. * config/sh/symbian-c.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sh/symbian-cxx.c (sh_symbian_is_dllimported): Use %' in diagnostic. * config/sparc/freebsd.h (LINK_SPEC): Avoid '`' in diagnostic. * config/spu/spu.c (spu_option_override): Start diagnostics with lowercase letters. Use %qs for quoting in diagnostics. (spu_check_builtin_parm): Remove trailing '.' from diagnostics. Use %wd instead of HOST_WIDE_INT_PRINT_DEC in diagnostic . * config/v850/v850.c (construct_save_jarl): Remove trailing '\n' from diagnostic. * convert.c (convert_to_integer, convert_to_vector): Use %' in diagnostics. * dbgcnt.c (dbg_cnt_process_opt): Start diagnostic with lowercase letter and use "cannot" spelling. * expmed.c (extract_fixed_bit_field): Start diagnostic with lowercase letter and format as a single sentence without '.'. * ggc-common.c (write_pch_globals, gt_pch_save, gt_pch_restore): Use %' in diagnostics. * ggc-page.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * ggc-zone.c (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read): Use %' in diagnostics. * graph.c (clean_graph_dump_file): Use %' in diagnostic. * graphite-poly.c (graphite_read_scop_file): Start diagnostics with lowercase letters and remove tailing '.' and '\n'. * lto-cgraph.c (input_profile_summary): Start diagnostic with lowercase letter and remove trailing '.'. (input_cgraph): Start diagnostics with lowercase letters and remove trailing '\n'. * opts.c (finish_options, common_handle_option): Start diagnostics with lowercase letters and remove trailing '.'. Fix typo in diagnostic. * passes.c (position_pass): Start diagnostic with lowercase letter. * plugin.c (add_new_plugin, parse_plugin_arg_opt, register_callback, try_init_one_plugin): Start diagnostics with lowercase letters. * reload1.c (spill_failure): Use %' in diagnostic. (gen_reload): Start diagnostic with a lowercase letter. * stor-layout.c (place_field): Start diagnostic with a lowercase letter. * toplev.c (open_auxiliary_file): Use %' in diagnostic. * tree-cfg.c (verify_expr, verify_types_in_gimple_reference, verify_gimple_call, verify_gimple_phi, verify_eh_throw_stmt_node): Start diagnostics with lowercase letters, remove trailing '.' and use %' in diagnostics. * tree-ssa.c (verify_def): Remove trailing '.' from diagnostic. (verify_ssa): Don't split diagnostic across two error calls. Spell out "number" and use %' in diagnostic. * value-prof.c (visit_hist, check_counter): Start diagnostics with lowercase letters. c-family: * c-common.c (handle_mode_attribute): Use %' and word "signedness" in diagnostic. * c-opts.c (c_common_parse_file): Start diagnostics with lowercase letter. * c-pragma.c (handle_pragma_target, handle_pragma_optimize): Remove trailing '.' from diagnostics. * c.opt (Wwrite-strings_: Avoid '`' in help text. cp: * cvt.c (cp_convert_to_pointer): Use %' in diagnostic. * decl.c (layout_var_decl, maybe_commonize_var, grokdeclarator): Use %' in diagnostics. * decl2.c (check_classfn): Use %' in diagnostic. * init.c (build_java_class_ref): Use %' in diagnostic. (build_delete): Remove trailing '.' from diagnostic. * method.c (do_build_copy_assign, walk_field_subobs): Use %' in diagnostics. * name-lookup.c (pushdecl_maybe_friend): Use %' in diagnostic. * parser.c (cp_parser_exception_specification_opt): Remove trailing '.' from diagnostic. (cp_parser_objc_interstitial_code): Use %qs for quoting in diagnostic. * pt.c (check_valid_ptrmem_cst_expr): Use %< and %> for quoting in diagnostic. * repo.c (reopen_repo_file_for_write): Use %' in diagnostic. fortran: * trans-array.c (gfc_trans_deferred_array): Use "front-end" spelling in diagnostic. * trans.c (gfc_allocate_array_with_status): Add missing space in diagnostic. java: * expr.c (expand_java_field_op): Use %' in diagnostic. * jcf-parse.c (java_parse_file): Use %' in diagnostics. * jvspec.c (lang_specific_driver): Use %' in diagnostic. * lang.c (java_post_options): Use %' in diagnostics. lto: * lto.c (lto_resolution_read): Start diagnostics with lowercase letters and remove trailing '.'. (lto_file_finalize): Start diagnostic with a lowercase letter. objc: * objc-act.c (objc_init): Use %' in diagnostic. (objc_set_method_opt): Remove trailing '.' from diagnostic. From-SVN: r166570
2010-11-11 00:23:15 +01:00
error ("non-static reference member %q#D, can%'t use "
"default assignment operator", field);
}
else
bad = false;
if (bad && deleted_p)
*deleted_p = true;
}
else if (sfk == sfk_constructor)
{
bool bad;
if (DECL_INITIAL (field))
{
if (diag && DECL_INITIAL (field) == error_mark_node)
inform (DECL_SOURCE_LOCATION (field),
"initializer for %q#D is invalid", field);
if (trivial_p)
*trivial_p = false;
/* Core 1351: If the field has an NSDMI that could throw, the
default constructor is noexcept(false). */
if (spec_p)
{
tree nsdmi = get_nsdmi (field, /*ctor*/false);
if (!expr_noexcept_p (nsdmi, complain))
*spec_p = noexcept_false_spec;
}
/* Don't do the normal processing. */
continue;
}
bad = false;
if (CP_TYPE_CONST_P (mem_type)
&& default_init_uninitialized_part (mem_type))
{
if (diag)
{
error ("uninitialized const member in %q#T",
current_class_type);
inform (DECL_SOURCE_LOCATION (field),
"%q#D should be initialized", field);
}
bad = true;
}
else if (TREE_CODE (mem_type) == REFERENCE_TYPE)
{
if (diag)
{
error ("uninitialized reference member in %q#T",
current_class_type);
inform (DECL_SOURCE_LOCATION (field),
"%q#D should be initialized", field);
}
bad = true;
}
if (bad && deleted_p)
*deleted_p = true;
/* For an implicitly-defined default constructor to be constexpr,
every member must have a user-provided default constructor or
an explicit initializer. */
if (constexpr_p && !CLASS_TYPE_P (mem_type)
&& TREE_CODE (DECL_CONTEXT (field)) != UNION_TYPE)
{
*constexpr_p = false;
if (diag)
inform (DECL_SOURCE_LOCATION (field),
"defaulted default constructor does not "
"initialize %q#D", field);
}
}
else if (sfk == sfk_copy_constructor)
{
/* 12.8p11b5 */
if (TREE_CODE (mem_type) == REFERENCE_TYPE
&& TYPE_REF_IS_RVALUE (mem_type))
{
if (diag)
error ("copying non-static data member %q#D of rvalue "
"reference type", field);
if (deleted_p)
*deleted_p = true;
}
}
if (!CLASS_TYPE_P (mem_type))
continue;
if (ANON_AGGR_TYPE_P (mem_type))
{
walk_field_subobs (TYPE_FIELDS (mem_type), fnname, sfk, quals,
copy_arg_p, move_p, assign_p, spec_p, trivial_p,
deleted_p, constexpr_p,
diag, flags, complain, dtor_from_ctor);
continue;
}
if (copy_arg_p)
{
int mem_quals = cp_type_quals (mem_type) | quals;
if (DECL_MUTABLE_P (field))
mem_quals &= ~TYPE_QUAL_CONST;
argtype = build_stub_type (mem_type, mem_quals, move_p);
}
else
argtype = NULL_TREE;
rval = locate_fn_flags (mem_type, fnname, argtype, flags, complain);
process_subob_fn (rval, spec_p, trivial_p, deleted_p,
constexpr_p, diag, field, dtor_from_ctor);
}
}
/* The caller wants to generate an implicit declaration of SFK for
CTYPE which is const if relevant and CONST_P is set. If SPEC_P,
TRIVIAL_P, DELETED_P or CONSTEXPR_P are non-null, set their
referent appropriately. If DIAG is true, we're either being called
from maybe_explain_implicit_delete to give errors, or if
CONSTEXPR_P is non-null, from explain_invalid_constexpr_fn. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
static void
synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
tree *spec_p, bool *trivial_p, bool *deleted_p,
bool *constexpr_p, bool diag,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
tree inheriting_ctor, tree inherited_parms)
{
tree binfo, base_binfo, scope, fnname, rval, argtype;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
bool move_p, copy_arg_p, assign_p, expected_trivial, check_vdtor;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *vbases;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
int i, quals, flags;
tsubst_flags_t complain;
bool ctor_p;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (spec_p)
c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. * c-cppbuiltin.c (c_cpp_builtins): Likewise. * c-opts.c (c_common_post_options): Likewise. cp/ 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * call.c (null_ptr_cst_p): Use cxx11 in lieu of cxx0x. * class.c (add_implicitly_declared_members): Likewise. (check_field_decl): Likewise. (finalize_literal_type_property): Likewise. (check_bases_and_members): Likewise. * decl.c (poplevel): Likewise. (case_conversion): Likewise. (check_initializer): Likewise. (grokfndecl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (grokdeclarator): Likewise. (build_enumerator): Likewise. * friend.c (make_friend_class): Likewise. * lex.c (init_reswords): Likewise. * method.c (synthesized_method_walk): Likewise. (implicitly_declare_fn): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_constant_expression): Likewise. (cp_parser_for_init_statement): Likewise. (cp_parser_block_declaration): Likewise. (cp_parser_type_name): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_member_declaration): Likewise. (cp_nth_tokens_can_be_std_attribute_p): Likewise. (cp_parser_template_declaration_after_export): Likewise. * pt.c (convert_nontype_argument_function): Likewise. (convert_nontype_argument): Likewise. (convert_template_argument): Likewise. (tsubst_copy_and_build): Likewise. (build_non_dependent_expr): Likewise. * semantics.c (non_const_var_error): Likewise. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. (build_vec_init_expr): Likewise. (cast_valid_in_integral_constant_expression_p): Likewise. * typeck.c (build_x_conditional_expr): Likewise. * typeck2.c (check_narrowing): Likewise. From-SVN: r200348
2013-06-23 04:27:03 +02:00
*spec_p = (cxx_dialect >= cxx11 ? noexcept_true_spec : empty_except_spec);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (deleted_p)
{
/* "The closure type associated with a lambda-expression has a deleted
default constructor and a deleted copy assignment operator."
This is diagnosed in maybe_explain_implicit_delete. */
if (LAMBDA_TYPE_P (ctype)
&& (sfk == sfk_constructor
|| sfk == sfk_copy_assignment))
{
*deleted_p = true;
return;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
*deleted_p = false;
}
ctor_p = false;
assign_p = false;
check_vdtor = false;
switch (sfk)
{
case sfk_move_assignment:
case sfk_copy_assignment:
assign_p = true;
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
fnname = cp_assignment_operator_id (NOP_EXPR);
break;
case sfk_destructor:
check_vdtor = true;
/* The synthesized method will call base dtors, but check complete
here to avoid having to deal with VTT. */
fnname = complete_dtor_identifier;
break;
case sfk_constructor:
case sfk_move_constructor:
case sfk_copy_constructor:
case sfk_inheriting_constructor:
ctor_p = true;
fnname = complete_ctor_identifier;
break;
default:
gcc_unreachable ();
}
gcc_assert ((sfk == sfk_inheriting_constructor)
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
== (inheriting_ctor != NULL_TREE));
/* If that user-written default constructor would satisfy the
requirements of a constexpr constructor (7.1.5), the
implicitly-defined default constructor is constexpr.
The implicitly-defined copy/move assignment operator is constexpr if
- X is a literal type, and
- the assignment operator selected to copy/move each direct base class
subobject is a constexpr function, and
- for each non-static data member of X that is of class type (or array
thereof), the assignment operator selected to copy/move that member is a
constexpr function. */
if (constexpr_p)
*constexpr_p = ctor_p
|| (assign_p && cxx_dialect >= cxx14);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
move_p = false;
switch (sfk)
{
case sfk_constructor:
case sfk_destructor:
case sfk_inheriting_constructor:
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
copy_arg_p = false;
break;
case sfk_move_constructor:
case sfk_move_assignment:
move_p = true;
re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) PR c/7652 gcc/ * alias.c (find_base_value): Adjust fall through comment. * cfgexpand.c (expand_debug_expr): Likewise. * combine.c (find_split_point): Likewise. (expand_compound_operation): Likewise. Add FALLTHRU. (make_compound_operation): Adjust fall through comment. (canon_reg_for_combine): Add FALLTHRU. (force_to_mode): Adjust fall through comment. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Add FALLTHRU. * config/aarch64/predicates.md: Likewise. * config/i386/i386.c (function_arg_advance_32): Likewise. (ix86_gimplify_va_arg): Likewise. (print_reg): Likewise. (ix86_print_operand): Likewise. (ix86_build_const_vector): Likewise. (ix86_expand_branch): Likewise. (ix86_sched_init_global): Adjust fall through comment. (ix86_expand_args_builtin): Add FALLTHRU. (ix86_expand_builtin): Likewise. (ix86_expand_vector_init_one_var): Likewise. * config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): Likewise. (rs6000_adjust_cost): Likewise. (insn_must_be_first_in_group): Likewise. * config/rs6000/rs6000.md: Likewise. Adjust fall through comment. * dbxout.c (dbxout_symbol): Adjust fall through comment. * df-scan.c (df_uses_record): Likewise. * dojump.c (do_jump): Add FALLTHRU. * dwarf2out.c (mem_loc_descriptor): Likewise. Adjust fall through comment. (resolve_args_picking_1): Adjust fall through comment. (loc_list_from_tree_1): Likewise. * expmed.c (make_tree): Likewise. * expr.c (expand_expr_real_2): Add FALLTHRU. (expand_expr_real_1): Likewise. Adjust fall through comment. * fold-const.c (const_binop): Adjust fall through comment. (fold_truth_not_expr): Likewise. (fold_cond_expr_with_comparison): Add FALLTHRU. (fold_binary_loc): Likewise. (contains_label_1): Adjust fall through comment. (multiple_of_p): Likewise. * gcov-tool.c (process_args): Add FALLTHRU. * genattrtab.c (check_attr_test): Likewise. (write_test_expr): Likewise. * genconfig.c (walk_insn_part): Likewise. * genpreds.c (validate_exp): Adjust fall through comment. (needs_variable): Likewise. * gensupport.c (get_alternatives_number): Add FALLTHRU. (subst_dup): Likewise. * gimple-pretty-print.c (dump_gimple_assign): Likewise. * gimplify.c (gimplify_addr_expr): Adjust fall through comment. (gimplify_scan_omp_clauses): Add FALLTHRU. (goa_stabilize_expr): Likewise. * graphite-isl-ast-to-gimple.c (substitute_ssa_name): Adjust fall through comment. * hsa-gen.c (get_address_from_value): Likewise. * ipa-icf.c (sem_function::hash_stmt): Likewise. * ira.c (ira_setup_alts): Add FALLTHRU. * lra-eliminations.c (lra_eliminate_regs_1): Adjust fall through comment. * lto-streamer-out.c (lto_output_tree_ref): Add FALLTHRU. * opts.c (common_handle_option): Likewise. * read-rtl.c (read_rtx_code): Likewise. * real.c (round_for_format): Likewise. * recog.c (asm_operand_ok): Likewise. * reginfo.c (reg_scan_mark_refs): Adjust fall through comment. * reload1.c (set_label_offsets): Likewise. (eliminate_regs_1): Likewise. (reload_reg_reaches_end_p): Likewise. * rtlanal.c (commutative_operand_precedence): Add FALLTHRU. (rtx_cost): Likewise. * sched-rgn.c (is_exception_free): Likewise. * simplify-rtx.c (simplify_rtx): Adjust fall through comment. * stor-layout.c (int_mode_for_mode): Likewise. * toplev.c (print_to_asm_out_file): Likewise. (print_to_stderr): Likewise. * tree-cfg.c (gimple_verify_flow_info): Likewise. * tree-chrec.c (chrec_fold_plus_1): Add FALLTHRU. (chrec_fold_multiply): Likewise. (evolution_function_is_invariant_rec_p): Likewise. (for_each_scev_op): Likewise. * tree-data-ref.c (siv_subscript_p): Likewise. (get_references_in_stmt): Likewise. * tree.c (find_placeholder_in_expr): Adjust fall through comment. (substitute_in_expr): Likewise. (type_cache_hasher::equal): Likewise. (walk_type_fields): Likewise. * var-tracking.c (adjust_mems): Add FALLTHRU. (set_dv_changed): Adjust fall through comment. * varasm.c (default_function_section): Add FALLTHRU. gcc/c-family/ * c-common.c (scalar_to_vector): Adjust fall through comment. * c-opts.c (c_common_handle_option): Likewise. * c-pragma.c (handle_pragma_pack): Add FALLTHRU. * c-pretty-print.c (c_pretty_printer::postfix_expression): Adjust fall through comment. * cilk.c (extract_free_variables): Add FALLTHRU. gcc/c/ * c-parser.c (c_parser_external_declaration): Add FALLTHRU. (c_parser_postfix_expression): Likewise. * c-typeck.c (build_unary_op): Adjust fall through comment. (c_mark_addressable): Likewise. gcc/cp/ * call.c (add_builtin_candidate): Add FALLTHRU. (build_integral_nontype_arg_conv): Adjust fall through comment. (build_new_op_1): Add FALLTHRU. (convert_like_real): Adjust fall through comment. * class.c (fixed_type_or_null): Likewise. * constexpr.c (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. Add FALLTHRU. * cp-gimplify.c (cp_gimplify_expr): Adjust fall through comment. (cp_fold): Add FALLTHRU. * cvt.c (build_expr_type_conversion): Adjust fall through comment. * cxx-pretty-print.c (pp_cxx_unqualified_id): Add FALLTHRU. (pp_cxx_qualified_id): Likewise. (cxx_pretty_printer::constant): Adjust fall through comment. (cxx_pretty_printer::primary_expression): Add FALLTHRU. (pp_cxx_pm_expression): Adjust fall through comment. (cxx_pretty_printer::expression): Add FALLTHRU. (cxx_pretty_printer::declaration_specifiers): Reformat code. (pp_cxx_type_specifier_seq): Adjust fall through comment. (pp_cxx_ptr_operator): Likewise. Add FALLTHRU. * error.c (dump_type): Adjust fall through comment. (dump_decl): Likewise. * mangle.c (write_type): Likewise. * method.c (synthesized_method_walk): Add FALLTHRU. * name-lookup.c (arg_assoc_type): Likewise. * parser.c (cp_lexer_print_token): Adjust fall through comment. (cp_parser_primary_expression): Add FALLTHRU. (cp_parser_operator): Likewise. * pt.c (find_parameter_packs_r): Likewise. (tsubst_aggr_type): Adjust fall through comment. * semantics.c (finish_omp_clauses): Add FALLTHRU. * tree.c (lvalue_kind): Likewise. gcc/fortran/ * decl.c (match_attr_spec): Add FALLTHRU. * primary.c (match_arg_list_function): Likewise. * resolve.c (resolve_operator): Adjust fall through comment. (fixup_charlen): Add FALLTHRU. (resolve_allocate_expr): Adjust fall through comment. * trans-array.c (gfc_conv_ss_startstride): Add FALLTHRU. * trans-intrinsic.c (gfc_conv_intrinsic_len): Adjust fall through comment. gcc/java/ * expr.c (java_truthvalue_conversion): Adjust fall through comment. * jcf-io.c (verify_constant_pool): Likewise. * typeck.c (promote_type): Likewise. gcc/objc/ * objc-encoding.c (encode_type): Add FALLTHRU. libcpp/ * lex.c (search_line_fast): Add FALLTHRU. (_cpp_lex_direct): Likewise. (cpp_token_val_index): Adjust fall through comment. * macro.c (parse_params): Add FALLTHRU. * pch.c (count_defs): Adjust fall through comment. (write_defs): Likewise. libiberty/ * cp-demangle.c (d_print_mod): Add FALLTHRU. From-SVN: r239410
2016-08-12 12:30:47 +02:00
/* FALLTHRU */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
case sfk_copy_constructor:
case sfk_copy_assignment:
copy_arg_p = true;
break;
default:
gcc_unreachable ();
}
expected_trivial = type_has_trivial_fn (ctype, sfk);
if (trivial_p)
*trivial_p = expected_trivial;
/* The TYPE_HAS_COMPLEX_* flags tell us about constraints from base
class versions and other properties of the type. But a subobject
class can be trivially copyable and yet have overload resolution
choose a template constructor for initialization, depending on
rvalueness and cv-quals. And furthermore, a member in a base might
be trivial but deleted or otherwise not callable. So we can't exit
early in C++0x. The same considerations apply in C++98/03, but
there the definition of triviality does not consider overload
resolution, so a constructor can be trivial even if it would otherwise
call a non-trivial constructor. */
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (expected_trivial
c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. * c-cppbuiltin.c (c_cpp_builtins): Likewise. * c-opts.c (c_common_post_options): Likewise. cp/ 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * call.c (null_ptr_cst_p): Use cxx11 in lieu of cxx0x. * class.c (add_implicitly_declared_members): Likewise. (check_field_decl): Likewise. (finalize_literal_type_property): Likewise. (check_bases_and_members): Likewise. * decl.c (poplevel): Likewise. (case_conversion): Likewise. (check_initializer): Likewise. (grokfndecl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (grokdeclarator): Likewise. (build_enumerator): Likewise. * friend.c (make_friend_class): Likewise. * lex.c (init_reswords): Likewise. * method.c (synthesized_method_walk): Likewise. (implicitly_declare_fn): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_constant_expression): Likewise. (cp_parser_for_init_statement): Likewise. (cp_parser_block_declaration): Likewise. (cp_parser_type_name): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_member_declaration): Likewise. (cp_nth_tokens_can_be_std_attribute_p): Likewise. (cp_parser_template_declaration_after_export): Likewise. * pt.c (convert_nontype_argument_function): Likewise. (convert_nontype_argument): Likewise. (convert_template_argument): Likewise. (tsubst_copy_and_build): Likewise. (build_non_dependent_expr): Likewise. * semantics.c (non_const_var_error): Likewise. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. (build_vec_init_expr): Likewise. (cast_valid_in_integral_constant_expression_p): Likewise. * typeck.c (build_x_conditional_expr): Likewise. * typeck2.c (check_narrowing): Likewise. From-SVN: r200348
2013-06-23 04:27:03 +02:00
&& (!copy_arg_p || cxx_dialect < cxx11))
{
if (constexpr_p && sfk == sfk_constructor)
{
bool cx = trivial_default_constructor_is_constexpr (ctype);
*constexpr_p = cx;
if (diag && !cx && TREE_CODE (ctype) == UNION_TYPE)
/* A trivial constructor doesn't have any NSDMI. */
inform (input_location, "defaulted default constructor does "
"not initialize any non-static data member");
}
if (!diag && cxx_dialect < cxx11)
return;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
++cp_unevaluated_operand;
++c_inhibit_evaluation_warnings;
push_deferring_access_checks (dk_no_deferred);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
scope = push_scope (ctype);
flags = LOOKUP_NORMAL|LOOKUP_SPECULATIVE;
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
if (!inheriting_ctor)
flags |= LOOKUP_DEFAULTED;
re PR c++/53567 ("ICE: Error reporting routines re-entered" on missing enum entry) /cp 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * typeck.c (cp_perform_integral_promotions): New, like perform_integral_promotions but also takes a tsubst_flags_t parameter. (pointer_diff): Add tsubst_flags_t parameter. (decay_conversion, cp_default_conversion, cp_build_array_ref, cp_build_binary_op, cp_build_unary_op, build_static_cast_1, build_reinterpret_cast_1, cp_build_modify_expr, convert_for_assignment): Adjust. * optimize.c (build_delete_destructor_body): Adjust. * init.c (expand_virtual_init, expand_default_init, build_new_1, build_new, build_vec_delete_1, build_vec_init, build_delete): Adjust. (construct_virtual_base): Adjust LOOKUP_COMPLAIN -> 0. * class.c (build_base_path): Adjust. * decl.c (compute_array_index_type, finish_destructor_body): Likewise. * method.c (synthesized_method_walk): Adjust flag and complain. * rtti.c (ifnonnull): Add tsubst_flags_t parameter. (build_typeid, build_dynamic_cast_1): Adjust. * except.c (initialize_handler_parm): Likewise. * typeck2.c (process_init_constructor_record): Likewise. * pt.c (tsubst_friend_class): Don't change flags. * semantics.c (finish_goto_stmt, handle_omp_for_class_iterator, finish_static_assert): Likewise. * parser.c (cp_parser_lookup_name): Just pass 0 as flags to lookup_name_real. * call.c (build_op_delete_call): Add tsubst_flags_t parameter. (convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing): Adjust. (standard_conversion): Adjust LOOKUP_COMPLAIN -> 0. (implicit_conversion): Mask out tf_error with a FIXME. (build_user_type_conversion_1, build_new_op_1, build_over_call): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, cp_convert, cp_convert_and_check, ocp_convert, convert_force): Add tsubst_flags_t parameter. (convert_to_reference, ocp_convert): Use complain & tf_error instead of flags & LOOKUP_COMPLAIN. (convert_force): Adjust LOOKUP_COMPLAIN -> 0. * name-lookup.c (identifier_type_value_1, lookup_qualified_name, lookup_name_real, lookup_function_nonclass, lookup_name, lookup_name_prefer_type): Adjust LOOKUP_COMPLAIN -> 0. * cp-tree.h: Adjust prototypes; remove LOOKUP_COMPLAIN. /testsuite 2012-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53567 * g++.dg/cpp0x/alias-decl-19.C: New. From-SVN: r188283
2012-06-07 01:01:45 +02:00
complain = diag ? tf_warning_or_error : tf_none;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (const_p)
quals = TYPE_QUAL_CONST;
else
quals = TYPE_UNQUALIFIED;
argtype = NULL_TREE;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
for (binfo = TYPE_BINFO (ctype), i = 0;
BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
{
tree basetype = BINFO_TYPE (base_binfo);
if (!assign_p && BINFO_VIRTUAL_P (base_binfo))
/* We'll handle virtual bases below. */
continue;
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
bool inherited_binfo = false;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (copy_arg_p)
argtype = build_stub_type (basetype, quals, move_p);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
else if ((inherited_binfo
= binfo_inherited_from (binfo, base_binfo, inheriting_ctor)))
{
/* Don't check access on the inherited constructor. */
argtype = inherited_parms;
if (flag_new_inheriting_ctors)
push_deferring_access_checks (dk_deferred);
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
rval = locate_fn_flags (base_binfo, fnname, argtype, flags, complain);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
if (inherited_binfo)
{
if (flag_new_inheriting_ctors)
pop_deferring_access_checks ();
argtype = NULL_TREE;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
process_subob_fn (rval, spec_p, trivial_p, deleted_p,
constexpr_p, diag, basetype);
if (ctor_p)
{
/* In a constructor we also need to check the subobject
destructors for cleanup of partially constructed objects. */
rval = locate_fn_flags (base_binfo, complete_dtor_identifier,
NULL_TREE, flags, complain);
/* Note that we don't pass down trivial_p; the subobject
destructors don't affect triviality of the constructor. Nor
do they affect constexpr-ness (a constant expression doesn't
throw) or exception-specification (a throw from one of the
dtors would be a double-fault). */
process_subob_fn (rval, NULL, NULL,
deleted_p, NULL, false,
basetype, /*dtor_from_ctor*/true);
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (check_vdtor && type_has_virtual_destructor (basetype))
{
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
rval = locate_fn_flags (ctype, cp_operator_id (DELETE_EXPR),
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
ptr_type_node, flags, complain);
/* Unlike for base ctor/op=/dtor, for operator delete it's fine
to have a null rval (no class-specific op delete). */
if (rval && rval == error_mark_node && deleted_p)
*deleted_p = true;
check_vdtor = false;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
}
if (diag && assign_p && move_p
&& BINFO_VIRTUAL_P (base_binfo)
&& rval && TREE_CODE (rval) == FUNCTION_DECL
&& move_fn_p (rval) && !trivial_fn_p (rval)
&& vbase_has_user_provided_move_assign (basetype))
warning (OPT_Wvirtual_move_assign,
"defaulted move assignment for %qT calls a non-trivial "
"move assignment operator for virtual base %qT",
ctype, basetype);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
}
vbases = CLASSTYPE_VBASECLASSES (ctype);
if (assign_p)
/* No need to examine vbases here. */;
else if (vec_safe_is_empty (vbases))
/* No virtual bases to worry about. */;
else if (ABSTRACT_CLASS_TYPE_P (ctype) && cxx_dialect >= cxx14)
/* Vbase cdtors are not relevant. */;
else
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
{
if (constexpr_p)
*constexpr_p = false;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
FOR_EACH_VEC_ELT (*vbases, i, base_binfo)
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
{
tree basetype = BINFO_TYPE (base_binfo);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
bool inherited_binfo = false;
if (copy_arg_p)
argtype = build_stub_type (basetype, quals, move_p);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
else if ((inherited_binfo
= binfo_inherited_from (binfo, base_binfo, inheriting_ctor)))
{
argtype = inherited_parms;
if (flag_new_inheriting_ctors)
push_deferring_access_checks (dk_deferred);
}
rval = locate_fn_flags (base_binfo, fnname, argtype, flags, complain);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
if (inherited_binfo)
{
if (flag_new_inheriting_ctors)
pop_deferring_access_checks ();
argtype = NULL_TREE;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
process_subob_fn (rval, spec_p, trivial_p, deleted_p,
constexpr_p, diag, basetype);
if (ctor_p && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (basetype))
{
rval = locate_fn_flags (base_binfo, complete_dtor_identifier,
NULL_TREE, flags, complain);
process_subob_fn (rval, NULL, NULL,
deleted_p, NULL, false,
basetype, /*dtor_from_ctor*/true);
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
}
}
/* Now handle the non-static data members. */
walk_field_subobs (TYPE_FIELDS (ctype), fnname, sfk, quals,
copy_arg_p, move_p, assign_p, spec_p, trivial_p,
deleted_p, constexpr_p,
diag, flags, complain, /*dtor_from_ctor*/false);
if (ctor_p)
walk_field_subobs (TYPE_FIELDS (ctype), complete_dtor_identifier,
sfk_destructor, TYPE_UNQUALIFIED, false,
false, false, NULL, NULL,
deleted_p, NULL,
false, flags, complain, /*dtor_from_ctor*/true);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
pop_scope (scope);
pop_deferring_access_checks ();
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
--cp_unevaluated_operand;
--c_inhibit_evaluation_warnings;
}
/* DECL is a defaulted function whose exception specification is now
needed. Return what it should be. */
tree
get_defaulted_eh_spec (tree decl)
{
if (DECL_CLONED_FUNCTION_P (decl))
decl = DECL_CLONED_FUNCTION (decl);
special_function_kind sfk = special_function_p (decl);
tree ctype = DECL_CONTEXT (decl);
tree parms = FUNCTION_FIRST_USER_PARMTYPE (decl);
tree parm_type = TREE_VALUE (parms);
bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
tree spec = empty_except_spec;
synthesized_method_walk (ctype, sfk, const_p, &spec, NULL, NULL,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
NULL, false, DECL_INHERITED_CTOR (decl),
parms);
return spec;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* DECL is a deleted function. If it's implicitly deleted, explain why and
return true; else return false. */
bool
maybe_explain_implicit_delete (tree decl)
{
/* If decl is a clone, get the primary variant. */
decl = DECL_ORIGIN (decl);
gcc_assert (DECL_DELETED_FN (decl));
if (DECL_DEFAULTED_FN (decl))
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
{
/* Not marked GTY; it doesn't need to be GC'd or written to PCH. */
static hash_set<tree> *explained;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
special_function_kind sfk;
location_t loc;
bool informed;
tree ctype;
if (!explained)
explained = new hash_set<tree>;
if (explained->add (decl))
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
return true;
sfk = special_function_p (decl);
ctype = DECL_CONTEXT (decl);
loc = input_location;
input_location = DECL_SOURCE_LOCATION (decl);
informed = false;
if (LAMBDA_TYPE_P (ctype))
{
informed = true;
if (sfk == sfk_constructor)
inform (DECL_SOURCE_LOCATION (decl),
"a lambda closure type has a deleted default constructor");
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
else if (sfk == sfk_copy_assignment)
inform (DECL_SOURCE_LOCATION (decl),
"a lambda closure type has a deleted copy assignment operator");
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
else
informed = false;
}
else if (DECL_ARTIFICIAL (decl)
&& (sfk == sfk_copy_assignment
|| sfk == sfk_copy_constructor)
&& (type_has_user_declared_move_constructor (ctype)
|| type_has_user_declared_move_assign (ctype)))
{
inform (DECL_SOURCE_LOCATION (decl),
"%q#D is implicitly declared as deleted because %qT "
"declares a move constructor or move assignment operator",
decl, ctype);
informed = true;
}
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
else if (sfk == sfk_inheriting_constructor)
{
tree binfo = inherited_ctor_binfo (decl);
if (TREE_CODE (binfo) != TREE_BINFO)
{
inform (DECL_SOURCE_LOCATION (decl),
"%q#D inherits from multiple base subobjects",
decl);
informed = true;
}
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (!informed)
{
tree parms = FUNCTION_FIRST_USER_PARMTYPE (decl);
tree parm_type = TREE_VALUE (parms);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
tree raises = NULL_TREE;
bool deleted_p = false;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
tree scope = push_scope (ctype);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
synthesized_method_walk (ctype, sfk, const_p,
&raises, NULL, &deleted_p, NULL, false,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
DECL_INHERITED_CTOR (decl), parms);
if (deleted_p)
{
inform (DECL_SOURCE_LOCATION (decl),
"%q#D is implicitly deleted because the default "
"definition would be ill-formed:", decl);
synthesized_method_walk (ctype, sfk, const_p,
NULL, NULL, NULL, NULL, true,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
DECL_INHERITED_CTOR (decl), parms);
}
else if (!comp_except_specs
(TYPE_RAISES_EXCEPTIONS (TREE_TYPE (decl)),
raises, ce_normal))
inform (DECL_SOURCE_LOCATION (decl), "%q#F is implicitly "
"deleted because its exception-specification does not "
"match the implicit exception-specification %qX",
decl, raises);
else if (flag_checking)
gcc_unreachable ();
pop_scope (scope);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
}
input_location = loc;
return true;
}
return false;
}
/* DECL is a defaulted function which was declared constexpr. Explain why
it can't be constexpr. */
void
explain_implicit_non_constexpr (tree decl)
{
tree parm_type = TREE_VALUE (FUNCTION_FIRST_USER_PARMTYPE (decl));
bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
bool dummy;
synthesized_method_walk (DECL_CLASS_CONTEXT (decl),
special_function_p (decl), const_p,
NULL, NULL, NULL, &dummy, true,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
DECL_INHERITED_CTOR (decl),
FUNCTION_FIRST_USER_PARMTYPE (decl));
}
/* DECL is an instantiation of an inheriting constructor template. Deduce
the correct exception-specification and deletedness for this particular
specialization. */
void
deduce_inheriting_ctor (tree decl)
{
decl = DECL_ORIGIN (decl);
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
gcc_assert (DECL_INHERITED_CTOR (decl));
tree spec;
bool trivial, constexpr_, deleted;
synthesized_method_walk (DECL_CONTEXT (decl), sfk_inheriting_constructor,
false, &spec, &trivial, &deleted, &constexpr_,
/*diag*/false,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
DECL_INHERITED_CTOR (decl),
FUNCTION_FIRST_USER_PARMTYPE (decl));
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
if (TREE_CODE (inherited_ctor_binfo (decl)) != TREE_BINFO)
/* Inherited the same constructor from different base subobjects. */
deleted = true;
DECL_DELETED_FN (decl) = deleted;
TREE_TYPE (decl) = build_exception_variant (TREE_TYPE (decl), spec);
tree clone;
FOR_EACH_CLONE (clone, decl)
{
DECL_DELETED_FN (clone) = deleted;
TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone), spec);
}
}
/* Implicitly declare the special function indicated by KIND, as a
member of TYPE. For copy constructors and assignment operators,
CONST_P indicates whether these functions should take a const
reference argument or a non-const reference. Returns the
FUNCTION_DECL for the implicitly declared function. */
tree
implicitly_declare_fn (special_function_kind kind, tree type,
bool const_p, tree inherited_ctor,
tree inherited_parms)
{
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
tree fn;
tree parameter_types = void_list_node;
tree return_type;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
tree fn_type;
tree raises = empty_except_spec;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
tree rhs_parm_type = NULL_TREE;
tree this_parm;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
tree name;
HOST_WIDE_INT saved_processing_template_decl;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
bool deleted_p;
bool constexpr_p;
/* Because we create declarations for implicitly declared functions
lazily, we may be creating the declaration for a member of TYPE
while in some completely different context. However, TYPE will
never be a dependent class (because we never want to do lookups
for implicitly defined functions in a dependent class).
Furthermore, we must set PROCESSING_TEMPLATE_DECL to zero here
because we only create clones for constructors and destructors
when not in a template. */
gcc_assert (!dependent_type_p (type));
saved_processing_template_decl = processing_template_decl;
processing_template_decl = 0;
type = TYPE_MAIN_VARIANT (type);
extend.texi (Java Exceptions): Remove. * doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750
2016-10-04 17:32:31 +02:00
if (targetm.cxx.cdtor_returns_this ())
{
if (kind == sfk_destructor)
/* See comment in check_special_function_return_type. */
return_type = build_pointer_type (void_type_node);
else
return_type = build_pointer_type (type);
}
else
return_type = void_type_node;
switch (kind)
{
case sfk_destructor:
/* Destructor. */
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
name = constructor_name (type);
break;
case sfk_constructor:
/* Default constructor. */
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
name = constructor_name (type);
break;
case sfk_copy_constructor:
case sfk_copy_assignment:
case sfk_move_constructor:
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
case sfk_move_assignment:
case sfk_inheriting_constructor:
{
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
bool move_p;
if (kind == sfk_copy_assignment
|| kind == sfk_move_assignment)
{
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
return_type = build_reference_type (type);
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
name = cp_assignment_operator_id (NOP_EXPR);
}
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
else
name = constructor_name (type);
if (kind == sfk_inheriting_constructor)
parameter_types = inherited_parms;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
else
{
if (const_p)
rhs_parm_type = cp_build_qualified_type (type, TYPE_QUAL_CONST);
else
rhs_parm_type = type;
move_p = (kind == sfk_move_assignment
|| kind == sfk_move_constructor);
rhs_parm_type = cp_build_reference_type (rhs_parm_type, move_p);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
parameter_types = tree_cons (NULL_TREE, rhs_parm_type, parameter_types);
}
break;
}
default:
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
gcc_unreachable ();
}
bool trivial_p = false;
if (inherited_ctor)
{
/* For an inheriting constructor, just copy these flags from the
inherited constructor until deduce_inheriting_ctor. */
raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (inherited_ctor));
deleted_p = DECL_DELETED_FN (inherited_ctor);
constexpr_p = DECL_DECLARED_CONSTEXPR_P (inherited_ctor);
}
else if (cxx_dialect >= cxx11)
{
raises = unevaluated_noexcept_spec ();
synthesized_method_walk (type, kind, const_p, NULL, &trivial_p,
&deleted_p, &constexpr_p, false,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
inherited_ctor, inherited_parms);
}
else
synthesized_method_walk (type, kind, const_p, &raises, &trivial_p,
&deleted_p, &constexpr_p, false,
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
inherited_ctor, inherited_parms);
/* Don't bother marking a deleted constructor as constexpr. */
if (deleted_p)
constexpr_p = false;
/* A trivial copy/move constructor is also a constexpr constructor,
unless the class has virtual bases (7.1.5p4). */
c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. * c-cppbuiltin.c (c_cpp_builtins): Likewise. * c-opts.c (c_common_post_options): Likewise. cp/ 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * call.c (null_ptr_cst_p): Use cxx11 in lieu of cxx0x. * class.c (add_implicitly_declared_members): Likewise. (check_field_decl): Likewise. (finalize_literal_type_property): Likewise. (check_bases_and_members): Likewise. * decl.c (poplevel): Likewise. (case_conversion): Likewise. (check_initializer): Likewise. (grokfndecl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (grokdeclarator): Likewise. (build_enumerator): Likewise. * friend.c (make_friend_class): Likewise. * lex.c (init_reswords): Likewise. * method.c (synthesized_method_walk): Likewise. (implicitly_declare_fn): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_constant_expression): Likewise. (cp_parser_for_init_statement): Likewise. (cp_parser_block_declaration): Likewise. (cp_parser_type_name): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_member_declaration): Likewise. (cp_nth_tokens_can_be_std_attribute_p): Likewise. (cp_parser_template_declaration_after_export): Likewise. * pt.c (convert_nontype_argument_function): Likewise. (convert_nontype_argument): Likewise. (convert_template_argument): Likewise. (tsubst_copy_and_build): Likewise. (build_non_dependent_expr): Likewise. * semantics.c (non_const_var_error): Likewise. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. (build_vec_init_expr): Likewise. (cast_valid_in_integral_constant_expression_p): Likewise. * typeck.c (build_x_conditional_expr): Likewise. * typeck2.c (check_narrowing): Likewise. From-SVN: r200348
2013-06-23 04:27:03 +02:00
else if (trivial_p && cxx_dialect >= cxx11
&& (kind == sfk_copy_constructor
|| kind == sfk_move_constructor)
&& !CLASSTYPE_VBASECLASSES (type))
gcc_assert (constexpr_p);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (!trivial_p && type_has_trivial_fn (type, kind))
type_set_nontrivial_flag (type, kind);
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
/* Create the function. */
fn_type = build_method_type_directly (type, return_type, parameter_types);
if (raises)
fn_type = build_exception_variant (fn_type, raises);
fn = build_lang_decl (FUNCTION_DECL, name, fn_type);
if (kind != sfk_inheriting_constructor)
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (TYPE_NAME (type));
if (kind == sfk_constructor || kind == sfk_copy_constructor
|| kind == sfk_move_constructor || kind == sfk_inheriting_constructor)
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
DECL_CONSTRUCTOR_P (fn) = 1;
else if (kind == sfk_destructor)
DECL_DESTRUCTOR_P (fn) = 1;
else
{
DECL_ASSIGNMENT_OPERATOR_P (fn) = 1;
SET_OVERLOADED_OPERATOR_CODE (fn, NOP_EXPR);
}
tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount. * tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount. (SET_TYPE_ALIGN, SET_DECL_ALIGN): New. * tree-core.h (tree_type_common.align): Use bit-field. (tree_type_common.spare): New. (tree_decl_common.off_align): Make smaller. (tree_decl_common.align): Use bit-field. * expr.c (expand_expr_addr_expr_1): Use SET_TYPE_ALIGN. * omp-low.c (install_var_field): Use SET_DECL_ALIGN. (scan_sharing_clauses): Ditto. (finish_taskreg_scan): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (omp_finish_file): Ditto. * stor-layout.c (do_type_align): Use SET_DECL_ALIGN. (layout_decl): Ditto. (relayout_decl): Ditto. (finalize_record_size): Use SET_TYPE_ALIGN. (finalize_type_size): Ditto. (finish_builtin_struct): Ditto. (layout_type): Ditto. (initialize_sizetypes): Ditto. * targhooks.c (std_gimplify_va_arg_expr): Use SET_TYPE_ALIGN. * tree-nested.c (insert_field_into_struct): Use SET_TYPE_ALIGN. (lookup_field_for_decl): Use SET_DECL_ALIGN. (get_chain_field): Ditto. (get_trampoline_type): Ditto. (get_nl_goto_field): Ditto. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use SET_DECL_ALIGN. (unpack_ts_type_common_value_fields): Use SET_TYPE_ALIGN. * gimple-expr.c (copy_var_decl): Use SET_DECL_ALIGN. * tree.c (make_node_stat): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (build_qualified_type): Use SET_TYPE_ALIGN. (build_aligned_type, build_range_type_1): Ditto. (build_atomic_base): Ditto. (build_common_tree_nodes): Ditto. * cfgexpand.c (align_local_variable): Use SET_DECL_ALIGN. (expand_one_stack_var_at): Ditto. * coverage.c (build_var): Use SET_DECL_ALIGN. * except.c (init_eh): Ditto. * function.c (assign_parm_setup_block): Ditto. * symtab.c (increase_alignment_1): Ditto. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Ditto. * tree-vect-stmts.c (ensure_base_align): Ditto. * varasm.c (align_variable): Ditto. (assemble_variable): Ditto. (build_constant_desc): Ditto. (output_constant_def_contents): Ditto. * config/arm/arm.c (arm_relayout_function): Use SET_DECL_ALIGN. * config/avr/avr.c (avr_adjust_type_node): Use SET_TYPE_ALIGN. * config/mips/mips.c (mips_std_gimplify_va_arg_expr): Ditto. * config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Ditto. * config/spu/spu.c (spu_build_builtin_va_list): Use SET_DECL_ALIGN. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use SET_TYPE_ALIGN. (gnat_to_gnu_field): Ditto. (components_to_record): Ditto. (create_variant_part_from): Ditto. (copy_and_substitute_in_size): Ditto. (substitute_in_type): Ditto. * gcc-interface/utils.c (make_aligning_type): Use SET_TYPE_ALIGN. (make_packable_type): Ditto. (maybe_pad_type): Ditto. (finish_fat_pointer_type): Ditto. (finish_record_type): Ditto and use SET_DECL_ALIGN. (rest_of_record_type_compilation): Use SET_TYPE_ALIGN. (create_field_decl): Use SET_DECL_ALIGN. c-family/ * c-common.c (handle_aligned_attribute): Use SET_TYPE_ALIGN and SET_DECL_ALIGN. c/ * c-decl.c (merge_decls): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (grokdeclarator, parser_xref_tag, finish_enum): Use SET_TYPE_ALIGN. cp/ * class.c (build_vtable): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (layout_class_type): Ditto. (build_base_field): Use SET_DECL_ALIGN. (fixup_attribute_variants): Use SET_TYPE_ALIGN. * decl.c (duplicate_decls): Use SET_DECL_ALIGN. (record_unknown_type): Use SET_TYPE_ALIGN. (cxx_init_decl_processing): Ditto. (copy_type_enum): Ditto. (grokfndecl): Use SET_DECL_ALIGN. (copy_type_enum): Use SET_TYPE_ALIGN. * pt.c (instantiate_class_template_1): Use SET_TYPE_ALIGN. (tsubst): Ditto. * tree.c (cp_build_qualified_type_real): Use SET_TYPE_ALIGN. * lambda.c (maybe_add_lambda_conv_op): Use SET_DECL_ALIGN. * method.c (implicitly_declare_fn): Use SET_DECL_ALIGN. * rtti.c (emit_tinfo_decl): Ditto. fortran/ * trans-io.c (gfc_build_io_library_fndecls): Use SET_TYPE_ALIGN. * trans-common.c (build_common_decl): Use SET_DECL_ALIGN. * trans-types.c (gfc_add_field_to_struct): Use SET_DECL_ALIGN. go/ * go-gcc.cc (Gcc_backend::implicit_variable): Use SET_DECL_ALIGN. java/ * class.c (add_method_1): Use SET_DECL_ALIGN. (make_class_data): Ditto. (emit_register_classes_in_jcr_section): Ditto. * typeck.c (build_java_array_type): Ditto. objc/ * objc-act.c (objc_build_struct): Use SET_DECL_ALIGN. libcc1/ * plugin.cc (plugin_finish_record_or_union): Use SET_TYPE_ALIGN. From-SVN: r235172
2016-04-18 22:36:27 +02:00
SET_DECL_ALIGN (fn, MINIMUM_METHOD_BOUNDARY);
/* Create the explicit arguments. */
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
if (rhs_parm_type)
{
/* Note that this parameter is *not* marked DECL_ARTIFICIAL; we
want its type to be included in the mangled function
name. */
tree decl = cp_build_parm_decl (NULL_TREE, rhs_parm_type);
TREE_READONLY (decl) = 1;
retrofit_lang_decl (decl);
DECL_PARM_INDEX (decl) = DECL_PARM_LEVEL (decl) = 1;
DECL_ARGUMENTS (fn) = decl;
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
}
else if (kind == sfk_inheriting_constructor)
{
tree *p = &DECL_ARGUMENTS (fn);
int index = 1;
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
for (tree parm = inherited_parms; parm && parm != void_list_node;
parm = TREE_CHAIN (parm))
{
*p = cp_build_parm_decl (NULL_TREE, TREE_VALUE (parm));
retrofit_lang_decl (*p);
DECL_PARM_LEVEL (*p) = 1;
DECL_PARM_INDEX (*p) = index++;
DECL_CONTEXT (*p) = fn;
p = &DECL_CHAIN (*p);
}
Implement P0136R1, Rewording inheriting constructors. gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-11-02 02:50:29 +01:00
SET_DECL_INHERITED_CTOR (fn, inherited_ctor);
DECL_NONCONVERTING_P (fn) = DECL_NONCONVERTING_P (inherited_ctor);
/* A constructor so declared has the same access as the corresponding
constructor in X. */
TREE_PRIVATE (fn) = TREE_PRIVATE (inherited_ctor);
TREE_PROTECTED (fn) = TREE_PROTECTED (inherited_ctor);
/* Copy constexpr from the inherited constructor even if the
inheriting constructor doesn't satisfy the requirements. */
constexpr_p = DECL_DECLARED_CONSTEXPR_P (inherited_ctor);
}
2006-06-06 13:44:09 +02:00
/* Add the "this" parameter. */
this_parm = build_this_parm (fn_type, TYPE_UNQUALIFIED);
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
DECL_CHAIN (this_parm) = DECL_ARGUMENTS (fn);
DECL_ARGUMENTS (fn) = this_parm;
grokclassfn (type, fn, kind == sfk_destructor ? DTOR_FLAG : NO_SPECIAL);
cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.def (NEW_EXPR): Add a fourth slot. * cp-tree.h (PARMLIST_ELLIPSIS_P): Remove. (TREE_PARMLIST): Likewise. (CALL_DECLARATOR_PARMS): Likewise. (CALL_DECLARATOR_QUALS): Likewise. (CALL_DECLARATOR_EXCEPTION_SPEC): Likewise. (cp_declarator_kind): New type. (cp_parameter_declarator): Likewise. (cp_declarator): Likewise. (cp_error_declarator): Likewise. (no_parameters): Likewise. (groktypename): Change prototype. (start_decl): Likewise. (start_handler_parms): Likewise. (get_scope_of_declarator): Likewise. (start_function): Likewise. (start_preparsed_function): New function. (start_function): Change prototype. (start_method): Likewise. (grokfield): Likewise. (grokbitfield): Likewise. (build_new): Likewise. (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. (process_template_parm): Change prototype. (begin_function_definition): Remove. (finish_parmlist): Remove. * decl.c (groktypename): Do not use trees to represent declarators. (start_decl): Likewise. (start_handler_parms): Remove. (get_scope_of_declarator): Reimplement. (grokdeclarator): Do not use trees to represent declarators. (grokparms): Likewise. (start_function): Likewise. (start_method): Likewise. (build_void_list_mode): Do not use TREE_PARMLIST. * decl.h (grokdeclarator): Change prototype. * decl2.c (grok_method_quals): Robustify. (grok_x_components): Do not use trees to represent declarators. (grokfield): Likewise. (grokbitfield): Likewise. (start_objects): Build FUNCTION_DECLs, not declarators. (start_static_storage_duration_function): Likewise. * init.c (build_new): Simplify. * lex.c (make_pointer_declarator): Remove. (make_reference_declarator): Likewise. (make_call_declarator): Likewise. (set_quals_and_spec): Likewise. * method.c (use_thunk): Use start_preparsed_function. (synthesize_method): Likewise. (implicitly_declare_fn): Build FUNCTION_DECLs, not declarators. * optimize.c (maybe_clone_body): Use start_preparsed_function. * parser.c (cp_error_declarator): New variable. (declarator_obstack): Likewise. (alloc_declarator): New function. (make_declarator): Likewise. (make_id_declarator): Likewise. (make_pointer_declarator): Likewise. (make_reference_declarator): Likewise. (make_ptrmem_declarator): Likewise. (make_call_declarator): Likewise. (make_array_declarator): Likewise. (no_parameters): New variable. (make_parameter_declarator): Likewise. (cp_parser_check_for_definition_in_return_type): Do not use trees to represent declarators. (cp_parser_translation_unit): Likewise. (cp_parser_new_expression): Likewise. (cp_parser_new_type_id): Likewise. (cp_parser_new_declarator_opt): Likewise. (cp_parser_direct_new_declarator): Likewise. (cp_parser_condition): Likewise. (cp_parser_declaration_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_conversion_type_id): Likewise. (cp_parser_conversion_declarator_opt): Likewise. (cp_parser_template_parameter_list): Likewise. (cp_parser_template_parameter): Likewise. (cp_parser_explicit_instantiation): Likewise. (cp_parser_init_declarator): Likewise. (cp_parser_declarator): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_type_id): Likewise. (cp_parser_parameter_declaration_clause): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_exception_declaration): Likewise. (cp_parser_check_declarator_template_parameters): Likewise. (cp_parser_function_definition_from_specifiers_and_declarator): Likewise. (cp_parser_save_member_function_body): Likewise. * pt.c (process_template_parm): Add is_non_type parameter. (convert_template_argument): Adjust call to groktypename. (tsubst_call_declarator_parms): Remove use of TREE_PARMLIST. (tsubst): Do not expect declarators. (tsubst_copy_and_build): Adjust NEW_EXPR case to handle additional argument. (instantiate_decl): Use start_preparsed_function. * semantics.c (begin_function_definition): Remove. (finish_parmlist): Remove. * cp-mudflap.c (mflang_flush_calls): Build FUNCTION_DECLs, not declarators. From-SVN: r83482
2004-06-22 09:18:38 +02:00
DECL_IN_AGGR_P (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
DECL_DEFAULTED_FN (fn) = 1;
c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x. * c-cppbuiltin.c (c_cpp_builtins): Likewise. * c-opts.c (c_common_post_options): Likewise. cp/ 2013-06-22 Gabriel Dos Reis <gdr@integrable-solutions.net> * call.c (null_ptr_cst_p): Use cxx11 in lieu of cxx0x. * class.c (add_implicitly_declared_members): Likewise. (check_field_decl): Likewise. (finalize_literal_type_property): Likewise. (check_bases_and_members): Likewise. * decl.c (poplevel): Likewise. (case_conversion): Likewise. (check_initializer): Likewise. (grokfndecl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (grokdeclarator): Likewise. (build_enumerator): Likewise. * friend.c (make_friend_class): Likewise. * lex.c (init_reswords): Likewise. * method.c (synthesized_method_walk): Likewise. (implicitly_declare_fn): Likewise. * parser.c (cp_parser_diagnose_invalid_type_name): Likewise. (cp_parser_constant_expression): Likewise. (cp_parser_for_init_statement): Likewise. (cp_parser_block_declaration): Likewise. (cp_parser_type_name): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_member_declaration): Likewise. (cp_nth_tokens_can_be_std_attribute_p): Likewise. (cp_parser_template_declaration_after_export): Likewise. * pt.c (convert_nontype_argument_function): Likewise. (convert_nontype_argument): Likewise. (convert_template_argument): Likewise. (tsubst_copy_and_build): Likewise. (build_non_dependent_expr): Likewise. * semantics.c (non_const_var_error): Likewise. (potential_constant_expression_1): Likewise. * tree.c (lvalue_kind): Likewise. (build_vec_init_expr): Likewise. (cast_valid_in_integral_constant_expression_p): Likewise. * typeck.c (build_x_conditional_expr): Likewise. * typeck2.c (check_narrowing): Likewise. From-SVN: r200348
2013-06-23 04:27:03 +02:00
if (cxx_dialect >= cxx11)
{
DECL_DELETED_FN (fn) = deleted_p;
DECL_DECLARED_CONSTEXPR_P (fn) = constexpr_p;
}
DECL_EXTERNAL (fn) = true;
DECL_NOT_REALLY_EXTERN (fn) = 1;
DECL_DECLARED_INLINE_P (fn) = 1;
set_linkage_according_to_type (type, fn);
if (TREE_PUBLIC (fn))
DECL_COMDAT (fn) = 1;
rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);
call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. * call.c (check_dtor_name): Replace abort with gcc_assert or gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. From-SVN: r86778
2004-08-30 17:28:48 +02:00
gcc_assert (!TREE_USED (fn));
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
Add C++ Concepts TS support. gcc/c-family/ * c-common.c (c_common_reswords): Add __is_same_as, concept, requires. * c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES. (D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts. * c-opts.c (set_std_cxx1z): Set flag_concepts. * c.opt (fconcepts): New. gcc/cp/ * constraint.cc, logic.cc: New files. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o. (c++.tags): Also process .cc files. * call.c (enum rejection_reason_code): Add rr_constraint_failure. (print_z_candidate): Handle it. (constraint_failure): New. (add_function_candidate): Check constraints. (build_new_function_call): Handle evaluating concepts. (joust): Check more_constrained. * class.c (add_method): Check equivalently_constrained. (build_clone): Copy constraints. (currently_open_class): Return tree. (resolve_address_of_overloaded_function): Check constraints. * constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR. (potential_constant_expression_1): Likewise. * cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO. (cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR. * cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR, SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR, EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR, EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR. * cp-tree.h (struct tree_constraint_info, check_nonnull) (check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS) (CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS) (CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS) (TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P) (PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR) (TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE) (DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN) (DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS) (PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT) (CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE) (DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated) (struct local_specialization_stack, enum auto_deduction_context) (variable_concept_p, concept_template_p) (struct deferring_access_check_sentinel): New. (enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO. (union lang_tree_node): Add constraint_info field. (struct lang_decl_base): Add concept_p flag. (enum cp_decl_spec): Add ds_concept. (struct cp_declarator): Add requires_clause. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Handle REQUIRES_EXPR, TRAIT_EXPR, *_CONSTR. (pp_cxx_parameter_declaration_clause): Accept a chain of PARM_DECLs. (cxx_pretty_printer::declarator): Print requires-clause. (pp_cxx_template_declaration): Likewise. (pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS. (pp_cxx_requires_clause, pp_cxx_requirement) (pp_cxx_requirement_list, pp_cxx_requirement_body) (pp_cxx_requires_expr, pp_cxx_simple_requirement) (pp_cxx_type_requirement, pp_cxx_compound_requirement) (pp_cxx_nested_requirement, pp_cxx_predicate_constraint) (pp_cxx_expression_constraint, pp_cxx_type_constraint) (pp_cxx_implicit_conversion_constraint) (pp_cxx_argument_deduction_constraint) (pp_cxx_exception_constraint, pp_cxx_parameterized_constraint) (pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New. * cxx-pretty-print.h: Declare them. * decl.c (decls_match): Compare constraints. (duplicate_decls): Likewise. Remove constraints before freeing. (cxx_init_decl_processing): Call init_constraint_processing. (cp_finish_decl): Diagnose concept without initializer. (grokfndecl, grokvardecl): Handle concepts and constraints. (grokdeclarator): Handle concept, requires-clause. (grokparms): No longer static. (xref_tag_1): Check constraints. (finish_function): Call check_function_concept. (cp_tree_node_structure): Handle CONSTRAINT_INFO. (check_concept_refinement, is_concept_var, check_concept_fn): New. * decl2.c (check_classfn): Compare constraints. (mark_used): Don't instantiate concepts. * error.c (dump_template_decl): Print constraints. (dump_function_decl): Likewise. (dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR. * lex.c (init_reswords): Set D_CXX_CONCEPTS. * method.c (implicitly_declare_fn): Copy constraints from inherited ctor. * parser.h (struct cp_parser): Add in_result_type_constraint_p and prevent_constrained_type_specifiers fields. * parser.c (make_call_declarator): Add requires_clause parm. (cp_parser_new): Clear prevent_constrained_type_specifiers. (cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES. (cp_parser_postfix_expression): Set prevent_constrained_type_specifiers. (cp_parser_trait_expr): Handle RID_IS_SAME_AS. (cp_parser_declaration): Handle concept introduction. (cp_parser_member_declaration): Likewise. (cp_parser_template_parameter): Handle constrained parameter. (cp_parser_type_parameter): Handle constraints. (cp_parser_decl_specifier_seq): Handle RID_CONCEPT. (cp_parser_template_id): Handle partial concept id. (cp_parser_type_name): Add overload that takes typename_keyword_p. Handle constrained parameter. (cp_parser_nonclass_name): Handle concept names. (cp_parser_alias_declaration): Handle constraints. (cp_parser_late_return_type_opt): Also handle requires-clause. (cp_parser_type_id_1): Handle deduction constraint. (cp_parser_parameter_declaration): Handle constrained parameters. (cp_parser_class_specifier_1): Handle constraints. (cp_parser_template_declaration_after_parameters): Split out from cp_parser_template_declaration_after_export. (cp_parser_single_declaration): Handle constraints. (synthesize_implicit_template_parm): Handle constraints. (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_introduction_list, get_id_declarator) (get_unqualified_id, is_constrained_parameter) (cp_parser_check_constrained_type_parm) (cp_parser_constrained_type_template_parm) (cp_parser_constrained_template_template_parm) (constrained_non_type_template_parm, finish_constrained_parameter) (declares_constrained_type_template_parameter) (declares_constrained_template_template_parameter) (check_type_concept, cp_parser_maybe_constrained_type_specifier) (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_requires_clause, cp_parser_requires_clause_opt) (cp_parser_requires_expression) (cp_parser_requirement_parameter_list, cp_parser_requirement_body) (cp_parser_requirement_list, cp_parser_requirement) (cp_parser_simple_requirement, cp_parser_type_requirement) (cp_parser_compound_requirement, cp_parser_nested_requirement) (cp_parser_template_introduction) (cp_parser_explicit_template_declaration) (get_concept_from_constraint): New. * pt.c (local_specialization_stack): Implement. (maybe_new_partial_specialization): New. (maybe_process_partial_specialization): Use it. (retrieve_local_specialization, register_local_specialization) (template_parm_to_arg, build_template_decl, extract_fnparm_pack) (tsubst_expr): No longer static. (spec_hasher::equal): Compare constraints. (determine_specialization): Handle constraints. (check_explicit_specialization): Handle concepts. (process_template_parm): Handle constraints. (end_template_parm_list): Add overload taking no arguments. (process_partial_specialization): Handle concepts and constraints. Register partial specializations of variable templates. (redeclare_class_template): Handle constraints. (convert_template_argument): Handle WILDCARD_DECL. Check is_compatible_template_arg. (coerce_template_parameter_pack): Handle wildcard packs. (coerce_template_parms): DR 1430 also applies to concepts. Add overloads taking fewer parameters. (lookup_template_class_1): Handle constraints. (lookup_template_variable): Concepts are always bool. (finish_template_variable): Handle concepts and constraints. (tsubst_friend_class): Handle constraints. (gen_elem_of_pack_expansion_instantiation): Handle constraints. (tsubst_pack_expansion): Handle local parameters. (tsubst_decl) [FUNCTION_DECL]: Handle constraints. (tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints. (tsubst_copy_and_build): Handle REQUIRES_EXPR. (more_specialized_fn, more_specialized_partial_spec): Check constraints. (more_specialized_inst): Split out from most_specialized_instantiation. (most_specialized_partial_spec): Check constraints. (instantiate_decl): Never instantiate a concept. (value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ, variable concepts. (type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR. (instantiation_dependent_r): Handle REQUIRES_EXPR and concepts. (do_auto_deduction): Add overload taking tsubst flags and context enum. Handle constraints. (get_template_for_ordering, most_constrained_function) (is_compatible_template_arg, convert_wildcard_argument) (struct constr_entry, struct constr_hasher, decl_constraints) (valid_constraints_p, get_constraints, set_constraints) (remove_constraints, init_constraint_processing): New. * ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO. * search.c (lookup_member): Do lookup in the open partial instantiation. * semantics.c (finish_template_template_parm): Handle constraints. (fixup_template_type): New. (finish_template_type): Call it. (trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS. * tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO. (cp_walk_subtrees): Handle REQUIRES_EXPR. * typeck.c (cp_build_function_call_vec): Check constraints. Co-Authored-By: Braden Obrzut <admin@maniacsvault.net> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r226713
2015-08-07 07:44:49 +02:00
/* Propagate constraints from the inherited constructor. */
if (flag_concepts && inherited_ctor)
if (tree orig_ci = get_constraints (inherited_ctor))
{
tree new_ci = copy_node (orig_ci);
set_constraints (fn, new_ci);
}
/* Restore PROCESSING_TEMPLATE_DECL. */
processing_template_decl = saved_processing_template_decl;
if (inherited_ctor && TREE_CODE (inherited_ctor) == TEMPLATE_DECL)
fn = add_inherited_template_parms (fn, inherited_ctor);
/* Warn about calling a non-trivial move assignment in a virtual base. */
if (kind == sfk_move_assignment && !deleted_p && !trivial_p
&& CLASSTYPE_VBASECLASSES (type))
{
location_t loc = input_location;
input_location = DECL_SOURCE_LOCATION (fn);
synthesized_method_walk (type, kind, const_p,
NULL, NULL, NULL, NULL, true,
NULL_TREE, NULL_TREE);
input_location = loc;
}
return fn;
}
Do put the VTT parameter in DECL_ARGUMENTS. * cp-tree.h (struct cp_language_function): Add x_vtt_parm. (current_vtt_parm): New macro. (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm. (DECL_HAS_VTT_PARM_P): New macro. (DECL_VTT_PARM): Remove. (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros. * decl.c (duplicate_decls): Only copy the operator code if appropriate. (start_function): Set current_vtt_parm. (lang_mark_tree): Don't mark vtt_parm. * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P. * class.c (build_clone): Maybe remove the VTT parm. * optimize.c (maybe_clone_body): Set up the VTT parm. * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm. * call.c (build_over_call): Just allow the VTT arg. * method.c (make_thunk): Don't set DECL_VTT_PARM. (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM. (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE. * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise. * error.c (dump_function_decl): Likewise. * call.c (build_user_type_conversion_1, convert_like_real): Abort if we try to call a constructor with in-charge or VTT parms. * method.c (skip_artificial_parms_for): New fn. * call.c (add_function_candidate, build_over_call): Call it. * call.c (build_new_method_call): Use current_vtt_parm. * init.c (expand_virtual_init): Likewise. * class.c (same_signature_p): No longer static. * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. From-SVN: r39841
2001-02-18 20:08:00 +01:00
/* Gives any errors about defaulted functions which need to be deferred
until the containing class is complete. */
void
defaulted_late_check (tree fn)
{
/* Complain about invalid signature for defaulted fn. */
tree ctx = DECL_CONTEXT (fn);
special_function_kind kind = special_function_p (fn);
bool fn_const_p = (copy_fn_p (fn) == 2);
tree implicit_fn = implicitly_declare_fn (kind, ctx, fn_const_p,
NULL, NULL);
tree eh_spec = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (implicit_fn));
if (!same_type_p (TREE_TYPE (TREE_TYPE (fn)),
TREE_TYPE (TREE_TYPE (implicit_fn)))
|| !compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
TYPE_ARG_TYPES (TREE_TYPE (implicit_fn))))
{
error ("defaulted declaration %q+D", fn);
error_at (DECL_SOURCE_LOCATION (fn),
"does not match expected signature %qD", implicit_fn);
}
/* 8.4.2/2: An explicitly-defaulted function (...) may have an explicit
exception-specification only if it is compatible (15.4) with the
exception-specification on the implicit declaration. If a function
is explicitly defaulted on its first declaration, (...) it is
implicitly considered to have the same exception-specification as if
it had been implicitly declared. */
maybe_instantiate_noexcept (fn);
tree fn_spec = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
if (!fn_spec)
{
if (DECL_DEFAULTED_IN_CLASS_P (fn))
TREE_TYPE (fn) = build_exception_variant (TREE_TYPE (fn), eh_spec);
}
else if (UNEVALUATED_NOEXCEPT_SPEC_P (fn_spec))
/* Equivalent to the implicit spec. */;
else if (DECL_DEFAULTED_IN_CLASS_P (fn)
&& !CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
/* We can't compare an explicit exception-specification on a
constructor defaulted in the class body to the implicit
exception-specification until after we've parsed any NSDMI; see
after_nsdmi_defaulted_late_checks. */;
else
{
tree eh_spec = get_defaulted_eh_spec (fn);
if (!comp_except_specs (fn_spec, eh_spec, ce_normal))
{
if (DECL_DEFAULTED_IN_CLASS_P (fn))
DECL_DELETED_FN (fn) = true;
else
error ("function %q+D defaulted on its redeclaration "
"with an exception-specification that differs from "
"the implicit exception-specification %qX", fn, eh_spec);
}
}
if (DECL_DEFAULTED_IN_CLASS_P (fn)
&& DECL_DECLARED_CONSTEXPR_P (implicit_fn))
{
/* Hmm...should we do this for out-of-class too? Should it be OK to
add constexpr later like inline, rather than requiring
declarations to match? */
DECL_DECLARED_CONSTEXPR_P (fn) = true;
if (kind == sfk_constructor)
TYPE_HAS_CONSTEXPR_CTOR (ctx) = true;
}
if (!DECL_DECLARED_CONSTEXPR_P (implicit_fn)
&& DECL_DECLARED_CONSTEXPR_P (fn))
{
if (!CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
{
error ("explicitly defaulted function %q+D cannot be declared "
"as constexpr because the implicit declaration is not "
"constexpr:", fn);
explain_implicit_non_constexpr (fn);
}
DECL_DECLARED_CONSTEXPR_P (fn) = false;
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (DECL_DELETED_FN (implicit_fn))
DECL_DELETED_FN (fn) = 1;
}
/* OK, we've parsed the NSDMI for class T, now we can check any explicit
exception-specifications on functions defaulted in the class body. */
void
after_nsdmi_defaulted_late_checks (tree t)
{
if (uses_template_parms (t))
return;
if (t == error_mark_node)
return;
for (tree fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn))
if (!DECL_ARTIFICIAL (fn) && DECL_DEFAULTED_IN_CLASS_P (fn))
{
tree fn_spec = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn));
if (UNEVALUATED_NOEXCEPT_SPEC_P (fn_spec))
continue;
tree eh_spec = get_defaulted_eh_spec (fn);
if (!comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)),
eh_spec, ce_normal))
DECL_DELETED_FN (fn) = true;
}
}
/* Returns true iff FN can be explicitly defaulted, and gives any
errors if defaulting FN is ill-formed. */
bool
defaultable_fn_check (tree fn)
{
special_function_kind kind = sfk_none;
if (template_parm_scope_p ())
{
error ("a template cannot be defaulted");
return false;
}
if (DECL_CONSTRUCTOR_P (fn))
{
if (FUNCTION_FIRST_USER_PARMTYPE (fn) == void_list_node)
kind = sfk_constructor;
else if (copy_fn_p (fn) > 0
&& (TREE_CHAIN (FUNCTION_FIRST_USER_PARMTYPE (fn))
== void_list_node))
kind = sfk_copy_constructor;
else if (move_fn_p (fn))
kind = sfk_move_constructor;
}
else if (DECL_DESTRUCTOR_P (fn))
kind = sfk_destructor;
else if (DECL_ASSIGNMENT_OPERATOR_P (fn)
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
&& DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR)
{
if (copy_fn_p (fn))
kind = sfk_copy_assignment;
else if (move_fn_p (fn))
kind = sfk_move_assignment;
}
if (kind == sfk_none)
{
error ("%qD cannot be defaulted", fn);
return false;
}
else
{
for (tree t = FUNCTION_FIRST_USER_PARMTYPE (fn);
t && t != void_list_node; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t))
{
error ("defaulted function %q+D with default argument", fn);
break;
}
/* Avoid do_warn_unused_parameter warnings. */
for (tree p = FUNCTION_FIRST_USER_PARM (fn); p; p = DECL_CHAIN (p))
if (DECL_NAME (p))
TREE_NO_WARNING (p) = 1;
if (TYPE_BEING_DEFINED (DECL_CONTEXT (fn)))
/* Defer checking. */;
else if (!processing_template_decl)
defaulted_late_check (fn);
return true;
}
}
/* Add an implicit declaration to TYPE for the kind of function
indicated by SFK. Return the FUNCTION_DECL for the new implicit
declaration. */
tree
lazily_declare_fn (special_function_kind sfk, tree type)
{
tree fn;
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* Whether or not the argument has a const reference type. */
bool const_p = false;
type = TYPE_MAIN_VARIANT (type);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
switch (sfk)
{
case sfk_constructor:
CLASSTYPE_LAZY_DEFAULT_CTOR (type) = 0;
break;
case sfk_copy_constructor:
const_p = TYPE_HAS_CONST_COPY_CTOR (type);
CLASSTYPE_LAZY_COPY_CTOR (type) = 0;
break;
case sfk_move_constructor:
CLASSTYPE_LAZY_MOVE_CTOR (type) = 0;
break;
case sfk_copy_assignment:
const_p = TYPE_HAS_CONST_COPY_ASSIGN (type);
CLASSTYPE_LAZY_COPY_ASSIGN (type) = 0;
break;
case sfk_move_assignment:
CLASSTYPE_LAZY_MOVE_ASSIGN (type) = 0;
break;
case sfk_destructor:
CLASSTYPE_LAZY_DESTRUCTOR (type) = 0;
break;
default:
gcc_unreachable ();
}
/* Declare the function. */
fn = implicitly_declare_fn (sfk, type, const_p, NULL, NULL);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* [class.copy]/8 If the class definition declares a move constructor or
move assignment operator, the implicitly declared copy constructor is
defined as deleted.... */
if ((sfk == sfk_copy_assignment
|| sfk == sfk_copy_constructor)
&& (type_has_user_declared_move_constructor (type)
|| type_has_user_declared_move_assign (type)))
DECL_DELETED_FN (fn) = true;
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
/* A destructor may be virtual. */
if (sfk == sfk_destructor
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
|| sfk == sfk_move_assignment
|| sfk == sfk_copy_assignment)
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
check_for_override (fn, type);
/* Add it to CLASSTYPE_METHOD_VEC. */
add_method (type, fn, NULL_TREE);
/* Add it to TYPE_METHODS. */
if (sfk == sfk_destructor
&& DECL_VIRTUAL_P (fn))
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
/* The ABI requires that a virtual destructor go at the end of the
vtable. */
TYPE_METHODS (type) = chainon (TYPE_METHODS (type), fn);
else
{
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
DECL_CHAIN (fn) = TYPE_METHODS (type);
re PR c++/19733 (ICE on invalid destructor call) PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759
2005-02-09 03:53:41 +01:00
TYPE_METHODS (type) = fn;
}
maybe_add_class_template_decl_list (type, fn, /*friend_p=*/0);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
|| DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
/* Create appropriate clones. */
clone_function_decl (fn, /*update_method_vec=*/true);
return fn;
}
Do put the VTT parameter in DECL_ARGUMENTS. * cp-tree.h (struct cp_language_function): Add x_vtt_parm. (current_vtt_parm): New macro. (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm. (DECL_HAS_VTT_PARM_P): New macro. (DECL_VTT_PARM): Remove. (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros. * decl.c (duplicate_decls): Only copy the operator code if appropriate. (start_function): Set current_vtt_parm. (lang_mark_tree): Don't mark vtt_parm. * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P. * class.c (build_clone): Maybe remove the VTT parm. * optimize.c (maybe_clone_body): Set up the VTT parm. * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm. * call.c (build_over_call): Just allow the VTT arg. * method.c (make_thunk): Don't set DECL_VTT_PARM. (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM. (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE. * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise. * error.c (dump_function_decl): Likewise. * call.c (build_user_type_conversion_1, convert_like_real): Abort if we try to call a constructor with in-charge or VTT parms. * method.c (skip_artificial_parms_for): New fn. * call.c (add_function_candidate, build_over_call): Call it. * call.c (build_new_method_call): Use current_vtt_parm. * init.c (expand_virtual_init): Likewise. * class.c (same_signature_p): No longer static. * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. From-SVN: r39841
2001-02-18 20:08:00 +01:00
/* Given a FUNCTION_DECL FN and a chain LIST, skip as many elements of LIST
as there are artificial parms in FN. */
tree
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
skip_artificial_parms_for (const_tree fn, tree list)
Do put the VTT parameter in DECL_ARGUMENTS. * cp-tree.h (struct cp_language_function): Add x_vtt_parm. (current_vtt_parm): New macro. (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm. (DECL_HAS_VTT_PARM_P): New macro. (DECL_VTT_PARM): Remove. (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros. * decl.c (duplicate_decls): Only copy the operator code if appropriate. (start_function): Set current_vtt_parm. (lang_mark_tree): Don't mark vtt_parm. * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P. * class.c (build_clone): Maybe remove the VTT parm. * optimize.c (maybe_clone_body): Set up the VTT parm. * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm. * call.c (build_over_call): Just allow the VTT arg. * method.c (make_thunk): Don't set DECL_VTT_PARM. (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM. (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE. * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise. * error.c (dump_function_decl): Likewise. * call.c (build_user_type_conversion_1, convert_like_real): Abort if we try to call a constructor with in-charge or VTT parms. * method.c (skip_artificial_parms_for): New fn. * call.c (add_function_candidate, build_over_call): Call it. * call.c (build_new_method_call): Use current_vtt_parm. * init.c (expand_virtual_init): Likewise. * class.c (same_signature_p): No longer static. * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. From-SVN: r39841
2001-02-18 20:08:00 +01:00
{
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
list = TREE_CHAIN (list);
else
return list;
if (DECL_HAS_IN_CHARGE_PARM_P (fn))
list = TREE_CHAIN (list);
if (DECL_HAS_VTT_PARM_P (fn))
list = TREE_CHAIN (list);
return list;
}
builtins.c (fold_builtin_call_list, [...]): Delete, and replace with... 2007-02-28 Sandra Loosemore <sandra@codesourcery.com> * gcc/builtins.c (fold_builtin_call_list, fold_builtin_call_valist): Delete, and replace with... (fold_builtin_call_array): This. Update callers to use it. * gcc/fold-const.c (fold_build_call_list): Delete, and replace with... (fold_build_call_array): This. (fold_build_call_list_initializer): Delete, and replace with... (fold_build_call_array_initializer): This. * gcc/tree.h: Update declarations to reflect above changes. * gcc/c-typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/c-format.c: (check_function_format): Pass arguments in an array instead of a list. * gcc/c-common.c (check_function_nonnull): Likewise. (check_function_sentinel): Likewise. (check_function_arguments): Likewise. * gcc/c-common.h: Update declarations to reflect above changes. * gcc/cp/typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/cp/call.c (build_call): Delete, and replace with... (build_call_n, build_call_a): New. (build_op_delete_call): Rewrite to avoid constructing argument lists. (build_over_call): Store converted arguments in a stack-allocated array instead of building a list. (build_cxx_call): Pass arguments in an array instead of as a list. (build_java_interface_fn_ref): Rewrite to avoid constructing argument lists. * gcc/cp/tree.h: Update declarations to reflect above changes. * gcc/cp/method.c (use_thunk): Use a stack-allocated array to hold the arguments instead of a list. * gcc/cp/rtti.c (throw_bad_cast): Update call to cxx_call. (throw_bad_typeid): Likewise. (build_dynamic_cast_1): Likewise. * gcc/cp/init.c (build_builtin_delete_call): Use build_call_n. * gcc/cp/decl.c (expand_static_init): Likewise. * gcc/cp/except.c (cp_protect_cleanup_actions): Likewise. * gcc/cp/cp-gimplify.c (genericize_eh_spec_block): Likewise. (gimplify_must_not_throw_expr): Likewise. (cxx_omp_apply_fn): Use build_call_a. From-SVN: r122411
2007-02-28 20:21:20 +01:00
/* Given a FUNCTION_DECL FN and a chain LIST, return the number of
artificial parms in FN. */
int
c-common.c (vector_types_convertible_p, [...]): Constify. * c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-25 17:10:40 +02:00
num_artificial_parms_for (const_tree fn)
builtins.c (fold_builtin_call_list, [...]): Delete, and replace with... 2007-02-28 Sandra Loosemore <sandra@codesourcery.com> * gcc/builtins.c (fold_builtin_call_list, fold_builtin_call_valist): Delete, and replace with... (fold_builtin_call_array): This. Update callers to use it. * gcc/fold-const.c (fold_build_call_list): Delete, and replace with... (fold_build_call_array): This. (fold_build_call_list_initializer): Delete, and replace with... (fold_build_call_array_initializer): This. * gcc/tree.h: Update declarations to reflect above changes. * gcc/c-typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/c-format.c: (check_function_format): Pass arguments in an array instead of a list. * gcc/c-common.c (check_function_nonnull): Likewise. (check_function_sentinel): Likewise. (check_function_arguments): Likewise. * gcc/c-common.h: Update declarations to reflect above changes. * gcc/cp/typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/cp/call.c (build_call): Delete, and replace with... (build_call_n, build_call_a): New. (build_op_delete_call): Rewrite to avoid constructing argument lists. (build_over_call): Store converted arguments in a stack-allocated array instead of building a list. (build_cxx_call): Pass arguments in an array instead of as a list. (build_java_interface_fn_ref): Rewrite to avoid constructing argument lists. * gcc/cp/tree.h: Update declarations to reflect above changes. * gcc/cp/method.c (use_thunk): Use a stack-allocated array to hold the arguments instead of a list. * gcc/cp/rtti.c (throw_bad_cast): Update call to cxx_call. (throw_bad_typeid): Likewise. (build_dynamic_cast_1): Likewise. * gcc/cp/init.c (build_builtin_delete_call): Use build_call_n. * gcc/cp/decl.c (expand_static_init): Likewise. * gcc/cp/except.c (cp_protect_cleanup_actions): Likewise. * gcc/cp/cp-gimplify.c (genericize_eh_spec_block): Likewise. (gimplify_must_not_throw_expr): Likewise. (cxx_omp_apply_fn): Use build_call_a. From-SVN: r122411
2007-02-28 20:21:20 +01:00
{
int count = 0;
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
count++;
else
return 0;
if (DECL_HAS_IN_CHARGE_PARM_P (fn))
count++;
if (DECL_HAS_VTT_PARM_P (fn))
count++;
return count;
}
#include "gt-cp-method.h"