* parser.c (cp_parser_postfix_expression): Allow non-constant
expressions as arguments to __builtin_constant_p.
* tree.c (builtin_valid_in_constant_expr_p): Use
- DECL_IS_BUILTIN_CONSTANT_P.
+ DECL_IS_BUILTIN_CONSTANT_P.
2005-06-03 Mark Mitchell <mark@codesourcery.com>
Mike Stump <mrs@apple.com>
Yet more Objective-C++...
-
+
* cp-objcp-common.h (cxx_get_alias_set): Move from
here...
(cxx_warn_unused_global_decl): Likewise.
* typeck.c (build_unary_op): Do not resort to address arithmetic
when taking the address of a COMPONENT_REF.
-
+
2005-05-08 Kazu Hirata <kazu@cs.umass.edu>
* class.c (vtbl_init_data_s): Change the type of fns to
* decl2.c (check_classfn): Adjust.
* init.c (sort_mem_initializers, push_base_cleanups): Adjust.
* method.c (do_build_copy_constructor): Adjust.
- * name-lookup.c (new_class_binding, store_binding,
+ * name-lookup.c (new_class_binding, store_binding,
store_bindings, store_class_bindings): Adjust.
* name-lookup.h: Define VEC(cxx_saved_binding,gc),
VEC(cp_class_binding,gc).
* typeck.c (cxx_sizeof_or_alignof_type): Check whether the type to
which sizeof/alignof is dependent, rather than just whether we are
processing_template_decl.
-
+
2005-04-17 Kazu Hirata <kazu@cs.umass.edu>
* cp-tree.h (LOOKUP_GLOBAL): Remove.
* decl2.c (determine_visibility): Don't use export_class_data.
(import_export_decl): Honor TARGET_CXX_CLASS_DATA_ALWAYS_WEAK and
- TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY.
+ TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY.
2005-04-09 Kazu Hirata <kazu@cs.umass.edu>
(cp_parser_type_specifier_seq): In a condition, do not allow
invalid type-specifier combinations.
(cp_parser_exception_declaration): Adjust call to
- cp_parser_type_specifier_seq.
+ cp_parser_type_specifier_seq.
* cp-tree.def (TINST_LEVEL): Document TINST_IN_SYSTEM_HEADER_P.
* cp-tree.h (struct tinst_level): Add in_system_header_p.
(lookup_template_class, instantiate_class_template): Adjust call
to pushtag.
* semantics.c (begin_class_definition): Likewise.
- * rtti.c (init_rtti_processing, build_dynamic_cast_1,
+ * rtti.c (init_rtti_processing, build_dynamic_cast_1,
tinfo_base_init, emit_support_tinfos): Use ts_current instead of
ts_global.
2005-03-13 Mark Mitchell <mark@codesourcery.com>
PR c++/20157
- * pt.c (determine_specialization): Reject non-specializations.
+ * pt.c (determine_specialization): Reject non-specializations.
2005-03-11 Per Bothner <per@bothner.com>
2005-03-09 Paolo Carlini <pcarlini@suse.de>
- PR c++/16859
+ PR c++/16859
* decl.c (complete_array_type): In pedantic mode, return
3 for an empty initializer list as the initializer for an
array of unknown bound (8.5.1/4).
(cp_finish_decl): Remove dead code.
* init.c (build_vec_init): When determining whether or not the
element type has an asignment operator, look through all array
- dimensions.
+ dimensions.
* typeck.c (target_type): Remove.
2005-03-07 Mark Mitchell <mark@codesourcery.com>
PR c++/20232
* class.c (update_vtable_entry_for_fn): Don't crash on invalid
- covariancy.
+ covariancy.
* cp-tree.g (THUNK_TARGET): Expand comment.
* method.c (use_thunk): Make sure we also use the target, if that
PR c++/20152
* parser.c (cp_parser_class_head): Check for redefintions here.
* semantics.c (begin_class_definition): Not here.
-
+
PR c++/20153
* decl2.c (build_anon_union_vars): Add type parameter.
(finish_anon_union): Pass it.
* parser.c (cp_parser_direct_declarator): Always complain about
non-constant array bounds when in a function scope.
* semantics.c (finish_id_expression): Do not mark dependent names
- as non-constant.
+ as non-constant.
2005-02-21 Douglas Gregor <dgregor@cs.indiana.edu>
-
+
PR c++/19076
PR c++/6628
* cp-tree.h (cp_apply_type_quals_to_decl): Declared.
* decl.c (grokdeclarator): Pedwarn about qualifying a function
- type.
+ type.
Add qualifiers when declaring a typedef of a function type.
Member function pointers pick up the qualifiers of the typedef
used to declare them.
(start_preparsed_function): Use cp_apply_type_quals_to_decl.
(grokclassfn): Use cp_apply_type_quals_to_decl.
* error.c (dump_type_suffix): Print qualifiers for function
- types.
+ types.
* pt.c (tsubst_decl): Use cp_apply_type_quals_to_decl.
(tsubst): When substituting a function type into a member
pointer type, pass along the qualifiers.
push_c_function_context.
(pop_cp_function_context): Similarly.
(finish_function): Reverse order of poplevel and pop_nested_class so
- that current_class_decl is restored properly.
+ that current_class_decl is restored properly.
(start_function): Likewise.
(finish_function): Add parameter 'nested'. Don't call
permanent_allocation if (nested).
(determine_primary_base): ... this. Simplify.
(create_vtable_ptr): Tweak accordingly.
(finish_struct_1): Simplify.
-
+
* cp-tree.h (CLASSTYPE_VBASECLASSES): Update documentation.
(CLASSTYPE_N_BASECLASSES): Likewise.
(BINFO_FOR_VBASE): New macro.
(get_vbase_types): Don't return a value. Set
CLASSTYPE_VBASECLASSES here.
* typeck.c (get_delta_difference): Use BINFO_FOR_VBASE.
-
+
1999-12-30 Mark Mitchell <mark@codesourcery.com>
* class.c (fixup_inline_methods): Clear CLASSTYPE_INLINE_FRIENDS.
(fixup_inline_methods): New function.
* method.c (fixup_pending_inline): Remove.
(do_inline_function_hair): Likewise.
-
+
* decl.c (BOOL_TYPE_SIZE): Bools always have size `1' under the
new ABI.
-
+
* cp-tree.h (lang_type): Replace abstract_virtuals with pure_virtuals.
(CLASSTYPE_ABSTRACT_VIRTUALS): Rename to ...
(CLASSTYPE_PURE_VIRTUALS): ... this.
* typeck2.c (abstract_virtuals_error): Likewise.
* xref.c (GNU_xref_member): Likewise.
* search.c (get_abstract_virtuals): Rename to get_pure_virtuals.
-
+
1999-12-26 Zack Weinberg <zack@wolery.cumb.org>
* cp-tree.h: Replace ENABLE_CHECKING with ENABLE_TREE_CHECKING
DECL_RESULT, not the mode of DECL_RESULT itself.
* semantics.c (finish_named_return_value): Set DECL_UNINLINABLE
for functions that used named return values.
-
+
1999-12-24 Mark Mitchell <mark@codesourcery.com>
* semantics.c (expand_body): Use
the first field in the class.
* tree.c (layout_basetypes): Use CLASSTYPE_N_BASECLASSES. Handle
seeing TYPE_VFIELD as the first field in the class.
-
+
* cp-tree.h (TYPE_VIRTUAL_P): Rename to ...
(TYPE_POLYMORPHIC_P): ... this.
(TYPE_USES_COMPLEX_INHERITANCE): Rename to ...
* typeck.c (build_component_ref): Likewise.
(build_component_addr): Likewise.
* typeck2.c (process_init_constructor): Likewise.
-
+
1999-12-20 Nathan Sidwell <nathan@acm.org>
* typeck.c (strip_all_pointer_quals): New static function.
(avoid_overlap): Moved here from tree.c.
(build_base_fields): Likewise.
(check_bases): New function, split out from finish_base_struct.
- (check_bases_and_members): New function, split out from
+ (check_bases_and_members): New function, split out from
finish_struct_1.
(struct base_info): Remove cant_have_default_ctor,
cant_have_const_ctor, cant_have_asn_ref.
(build_base_fields): Don't declare.
* tree.c (avoid_overlap): Remove.
(build_base_fields): Likewise.
-
+
* optimize.c (struct inline_data): Remove scope_stmt.
(remap_block): Don't use insert_block_after_note. Don't update
scope_stmt.
* method.c (fixup_pending_inline): New function, split out from ...
(do_inline_function_hair): ... here.
* tree.c (build_vbase_pointer_fields): Remove.
-
+
1999-12-15 Jason Merrill <jason@casey.cygnus.com>
* tree.c (walk_tree): Walk operand subtrees in forward order.
(expand_body): Use it.
* tree.c (walk_tree): Special-case TARGET_EXPRs since they
sometimes present the same sub-tree twice.
-
+
* dump.c (dequeue_and_dump): Abbreviate `class' as `cls', not
`csl'.
* typeck.c (c_expand_start_case): Here.
* semantics.c (do_poplevel): Remove unused variable.
-
+
1999-12-06 Mark Mitchell <mark@codesourcery.com>
* tree.c (walk_tree): Don't recurse into DECL_INITIAL or DECL_SIZE
parameters of the inlined function.
(optimize_function): Prevent recursion into partially complete
functions.
-
+
* cp-tree.def (SCOPE_STMT): Take one operand.
* cp-tree.h (SCOPE_STMT_BLOCK): New macro.
(SCOPE_NULLIFIED_P): Redefine.
* tree.c (copy_tree_r): Clear SCOPE_STMT_BLOCK rather than setting
SCOPE_NULLIFIED_P.
* Makefile.in (semantics.o): Depend on RTL_H.
-
+
* decl2.c (pending_statics_used): Make it a macro.
(saved_inlines_used): Likewise.
(finish_static_data_member_decl): Use VARRAY_PUSH_TREE.
(ssdf_decls_used): Remove.
(start_static_storage_duration_function): Use VARRAY_PUSH_TREE.
(generate_ctor_or_dtor_function): Adjust accordingly.
-
+
1999-11-24 Geoffrey Keating <geoffk@cygnus.com>
Greg McGary <gkm@gnu.org>
* typeck.c (build_component_ref): Don't use scratch_ovl_cons.
(build_x_function_call): Likewise.
(build_c_cast): Don't use min_tree_cons.
-
+
1999-11-29 Mark Mitchell <mark@codesourcery.com>
* pt.c (tsubst_decl): Robustify.
1999-11-25 Mark Mitchell <mark@codesourcery.com>
- * Make-lang.in (CXX_SRCS): Add optimize.c.
+ * Make-lang.in (CXX_SRCS): Add optimize.c.
* Makefile.in (CXX_OBJS): Add optimize.o.
(CXX_TREE_H): Add splay-tree.h, system.h, and $(CONFIG_H).
(spew.o, lex.o, decl.o, decl2.o, typeck2.o, typeck.o): Adjust.
(search.o, tree.o, ptree.o, rtti.o, except.o, expr.o): Likewise.
(xref.o, pt.o, error.o, errfn.o, repo.o, semantics.o): Likewise.
(dump.o): Likewise.
- (optimize.o): New target.
+ (optimize.o): New target.
* class.c: Don't include splay-tree.h.
- * cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT.
+ * cp-tree.def (CTOR_COMPLETE): Rename to CTOR_STMT.
* cp-tree.h: Include splay-tree.h.
(DECL_UNINLINABLE): New macro.
(CTOR_BEGIN_P, CTOR_END_P): New macros.
(optimize_function): Likewise.
(cplus_unsave_expr_now): Remove.
(copy_tree_r): Declare.
- (remap_save_expr): Likewise.
+ (remap_save_expr): Likewise.
* decl.c (local_variable_p): Don't
make it static.
(local_variable_p_walkfn): New function.
(start_function): Set the DECL_CONTEXT for automatically generated
labels.
(finish_constructor_body): Use CTOR_STMT to mark the end of a
- constructor.
+ constructor.
* decl2.c: Don't include splay-tree.h.
- (flag_inline_trees): Define.
+ (flag_inline_trees): Define.
* dump.c: Don't include
- splay-tree.h.
+ splay-tree.h.
* except.c (expand_end_catch_block): Fix comment formatting.
(expand_end_eh_spec): Set DECL_CONTEXT on temporary variables.
- (expand_throw): Tidy comment.
- * init.c (build_vec_delete_1): Use create_temporary_var.
+ (expand_throw): Tidy comment.
+ * init.c (build_vec_delete_1): Use create_temporary_var.
* lex.c (cplus_tree_code_type): Make it static.
(cplus_tree_code_length): Likewise.
- (cplus_tree_code_name): Likewise.
- * optimize.c: New file.
+ (cplus_tree_code_name): Likewise.
+ * optimize.c: New file.
* semantics.c (finish_goto_stmt): Set DECL_UNLINABLE for functions
with computed gotos.
(setup_vtbl_ptr): Mark the beginnings of constructors with
(init_tree): Set lang_unsave to cp_unsave.
(remap_save_expr): Define.
* ir.texi: Document CTOR_STMT.
-
+
1999-11-24 Jason Merrill <jason@casey.cygnus.com>
* search.c (note_debug_info_needed): Do perform this optimization
- for dwarf2.
+ for dwarf2.
(maybe_suppress_debug_info): Likewise. Start by clearing
TYPE_DECL_SUPPRESS_DEBUG.
(finish_function): Don't call end_protect_partials here.
* ir.texi (CTOR_COMPLETE): Document it.
* semantics.c (expand_stmt): Handle it.
-
+
* cp-tree.def (FUNCTION_NAME): New tree node.
* cp-tree.h (current_function_name_declared): Tweak documentation.
(lang_decl_flags): Add pretty_function_p, adjust dummy.
even in template functions.
(setup_vtbl_ptr): Don't declare __PRETTY_FUNCTION in the
conditional scope at the top of a destructor.
-
+
* error.c (dump_function_decl): Use `[ with ... ]' syntax for
specializations too.
1999-11-15 Jason Merrill <jason@casey.cygnus.com>
* cp-tree.h, decl.c (compute_array_index_type): Make nonstatic.
- * pt.c (tsubst, case INTEGER_TYPE): Call it.
+ * pt.c (tsubst, case INTEGER_TYPE): Call it.
Check uses_template_parms.
* class.c (finish_struct): If we're a local class in a template
* cp-tree.h: Declare it.
* decl2.c (finish_vtable_vardecl): Override TYPE_DECL_SUPPRESS_DEBUG
if we're writing out the vtable.
- * decl.c, search.c (dfs_debug_mark, dfs_debug_unmarked_p,
+ * decl.c, search.c (dfs_debug_mark, dfs_debug_unmarked_p,
note_debug_info_needed): #if 0 out.
1999-11-14 Mark Mitchell <mark@codesourcery.com>
TREE_PERMANENT.
* decl.c (pushdecl): Set DECL_LOCAL_FUNCTION_P.
* decl2.c (lookup_arg_dependent): Use it.
-
+
* cp-tree.h (cp_finish_decl): Change prototype.
(finish_static_data_member_decl): Likewise.
(push_permanent_obstack): Remove declaration.
(push_expression_obstack): Remove.
(push_permanent_obstack): Likewise.
* typeck.c (mark_addressable): Likewise.
-
+
1999-11-13 Mark Mitchell <mark@codesourcery.com>
* call.c (build_conditional_expr): Use build_target_expr_with_type.
(structsp): Adjust.
* parse.c: Regenerated.
* pt.c (tsubst_enum): Adjust according to build_enumerator changes.
-
+
Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be>
Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* pt.c (tsubst_expr): Don't suspend_momentary or resume_momentary.
* semantics.c (begin_new_placement): Remove.
(finish_new_placement): Likewise.
-
+
1999-11-05 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* cp-tree.h (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK): New macro.
* pt.c (tinst_level_tick): Make it static.
(last_template_error_tick): Likewise.
-
+
* cp-tree.h (mapcar): Remove declaration.
(search_tree): Likewise.
(walk_tree_fn): New typedef.
(check_default_argument): Use walk_tree.
* pt.c (for_each_template_parm_r): New function, split out from ...
(for_each_template_parm): Here. Use it, via walk_tree.
-
+
1999-11-03 Mark Mitchell <mark@codesourcery.com>
* class.c (check_bitfield_decl): New function, split out from
anonymous structs.
(finish_struct_1): Use them.
* cp-tree.h (ANON_UNION_TYPE_P): New macro.
-
+
1999-11-02 Mark Mitchell <mark@codesourcery.com>
* decl.c (grokfndecl): Remove dead code.
function. Clear DECL_SAVED_TREE after generating RTL for a
function.
* Makefile.in (semantics.o): Depend on ggc.h.
-
+
1999-10-29 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (make_typename_type): Change prototype.
* pt.c (convert_template_argument): Pass complain to
make_typename_type.
(tsubst): Likewise.
-
+
1999-10-28 Mark Mitchell <mark@codesourcery.com>
* semantics.c (finish_handler): End the scope of the handler
(do_pushlevel): Likewise.
(do_poplevel): Likewise.
* tree.c (make_temp_vec): Remove.
-
+
* dump.c (dequeue_and_dump): Dump HANDLERs and SAVE_EXPRs. Dump
CLEANUP_P for a TRY_BLOCK.
* ir.texi: Document SAVE_EXPR.
* call.c (build_over_call): Check that the built-in function is
of class BUILT_IN_NORMAL before trying to recongize it as BUILT_IN_ABS.
- * typeck.c (build_function_call_real): Similarly.
+ * typeck.c (build_function_call_real): Similarly.
1999-10-26 Mark Mitchell <mark@codesourcery.com>
1999-10-24 Mark Mitchell <mark@codesourcery.com>
* decl.c (push_overloaded_decl_1): Use pushdecl.
-
+
* decl.c (auto_function): Replace #ifdef'd __inline with just
plain inline.
* lex.c (my_get_run_time): Likeise.
(issue_ktype): Likewise.
* parse.y (empty_parms): Likewise.
* parse.c: Regenerated.
-
+
1999-10-21 Mark Mitchell <mark@codesourcery.com>
* dump.c (dequeue_and_dump): Replace several uses of
(do_pushlevel): Use it.
(do_poplevel): Use it.
(expand_stmt): Check SCOPE_PARTIAL_P.
-
+
* cp-tree.def (EMPTY_CLASS_EXPR): New tree node.
* call.c (build_call): Use EMPTY_CLASS_EXPR instead of RTL_EXPR.
* expr.c (cplus_expand_expr): Expand it.
* ir.texi: Document EMPTY_CLASS_EXPR.
-
+
1999-10-20 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (DECL_NAMESPACE_SCOPE_P): Don't treat template
* dump.c (dequeue_and_dump): Handle CLEANUP_POINT_EXPR.
* ir.texi: Clean up documentation of RETURN_INIT.
-
+
1999-10-15 Greg McGary <gkm@gnu.org>
* lex.c (lang_init_options): Set flag_bounds_check as "unspecified".
* cp-tree.h (build_x_va_arg): Prototype new function.
* call.c (build_x_va_arg): Define it.
* parse.y (unary_expr): Call build_x_va_arg.
-
+
* cp-tree.h (convert_type_from_ellipsis): Prototype new function.
* call.c (convert_type_from_ellipsis): Define it.
* decl.c (init_decl_processing): Set lang_type_promotes_to.
1999-10-09 Mark Mitchell <mark@codesourcery.com>
- * cp-tree.h (make_rtl_for_local_static): New function.
+ * cp-tree.h (make_rtl_for_local_static): New function.
* decl.c (make_rtl_for_nonlocal_decl): Move code to create RTL for
local statics ...
(make_rtl_for_local_static): Here.
* semantics.c (expand_stmt): Use make_rtl_for_local_static.
-
+
1999-10-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* method.c: Include tm_p.h.
* cp-tree.h (cp_make_lake_type): Renamed from make_lang_type.
* lex.c (cp_make_lake_type): Likewise.
* tree.c (init_tree): Init make_lang_type_fn.
-
+
1999-10-07 Mark Mitchell <mark@codesourcery.com>
* pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch
parameter.
-
+
* semantics.c (expand_stmt): Don't pretend to have asmspecs for
local statics if we don't really have them.
(expand_upcast_fixups): Likewise.
* typeck.c (build_component_ref): Likewise.
(build_binary_op_nodefault): Likewise.
-
+
* dump.c (dqueue_and_dump): Dump TYPE_VFIELD.
* ir.texi: Document TYPE_VFIELD.
(dequeue_and_dump): Unconditionally print children. Adjust calls
to functions mentioned above.
(dump_node): Pass DUMP_NONE, instead of DUMP_CHILDREN to queue.
-
+
* ir.texi: Document BIND_EXPR, LOOP_EXPR, and EXIT_EXPR.
* dump.c (dequeue_and_dump): Dump them.
-
+
* method.c (synthesize_method): Call setup_vtbl_ptr for destructors.
* decl.c (start_function): Set current_in_charge_parm for
constructors, too, where appropriate.
* search.c (fixup_all_virtual_upcast_offsets): New function.
(expand_indirect_vtbls_init): Use it.
-
+
1999-10-04 Nathan Sidwell <nathan@acm.org>
* decl2.c (grok_alignof): Don't decay lvalues.
-
+
* init.c (build_new): Remove unused variable.
1999-10-04 Mark Mitchell <mark@codesourcery.com>
(static_labelno): Remove macro.
* method.c (build_overload_nested_name): Make static_labelno
static here.
-
+
* pt.c (instantiate_decl): Use DECL_SAVED_TREE, not DECL_INITIAL,
to decide whether or not a function is defined.
(building_stmt_tree): Simplify.
* decl.c (mark_stmt_tree): New function.
(mark_saved_scope): Use it.
- (start_function): Rearrange slightly to call begin_stmt_tree
+ (start_function): Rearrange slightly to call begin_stmt_tree
earlier.
(save_function_data): Tweak.
(finish_function): Adjust call to finish_stmt_tree.
(finish_stmt_tree): Likewise.
* tree.c (search_tree): Don't handle VEC_INIT_EXPR.
(mapcar): Likewise.
-
+
* parse.y (simple_stmt): Don't call finish_stmt unnecessarily.
* parse.c: Regenerated.
-
+
* dump.c (dqueue_and_dump): Dump bitfieldness.
-
+
* tree.c (lvalue_p_1): Use DECL_C_BIT_FIELD to check for
bitfields, rather than DECL_BIT_FIELD.
* ir.texi: Document how to tell whether or not a field is a
bitfield.
-
+
* lex.c (make_lang_type): Fix typo in comment.
1999-10-01 Jason Merrill <jason@yorick.cygnus.com>
(DECL_GLOBAL_CTOR_P, DECL_GLOBAL_DTOR_P): New macros.
(GLOBAL_INIT_PRIORITY): Likewise.
* decl.c (lang_mark_tree): Adjust accordingly.
- (start_objects): Set DECL_GLOBAL_CTOR_P, DECL_GLOBAL_DTOR_P,
+ (start_objects): Set DECL_GLOBAL_CTOR_P, DECL_GLOBAL_DTOR_P,
and GLOBAL_INIT_PRIORITY.
* dump.c (dequeue_and_dump): Print them.
* ir.texi: Document them.
(prune_vars_needing_no_initialization): New function.
(write_out_vars): Likewise.
(finish_file): Use the various new functions instead of the old.
-
+
Thu Sep 30 00:13:27 1999 Dirk Zoller <duz@rtsffm.com>
* cp-tree.h (warn_float_equal): Declare.
(TMPL_ARG, SET_TMPL_ARG, NUM_TMPL_ARGS, TMPL_PARMS_DEPTH): Likewise.
(tsubst_copy): Clarify variable name.
(most_general_template): Robustify.
-
+
1999-09-29 Nathan Sidwell <nathan@acm.org>
* error.c (dump_template_parms): Don't use TS_PEDANTIC_NAME
* semantics.c: Include flags.h.
(expand_body): Don't do RTL generation if -fsyntax-only.
* Makefile.in (semantics.o): Depends on flags.h.
-
+
1999-09-28 Gabriel Dos Reis <gdr@codesourcery.com>
* pt.c (most_general_template): Adjust declaration.
(cplus_expand_expr): Don't call expand_throw here.
* Makefile.in (expr.o): Depend on except.h.
* ir.texi: Update documentation for THROW_EXPR.
-
+
* decl.c (start_function): Set x_dont_save_pending_sizes rather
than calling get_pending_sizes.
* init.c (build_new): Don't save and restore
function split out from c_expand_return.
(check_return_expr): Likewise.
(c_expand_return): Just generate the RTL for the return.
-
+
1999-09-24 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (CPTI_CLEANUP_TYPE): New macro.
(make_rtl_for_nonlocal_decl): Don't fuss with obstacks. Simplify.
Don't accidentally make RTL for local declarations.
(emit_local_var): Handle declarations with asm-specifiers here.
-
+
1999-09-23 Mark Mitchell <mark@codesourcery.com>
* ir.texi: Improve documentation for TARGET_EXPRs. Discuss
in function-at-a-time mode.
(finish_objects): Likewise.
(generate_ctor_or_dtor_function): Adjust accordingly.
-
+
* cp-tree.h (DECL_ANON_UNION_ELEMS): New macro.
* decl2.c (finish_anon_union): Set DECL_ANON_UNION_ELEMS.
Don't call expand_anon_union_decl here
* semantics.c (exapnd_stmt): Call it here, instead.
* typeck.c (mark_addressable): Addressed variables are implicitly
used.
-
+
1999-09-23 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK): New macro.
(RECORD_OR_UNION_TYPE_CHECK, LANG_IDENTIFIER_CAST): Likewise.
(DEFARG_NODE_CHECK): Remove; replace with DEFAULT_ARG_CHECK.
* cp-tree.h: Add tree checking macros to various tree access
- macros.
+ macros.
* ptree.c (print_lang_decl): Test for function or variable
before accessing template info.
* lang-specs.h: If -fshort-wchar, override __WCHAR_TYPE__.
* decl2.c (lang_f_options): Add -fshort-wchar.
* cp-tree.h: Declare flag_short_wchar.
- * decl.c (init_decl_processing): If -fshort-wchar, use 'short unsigned
+ * decl.c (init_decl_processing): If -fshort-wchar, use 'short unsigned
int' for wchar_t.
1999-09-23 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* typeck.c (build_modify_expr): Don't check for assignments to
this.
(c_expand_return): Don't suggest assigning to `this'.
-
+
* Makefile.in (decl.o): Depend on RTL_H.
(decl2.o): Likewise.
(class.o): Likewise.
* ir.texi (CTOR_INITIALIZER): Remove mention. Fix typo. Add
detail about the statement-tree.
-
+
1999-09-20 Nathan Sidwell <nathan@acm.org>
* parse.y (primary): Use build_functional_cast for CV_QUALIFIER.
1999-09-18 Paul Burchard <burchard@pobox.com>
* gxxint.texi: G++ now implements namespaces.
-
+
1999-09-18 Mark Mitchell <mark@codesourcery.com>
* decl.c (pop_label): Don't warn about unused labels more than
1999-09-17 Mark Mitchell <mark@codesourcery.com>
- Turn on function-at-a-time processing.
+ Turn on function-at-a-time processing.
* cp-tree.h (doing_semantic_analysis_p): New macro.
(SF_DEFAULT): Define to zero, not SF_EXPAND.
(start_handler_parms): Change prototype.
(begin_catch_block): Declare.
(finish_handler): Change prototype.
(do_pushlevel): Declare.
- (do_poplevel): Likewise.
+ (do_poplevel): Likewise.
* decl.c (pushlevel): Don't create
binding levels when not doing semantic analysis.
(poplevel): Don't pop them.
(push_cp_function_context): Don't expand functions without an
explicit call to expand_body.
(mark_lang_function): Make eh_spec_try_block and
- x_scope_stmt_stack.
+ x_scope_stmt_stack.
* except.c (expand_end_eh_spec): Don't
declare.
(process_start_catch_block): Likewise.
(expand_exception_blocks): Simplify.
(start_anon_func): Use do_pushlevel.
(end_anon_func): Use do_poplvel. Call expand_body for the
- function.
- * expr.c (do_case): Don't call define_case_label.
+ function.
+ * expr.c (do_case): Don't call define_case_label.
* init.c (create_temporary_var): Set DECL_CONTEXT for local
- variables.
+ variables.
* method.c (emit_thunk): Call expand_body for the
thunk.
- (sythesize_method): Likewise.
+ (sythesize_method): Likewise.
* parse.y (handler_args): Give it ttype.
(eat_saved_input): Call expand_body.
(base_init): Use do_pushlevel.
(handler_args): Don't call expand_start_catch_block. Return the
catch parameter. * pt.c (tsubst_expr): Adjust HANDLER handling.
* parse.c: Regenerated.
- * rtti.c (synthesize_tinfo_fn): Call finish_function.
+ * rtti.c (synthesize_tinfo_fn): Call finish_function.
* semantics.c (do_pushlevel): Give it external linkage. Build
SCOPE_STMTs.
(do_poplevel): Likewise.
HANDLERs. Handle SCOPE_STMT, CTOR_INITIALIZER, and RETURN_INIT.
(expand_body): Let expand_stmt handle CTOR_INITIALIZER,
RETURN_INIT and function try blocks.
-
+
* cp-tree.h (language_function): Add x_eh_spec_try_block. Add
x_scope_stmt_stack. Add x_in_charge_parm.
(current_eh_spec_try_block): New macro.
* Makefile.in (CONFLICTS): Adjust.
1999-09-17 Gabriel Dos Reis <gdr@codesourcery.com>
-
+
* error.c: Reduce code duplication.
(dump_template_value): New function.
(dump_type_real): Use it.
problems with extern "C" functions redeclared as static.
(duplicate_decls): When a builtin is redeclared static, make the
new function have internal linkage.
-
+
1999-09-15 Mark Mitchell <mark@codesourcery.com>
* decl2.c (build_expr_from_tree): Handle VA_ARG_EXPR.
1999-09-14 Mark Mitchell <mark@codesourcery.com>
- * decl.c (build_target_expr): Set TREE_SIDE_EFFECTS on the
+ * decl.c (build_target_expr): Set TREE_SIDE_EFFECTS on the
TARGET_EXPR.
* call.c (build_over_call): Don't set TREE_SIDE_EFFECTS on
the TARGET_EXPR.
* cvt.c (build_up_reference): Likewise.
* tree.c (build_cplus_new): Likewise.
(get_target_expr): Likewise.
-
+
Tue Sep 14 01:45:10 1999 Marc Espie <espie@cvs.openbsd.org>
* Makefile.in: Prepend $(SHELL) to move-if-change calls.
* error.c (dump_expr): Handle OVERLOADs.
* spew.c (probe_obstack): Remove.
* typeck.c (condition_conversion): Use perform_implicit_conversion.
-
+
1999-09-12 Bernd Schmidt <bernds@cygnus.co.uk>
* cp-tree.h (auto_function, define_function): Adjust prototypes.
non-permanent CONSTANTs and STRINGs.
* tree.c (build_cplus_array_type_1): Don't fuss with
TREE_PERMANENT on ARRAY_TYPEs.
-
+
* cp-tree.def (CLEANUP_STMT): New node.
* cp-tree.h (language_function): Add name_declared.
(current_function_name_declared): New macro.
* semantics.c (begin_compound_stmt): Call declare_function_name,
if appropriate.
(finish_decl_cleanup): New function.
- (expand_stmt): Use emit_local_var to output variables.
+ (expand_stmt): Use emit_local_var to output variables.
(expand_body): Set current_function_name_declared.
-
+
1999-09-10 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (finish_cleanup_try_block): New function.
(finish_do_stmt): Likewise.
(finish_for_cond): Likewise.
(expand_cond): Adjust.
-
+
* cp-tree.h (FN_TRY_BLOCK_P): New macro.
* init.c (perform_member_init): Remove obstack machinations.
(expand_cleanup_for_base): Likewise.
* pt.c (tsubst_expr): Handle various kinds of try blocks.
* semantics.c (expand_stmts): Remove.
(begin_function_try_block): Set FN_TRY_BLOCK_P.
- (finish_function_try_block): Be careful rechaining
+ (finish_function_try_block): Be careful rechaining
function try blocks.
(expand_stmt): Loop through all the statements at a given level.
(exapnd_body): Be careful with line-numbers here too. Prepare for
* semantics.c (RECHAIN_STMTS): Remove `last' parameter.
(RECHAIN_STMTS_FROM_LAST): Remove. Replace all uses with
- RECHAIN_STMTS.
+ RECHAIN_STMTS.
(RECHAIN_STMST_FROM_CHAIN): Likewise.
* parse.y (simple_stmt): Fix typo in last change.
(finish_stmt_tree): Tweak line-number handling.
(prep_stmt): New function.
(expand_stmt): Use it.
-
+
* cp-tree.h (begin_switch_stmt): Adjust prototype.
(finish_switch_cond): Likewise.
* parse.y (simple_stmt): Adjust accordingly.
(language_function): Rename binding_level to bindings.
(cp_function_chain): Use the current_function, not the
outer_function_chain.
- (current_class_ptr): Make it work, even when there's no
+ (current_class_ptr): Make it work, even when there's no
current function.
(current_class_ref): Likewise.
- (SF_DEFAULT, SF_PRE_PARSED, SF_INCLASS_INLINE, SF_EXPAND): New
+ (SF_DEFAULT, SF_PRE_PARSED, SF_INCLASS_INLINE, SF_EXPAND): New
macros.
(clear_temp_name): Remove.
* decl.c (check_function_type): New function, broken out from
* decl2.c (clear_temp_name): Remove.
(start_objects): Use SF flags to start_function.
(start_static_storage_duration_function): Likewise.
- * except.c (start_anon_func): Remove redundant calls to
+ * except.c (start_anon_func): Remove redundant calls to
push_function_context_to. Use SF flags to start function.
(end_anon_func): Remove redundant call to pop_function_context
from.
- * lex.c (reinit_parse_for_function): Don't initialize per-function
+ * lex.c (reinit_parse_for_function): Don't initialize per-function
data.
* method.c (emit_thunk): Clear current_function after calling
assemble_end_function. Use SF flags for start_function.
* rtti.c (sythesize_tinfo_fn): Use SF flags to start_function.
* semantics.c (begin_function_definition): Likewise.
(expand_body): Likewise.
-
+
1999-09-09 Nathan Sidwell <nathan@acm.org>
* cp-tree.h (convert_to_void): Prototype new function.
(build_static_cast): Likewise.
(build_c_cast): Likewise.
* semantics.c (finish_expr_stmt): Do not decay full expressions.
-
+
* typeck.c (build_x_compound_expr): Add FIXME.
1999-09-08 Mark Mitchell <mark@codesourcery.com>
* typeck.c: Likewise.
* parse.c: Regenerated.
* tree.c (build_srcloc): Simplify.
-
+
1999-09-08 Bruce Korb autogen@linuxbox.com
* Makefile.in: Give the gperf user a hint about why "gperf -F" fails.
(retrofit_lang_decl): Likewise.
(copy_lang_decl): Likewise.
- * cp-tree.h (saved_scope): Remove old_binding_level and
+ * cp-tree.h (saved_scope): Remove old_binding_level and
function_decl. Tidy up.
* decl.c (mark_saved_scope): Don't set them.
(maybe_push_to_top_level): Clear memory.
(grokvardecl): Don't complete types here.
* decl.c (start_function): Clear last_dtor_insn and
- last_parm_cleanup_insn.
+ last_parm_cleanup_insn.
(push_cp_function_context): Just copy over a little of
the old context, not all of it.
* typeckc.c (build_static_cast): Likewise.
(build_reinterpret_cast): Likewise.
(build_const_cast): Likewise.
-
+
1999-09-07 Mark Mitchell <mark@codesourcery.com>
* decl.c (ggc_p): Set it to 1.
(binding_init): Remove.
(init_cplus_unsave): Rename to ...
(init_tree): This. Add GC roots.
-
+
1999-09-05 Mark Mitchell <mark@codesourcery.com>
Get ready for garbage collection.
(cp_global_trees): Add access_default, access_public,
access_protected, access_private, access_default_virtual,
access_public_virtual, access_protected_virtual,
- access_private_virtual, ctor_identifier, delta2_identifier,
+ access_private_virtual, ctor_identifier, delta2_identifier,
delta_identifier, dtor_identifier, in_charge_identifier,
index_identifier, nelts_identifier, this_identifier,
pfn_identifier, pfn_or_delta2_identifier, vptr_identifier,
* decl2.c: Don't include varray.h.
(current_namespace): Remove.
(init_decl2): Add GC roots.
- * except.c (Terminate): Remove.
+ * except.c (Terminate): Remove.
(init_exception_processing): Use terminate_node instead.
(build_terminate_handler): Likewise.
* init.c (nc_nelts_field_id): Remove.
(expand_indirect_vtbls_init): Remove redundant declaration of
in_charge_identifier.
(init_search_processing): Use vptr_identifier.
-
+
1999-09-05 Richard Henderson <rth@cygnus.com>
Bernd Schmidt <bernds@cygnus.co.uk>
Mark Mitchell <mark@codesourcery.com>
(init_init_processing): Add GC roots.
* parse.y: Include ggc.h.
(cp_parse_init): New function.
-
+
1999-09-04 Mark Mitchell <mark@codesourcery.com>
* decl.c (init_decl_processing): Set mark_lang_status.
x_base_init_list, x_member_init_list, x_base_init_expr,
x_current_class_ptr, x_current_class_ref, x_last_tree,
x_last_expr_type, x_last_dtor_insn, x_last_parm_cleanup_insn, and
- x_result_rtx.
+ x_result_rtx.
(dtor_label, ctor_label, current_base_init_list,
current_member_init_list, base_init_expr, current_class_ptr,
current_class_ref, last_tree, last_expr_type): Adjust accordingly.
(mark_false_label_stack): Likewise.
(lang_mark_tree): Likewise.
(lang_cleanup_tree): Likewise.
-
+
1999-09-03 Mark Mitchell <mark@codesourcery.com>
* Makefile.in (CXX_TREE_H): Include function.h.
pop_cp_function_context.
* init.c: Don't include function.h.
* lex.c (begin_definition_of_inclass_inline): Call
- push_function_context_to, not push_cp_function_context.
+ push_function_context_to, not push_cp_function_context.
(process_next_inline): Call pop_function_context_from, not
pop_cp_function_context.
* method.c: Don't include function.h.
push_cp_function_context. Call pop_function_context_from, not
pop_cp_function_context.
* typeck.c: Don't include function.h.
-
+
* decl.c (expand_static_init): Tweak handling of static
initializations for objects without constructors.
(last_expr_type): Likewise.
* typeck.c (dtor_label): Likewise.
(ctor_label): Likewise.
-
+
1999-09-01 Alex Samuel <samuel@codesourcery.com>
* decl2.c (arg_assoc_template_arg): New prototype. New function.
(arg_assoc_class): Use arg_assoc_template_arg for template
- arguments.
+ arguments.
(arg_assoc): Likewise.
* pt.c (mangle_class_name_for_template): Allow member template
template arguments.
(tsubst_expr): Adjust calls to expand_start_catch_block
appropriately.
* semantics.c (expand_stmt): Likewise.
-
+
1999-08-29 Alex Samuel <samuel@codesourcery.com>
* pt.c (push_template_decl_real): Use template declaration from
* pt.c (tsbust_expr): Fix indentation. Call cp_finish_decl here.
* semantics.c (expand_stmt): Don't call cp_finish_decl here. Just
call initialize_local_var to generate initialization code.
-
+
1999-08-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp-tree.h (fndecl_as_string, type_as_string,
(make_rtl_for_nonlocal_decl): Likewise.
(cp_finish_decl): Use them.
* typeck.c (strip_array_types): New function.
-
+
* cp-tree.def (LABEL_STMT): New tree node.
* cp-tree.h (LABEL_STMT_LABEL): New macro.
(shadow_label): Remove.
building_stmt_tree.
(finish_label_decl): New function.
(expand_stmt): Handle LABEL_STMTs and local label declarations.
-
+
1999-08-26 Mark Mitchell <mark@codesourcery.com>
* decl.c (lookup_label): Build labels on the permanent obstack
(expand_stmt): Adjust accordingly.
* pt.c (tsubst_expr); Likewise.
(do_decl_instantiation): Robustify.
-
+
* cp-tree.h (AGGR_INIT_VIA_CTOR_P): New macro.
* tree.c (build_cplus_new): Set it.
* expr.c (cplus_expand_expr): Use it.
* dump.c (deque_and_dump): Handle AGGR_INIT_EXPR.
-
+
* decl.c (store_parm_decls): Reset immediate_size_expand.
(finish_function): Likewise.
-
+
* tree.c (cplus_unsave_expr_now): Don't return a value.
* semantics.c (do_poplevel): Always initialize the return value.
* 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.
-
+
1999-08-25 Mark Mitchell <mark@codesourcery.com>
* dump.c (dequeue_and_dump): Dump TARGET_EXPRs.
* dump.c (dump_next_stmt): New function.
(dequeue_and_dump): Use it.
-
+
* pt.c (tsubst_copy): Make sure to initialize return value for a
STMT_EXPR, even when processing_template_decl.
* semantics.c (finish_stmt_expr): A statement-expression whose
- last statement is not an expression-statement has type `void'.
-
+ last statement is not an expression-statement has type `void'.
+
1999-08-20 Mark Mitchell <mark@codesourcery.com>
* semantics.c (finish_stmt_expr): Fix typo in comment.
BIND_EXPR permanent.
* pt.c (register_specialization): Don't register a specialization
more than once.
-
+
1999-08-18 Andrew Haley <aph@cygnus.com>
* method.c (process_overload_item): Call build_mangled_C9x_name ()
(tsubst_copy): Likewise.
* tree.c (search_tree): Likewise.
* semantics.c (finish_pseudo_destructor_call): Create it.
-
+
1999-08-18 Mark Mitchell <mark@codesourcery.com>
* search.c (setup_class_bindings): Robustify.
(build_lang_field_decl): Likewise.
(copy_lang_decl): Use CAN_HAVE_FULLLANG_DECL_P to decide how much
to copy.
-
+
* cp-tree.def (STMT_EXPR): New tree node.
* cp-tree.h (STMT_EXPR_STMT): New macro.
(store_return_init): Change prototype.
sorry, if an unsupported node is encountered.
* typeck.c (require_complete_type_in_void): Handle BIND_EXPR.
(c_expand_return): Don't call add_tree here.
-
+
1999-08-15 Mark Mitchell <mark@codesourcery.com>
* pt.c (check_default_tmpl_args): Don't check in local scopes.
obstack. Clear DECL_DEAD_FOR_LOCAL when making a copy of a local
variable.
(tsubst_expr): Adjust now that DECL_STMTs really contain DECLs.
-
+
1999-08-14 Jason Merrill <jason@yorick.cygnus.com>
Speed up Koenig lookup.
to return namespaces we've looked at.
* decl2.c (lookup_using_namespace): Likewise.
(add_function): Don't call ovl_member.
- (lookup_arg_dependent): Initialize k.namespaces to the list of
+ (lookup_arg_dependent): Initialize k.namespaces to the list of
namespaces seen in unqualified lookup.
* call.c (equal_functions): Move here from tree.c.
(joust): Use it to handle duplicate candidates.
(push_permanent_obstack): Define.
(mark_addressable): Use it.
* typeck.c (mark_addressable): Likewise.
-
+
1999-08-13 Gavin Romig-Koch <gavin@cygnus.com>
* cp-tree.h (init_cplus_unsave): New.
* dump.c (queue): Be careful when computing bitmasks.
(dequeue_and_dump): Describe binfos as binfos, not as
vectors.
-
+
* parse.y (pedantic): Give it itype. Adjust usage accordingly
- throughout.
+ throughout.
* parse.c: Regenerated.
-
+
* Make-lang.in (CXX_SRCS): Remove sig.c.
* Makefile.in (CXX_OBJS): Remove sig.o.
(sig.o): Remove.
* hash.h: Regenerated.
* init.c (build_new_1): Remove support for signatures.
* lang-options.h: Remove -fhandle-signatures,
- -fno-handle-signatures.
+ -fno-handle-signatures.
* lex.c (init_parse): Remove support for signatures.
(yyprint): Likewise.
* lex.h (rid): Remove RID_SIGNATURE.
* method.c (build_decl_overload_real): Remove support for
- signatures.
+ signatures.
(hack_identifier): Likewise.
* parse.y (base_class): Likewise.
(base_class.1): Likewise.
(build_x_arrow): Likewise.
(build_functional_cast): Likewise.
* xref.c (GNU_xref_decl): Likewise.
-
+
1999-08-10 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
* lex.c (do_identifier): Remove unnecessary lookup of class field.
* search.c (binfo_from_vbase): New fn.
* cp-tree.h: Declare it.
* cvt.c (cp_convert_to_pointer): Use it to diagnose conversion
- from pointer to member of virtual base.
+ from pointer to member of virtual base.
* typeck.c (get_delta_difference): Likewise.
1999-08-06 Alexandre Oliva <oliva@dcc.unicamp.br>
`1', `2', and `<'; handle them generically. Don't be sorry about
"unrecognized tree codes"; just abort.
(no_linkage_check): Don't do linkage checks for templates.
-
+
* tree.c (cp_build_qualified_type_real): Handle
pointer-to-member-function types correctly.
1999-08-05 Jason Merrill <jason@yorick.cygnus.com>
- * decl.c (pushdecl): Only give an error for shadowing a parm
+ * decl.c (pushdecl): Only give an error for shadowing a parm
from *this* function.
Thu Aug 5 02:40:42 1999 Jeffrey A Law (law@cygnus.com)
specifiers.
(comptypes): Adjust for comp_except_specs.
* typeck2.c (add_exception_specifier): New global function.
-
+
* class.c (check_for_override): Reword error message.
1999-08-03 Nathan Sidwell <nathan@acm.org>
(tsubst_expr): Use STMT_LINENO.
* semantics.c (finish_asm_stmt): Eliminate duplicate code. Check
for invalid cv-qualifiers even while building templates.
-
+
1999-08-02 Richard Henderson <rth@cygnus.com>
* call.c: Include defaults.h instead of expr.h.
(build_conditional_expr): Tweak.
(convert_like): Some BASE_CONVs really do require the generation
of code.
-
+
* init.c (perform_member_init): Don't go through build_modify_expr
for simple initializations.
* tree.c (debug_binfo): Likewise.
* decl2.c (mark_vtable_entries): Don't bash abstract virtuals to
__pure_virtual here.
-
+
1999-07-26 Mark Mitchell <mark@codesourcery.com>
* tree.c (build_cplus_new): Adjust call to abstract_virtuals_error
(build_binary_op_nodefault): Use null_ptr_cst_p.
(build_conditional_expr): Remove.
(convert_for_assignment): Use new conversion functions.
-
+
* cp-tree.h (abstract_virtuals_error): Change declaration.
* typeck2.c (abstract_virtuals_error): Check to see if an error
occurred, and return a boolean value accordingly.
* pt.c (unify): Don't get confused by pointers-to-member functions.
* search.c (build_cplus_new): Robustify.
-
+
1999-07-24 Richard Henderson <rth@cygnus.com>
* gxx.gperf (__builtin_va_arg): New.
(lvalue_p): Likewise.
(build_cplus_new): Don't allow the creation of an abstract class.
* typeck.c (convert_for_initialization): Use initialize_reference.
-
+
1999-07-21 Gavin Romig-Koch <gavin@cygnus.com>
* lex.c (real_yylex) : Correct the test for overflow when lexing
* Makefile.in (INTERFACE): Bump to 2.
1999-07-17 Alexandre Oliva <oliva@dcc.unicamp.br>
-
+
* typeck2.c (my_friendly_abort): Updated URL with bug reporting
instructions to gcc.gnu.org. Removed e-mail address.
* class.c (method_name_cmp): New function.
(finish_struct_methods): Modified to support sorting and searching
methods.
- (finish_struct_anon): Changed code in inner loop to use ELT rather
+ (finish_struct_anon): Changed code in inner loop to use ELT rather
than UELT (which required an extra indirection for every reference).
(field_decl_cmp): New function to support sorting FIELD_DECLs.
(finish_struct_1): Sort fields.
initial declaration, then don't save the inline info and by all
means don't mark the function as a builtin function.
- * decl.c (lookup_name_real): Set NONCLASS to 1 if
+ * decl.c (lookup_name_real): Set NONCLASS to 1 if
CURRENT_CLASS_TYPE is 0.
* class.c (duplicate_tag_error): Set TYPE_NONCOPIED_PARTS to
(init_decl_processing): Handle/use the two new types.
* lex.c (real_yylex): Same.
* typeck.c (unsigned_type,signed_type,signed_or_unsigned_type) :
- Same.
+ Same.
1999-07-01 Mark Mitchell <mark@codesourcery.com>
* error.c (dump_type_real): Handle TREE_LIST again.
- * typeck.c (comp_target_parms): Don't complain about
+ * typeck.c (comp_target_parms): Don't complain about
converting from () to (...) if !flag_strict_prototype.
* decl.c (grokdeclarator): Update the names of all variants when
1999-06-21 Mark Mitchell <mark@codesourcery.com>
* init.c (expand_aggr_vbase_init): Rename to
- construct_virtual_bases. Conditionalize construction here,
+ construct_virtual_bases. Conditionalize construction here,
rather than ...
(emit_base_init): Here.
* error.c (dump_expr): Handle BIND_EXPR, LOOP_EXPR, and
EXIT_EXPR.
-
+
1999-06-18 Mark Mitchell <mark@codesourcery.com>
* init.c (expand_aggr_vbase_init): Add flag parameter.
(build_partial_cleanup_for): Remove, inlining into ..
(expand_cleanup_for_base): ... here. Take flag parameter.
(emit_base_init): Pass the in_chrg parameter to
- emit_aggr_vbase_init.
+ emit_aggr_vbase_init.
(emit_aggr_vbase_init): Pass it to expand_cleanup_for_base.
-
+
1999-06-16 Mark Mitchell <mark@codesourcery.com>
* decl2.c (import_export_decl): Use same_type_p, rather than
(push_class_level_binding): Use push_cache_obstack, not
maybe_push_cache_obstack.
* search.c (push_class_decls): Likewise.
-
+
1999-06-14 Martin von Löwis <loewis@informatik.hu-berlin.de>
* pt.c (tsubst_friend_function): Push into namespace of friend
* tree.c (build_cplus_array_type_1): Use push_obstacks_nochange
and friends rather than messing with current_obstack directly.
(cp_build_qualified_type_real): Rework ARRAY_TYPE
- allocation to match practice throughout the rest of the
+ allocation to match practice throughout the rest of the
compiler.
1999-05-30 Mark Mitchell <mark@codesourcery.com>
(DECL_SAVED_TREE): Document.
(DECL_TEMPLATE_INJECT): Remove.
* class.c (finish_struct): Remove code to deal with
- DECL_TEMPLATE_INJECT.
+ DECL_TEMPLATE_INJECT.
* decl.c (maybe_process_template_type_declaration): Handle all new
types in templates uniformly.
forward-declarations.
(instantiate_class_template): Remove code processing
DECL_TEMPLATE_INJECT.
-
+
* pt.c (lookup_template_class): Tweak lookup to find member
templates.
ASM_CV_QUAL.
* semantics.c (finish_asm_stmt): Make strings permanent if they're
used in a template.
-
+
1999-05-25 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (casts_away_constness, casts_away_constness_r): Strip both
* decl2.c (mark_vtable_entries): Don't make a copy of a function,
and then make it look like `abort'. Just use `abort' instead.
-
+
* typeck.c (build_static_cast): Don't allow static_casts that cast
away constness.
(casts_away_constness_r): New function.
* lex.c (is_global): A template parameter isn't global.
* parse.y (class_head): Robustify.
* parse.c: Regenerated.
-
+
1999-05-22 Mark Mitchell <mark@codesourcery.com>
* pt.c (for_each_template_parm): Walk into TYPENAME_TYPEs,
INDIRECT_REFs, and COMPONENT_REFs. Handle FIELD_DECLs.
-
+
* cp-tree.h (push_nested_namespace): Declare.
(pop_nested_namespace): Likewise.
* decl.c (push_nested_namespace): New function.
1999-05-21 Mark Mitchell <mark@codesourcery.com>
Nathan Sidwell <nathan@acm.org>
-
+
* Make-lang.in (cc1plus): Make it depend on gxx.gperf.
* cp-tree.h: Fix typo in documentation on pointers-to-members.
(cp_build_qualified_type): Make it a macro.
(cp_build_qualified_type): Rename to ...
(cp_build_qualified_type_real): Add additional COMPLAIN parameter
and modify appropriately.
-
+
* typeck.c (build_ptrmemfunc): Handle PTRMEM_CSTs carefully to
reveal optimization opportunities.
* search.c (marked_pushdecls_p): Don't descend into
TEMPLATE_TYPE_PARMs and the like.
(unmarked_pushdecls_p): Likewise.
-
+
* call.c (build_over_call): Don't throw away
initializations/copies of empty classes; use MODIFY_EXPR and
INIT_EXPR as for non-empty classes.
convert_for_initialization): Likewise.
* class.c (instantiate_type): Handle seeing a baselink under an
OFFSET_REF.
- * error.c (dump_expr): Likewise.
+ * error.c (dump_expr): Likewise.
* pt.c (for_each_template_parm): Likewise.
(resolve_overloaded_unification): Likewise.
* tree.c (is_overloaded_fn, really_overloaded_fn): Likewise.
TREE_LIST for ambiguous lookups.
(setup_class_bindings): Adjust accordingly.
(push_class_decls): Revise out-of-date comments.
-
+
* typeck.c (build_const_cast): Tighten checks for legality.
1999-05-02 Martin von Löwis <loewis@informatik.hu-berlin.de>
other parsing fails.
(cp_parser_enclosed_template_argument_list): If the argument list is
parsed correctly, but the next token is '>>', emit a diagnostic.
- (cp_parser_next_token_ends_template_argument): Accept '>>' as
+ (cp_parser_next_token_ends_template_argument): Accept '>>' as
delimiter of template argument, it will be later detected as a typo.
2003-12-17 Kelley Cook <kcook@gcc.gnu.org>
PR c/13134
* decl.c (duplicate_decls): Copy visibility flag when appropriate.
-
+
2003-12-09 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* init.c (build_new_1): Deal with an OVERLOAD set when
PR c++/11929
* call.c (magic_varargs_p): New fn.
- (build_over_call): Do no ellipsis conversions for arguments to
+ (build_over_call): Do no ellipsis conversions for arguments to
functions with magic varargs.
* name-lookup.c, init.c, except.c: Revert Giovanni's patch from
PR c++/13305
* parser.c (cp_parser_elaborated_type_specifier): Accept
attributes.
-
+
2003-12-05 Mark Mitchell <mark@codesourcery.com>
PR c++/13314
2003-12-02 Richard Henderson <rth@redhat.com>
* name-lookup.h (struct cp_binding_level): Use ENUM_BITFIELD.
- * parser.c (struct cp_token): Likewise.
+ * parser.c (struct cp_token): Likewise.
(struct cp_parser_token_tree_map_node): Likewise.
* lex.c (struct resword): Move const after ENUM_BITFIELD.
* decl.c (duplicate_decls): copy DECL_VISIBILITY field.
* method.c (use_thunk): give thunk same visibility as function.
* optimize.c (maybe_clone_body): copy DECL_VISIBILITY field.
-
+
2003-11-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11616
mangle a non-existant middle operator to the ?: operator.
2003-10-21 Robert Bowdidge <bowdidge@apple.com>
- * decl.c (cp_finish_decl): Remove clause intended for asm directives
+
+ * decl.c (cp_finish_decl): Remove clause intended for asm directives
in struct or class fields: this code is never executed.
2003-10-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
2003-10-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
- Break out decl.c (2/n)
+ Break out decl.c (2/n)
* name-lookup.c: Include diagnostic.h
(cxx_binding_free): Make static.
(cxx_binding_make): Likewise.
(maybe_process_template_type_declaration): Likewise.
(pop_binding): Likewise.
* cp-tree.h: Move corresponding declarations to name-lookup.h
-
+
2003-10-12 Steven Bosscher <steven@gcc.gnu.org>
* cvt.c (ocp_convert): Move warning to C common code.
pp_cxx_flag_qualified_id and pp_cxx_flag_global_scope.
* cxx-pretty-print.c (pp_cxx_id_expression): Always display
qualified entities using qualified names.
-
+
PR c++/12337
* init.c (build_new_1): Make sure that the expression returned is
not an lvalue.
2003-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
* name-lookup.c (binding_entry_free): Nullify name and type
- fields.
+ fields.
2003-10-02 Mark Mitchell <mark@codesourcery.com>
2003-09-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl.c (pop_binding): Don't mess with nullifying binding->scope
- here.
+ here.
* name-lookup.c: Re-format.
(cxx_binding_free): Nullify binding->scope.
2003-09-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl.c (cxx_scope_descriptor): Fix thinko.
- (struct cp_binding_level): Adjust type of binding_depth field.
+ (struct cp_binding_level): Adjust type of binding_depth field.
2003-09-18 Danny Smith <dannysmith@users.sourceforge.net>
2003-09-18 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (dump_type): Simplify. Use pp_type_specifier_seq for
- "C" types.
+ "C" types.
* cxx-pretty-print.c (pp_cxx_type_specifier_seq): Fix thinko.
2003-09-17 Richard Henderson <rth@redhat.com>
the various flags.
(set_block): Remove check for doing_semantic_analysis_p.
(pushlevel_class): Use "kind" field in binding_level, not
- the various flags.
+ the various flags.
(poplevel_class): Likewise.
(initial_push_namespace_scope): Likewise.
(maybe_push_to_top_level): Likewise.
(save_function-data): Do not set expanding_p.
(cxx_push_function_context): Do not clear expanding_p.
* semantics.c (cxx_expand_function_start): Do not set expanding_p.
-
+
2003-09-14 Mark Mitchell <mark@codesourcery.com>
* class.c (layout_class_type): Make DECL_MODE match TYPE_MODE for
2003-09-09 Richard Henderson <rth@redhat.com>
- * semantics.c (expand_or_defer_fn): Update call to
+ * semantics.c (expand_or_defer_fn): Update call to
cgraph_finalize_function.
* semantics.c (expand_or_defer_fn): Use cgraph_finalize_function
* error.c (dump_decl): Handle namespace-alias-definition.
* decl.c (warn_extern_redeclared_static): There is no point in
checking changes in storage class specifier for a namespace
- declaration.
+ declaration.
(duplicate_decls): Tidy diagnostic message.
* cxx-pretty-print.c (pp_cxx_left_brace): New macro.
(pp_cxx_right_brace): Likewise.
(push_class_binding): Likewise.
(set_identifier_type_value_with_scope): Likewise.
* name-lookup.c (supplement_binding): Rename from add_binding.
- Return a bool. Improve documentation.
+ Return a bool. Improve documentation.
(set_namespace_binding): Adjust.
* Make-lang.in (cp/name-lookup.o): Depend on toplev.h
PR c++/11811
* cxx-pretty-print.c (pp_cxx_canonical_template_parameter): New
- function.
+ function.
* cxx-pretty-print.h: Declare.
* error.c (dump_template_parameter): Use it.
(dump_type): Likewise.
* init.c (build_vec_delete_1): Convert 2nd argument to NE_EXPR to
the proper type.
-
+
2004-02-24 Jason Merrill <jason@redhat.com>
PR c++/13944
* call.c, cvt.c, init.c, typeck.c: Use TREE_NO_WARNING instead
of TREE_NO_UNUSED_WARNING.
* cvt.c (convert_to_void): Also use it for "has no effect" warning.
-
+
2004-01-30 Frank Ch. Eigler <fche@redhat.com>
* cp-mudflap.c (mflang_flush_calls): Mark static ctor as TREE_USED.
* cp-lang.c (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Kill.
* cp-tree.h (cxx_callgraph_analyze_expr): Kill.
* decl2.c (cxx_callgraph_analyze_expr): Kill.
-
+
2003-12-14 Jan Hubicka <jh@suse.cz>
* cp-lang.c (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Kill.
$(INCLUDES) $(srcdir)/cp/g++spec.c)
# Create the compiler driver for g++.
-GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o
+GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o
g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
$(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
doc/g++.1: doc/gcc.1
cp doc/gcc.1 doc/g++.1
-c++.install-man: $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
+c++.install-man: $(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext)
$(DESTDIR)$(man1dir)/$(GXX_INSTALL_NAME)$(man1ext): doc/g++.1 installdirs
-rm -f $@
* G++ no longer allows in-class initializations of static data members
that do not have arithmetic or enumeration type. For example:
- struct S {
+ struct S {
static const char* const p = "abc";
};
- is no longer accepted.
+ is no longer accepted.
Use the standards-conformant form:
- struct S {
+ struct S {
static const char* const p;
};
pointer to cv-qualified member function types.
* The C++ ABI has been changed to correctly handle this code:
-
+
struct A {
void operator delete[] (void *, size_t);
};
- struct B : public A {
+ struct B : public A {
};
new B[10];
The amount of storage allocated for the array will be greater than
it was in 3.0, in order to store the number of elements in the
array, so that the correct size can be passed to `operator delete[]'
- when the array is deleted. Previously, the value passed to
+ when the array is deleted. Previously, the value passed to
`operator delete[]' was unpredictable.
This change will only affect code that declares a two-argument
`operator delete[]' with a second parameter of type `size_t'
- in a base class, and does not override that definition in a
+ in a base class, and does not override that definition in a
derived class.
* The C++ ABI has been changed so that:
- struct A {
+ struct A {
void operator delete[] (void *, size_t);
void operator delete[] (void *);
};
are those whose types involve non-type template arguments whose
mangled representations require more than one digit.
-* Support for assignment to `this' has been removed. This idiom
+* Support for assignment to `this' has been removed. This idiom
was used in the very early days of C++, before users were allowed
to overload `operator new'; it is no longer allowed by the C++
standard.
* G++ previously allowed `sizeof (X::Y)' where Y was a non-static
member of X, even if the `sizeof' expression occurred outside
- of a non-static member function of X (or one of its derived classes,
+ of a non-static member function of X (or one of its derived classes,
or a member-initializer for X or one of its derived classes.) This
extension has been removed.
-* G++ no longer allows you to overload the conditional operator (i.e.,
+* G++ no longer allows you to overload the conditional operator (i.e.,
the `?:' operator.)
* The "named return value" extension:
-
+
int f () return r { r = 3; }
has been deprecated, and will be removed in a future version of G++.
*** Changes in EGCS 1.1:
-* Namespaces are fully supported. The library has not yet been converted
+* Namespaces are fully supported. The library has not yet been converted
to use namespace std, however, and the old std-faking code is still on by
default. To turn it off, you can use -fhonor-std.
http://www.cygnus.com/misc/wp/dec96pub/template.html#temp.res
- + Guiding declarations are no longer supported. Function declarations,
+ + Guiding declarations are no longer supported. Function declarations,
including friend declarations, do not refer to template instantiations.
You can restore the old behavior with -fguiding-decls until you fix
your code.
converting from a bound member function pointer to function
pointer).
- + A flag -Weffc++ has been added for violations of some of the style
+ + A flag -Weffc++ has been added for violations of some of the style
guidelines in Scott Meyers' _Effective C++_ books.
+ -Woverloaded-virtual now warns if a virtual function in a base
* __FUNCTION__ and __PRETTY_FUNCTION__ are now treated as variables by the
parser; previously they were treated as string constants. So code like
- `printf (__FUNCTION__ ": foo")' must be rewritten to
+ `printf (__FUNCTION__ ": foo")' must be rewritten to
`printf ("%s: foo", __FUNCTION__)'. This is necessary for templates.
* local static variables in extern inline functions will be shared between
translation units.
-* -fvtable-thunks is supported for all targets, and is the default for
+* -fvtable-thunks is supported for all targets, and is the default for
Linux with glibc 2.x (also called libc 6.x).
* bool is now always the same size as another built-in type. Previously,
* Joe Buck <jbuck@synopsys.com>, the maintainer of the g++ FAQ.
* Brendan Kehoe <brendan@cygnus.com>, who coordinates testing of g++.
* Jason Merrill <jason@cygnus.com>, the g++ maintainer.
-* Mark Mitchell <mmitchell@usa.net>, who implemented member function
+* Mark Mitchell <mmitchell@usa.net>, who implemented member function
templates and explicit qualification of function templates.
* Mike Stump <mrs@wrs.com>, the previous g++ maintainer, who did most of
the exception handling work.
/* Functions related to invoking methods and overloaded functions.
- Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+ Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) and
modified by Brendan Kehoe (brendan@cygnus.com).
/* The various kinds of conversion. */
-typedef enum conversion_kind {
+typedef enum conversion_kind {
ck_identity,
ck_lvalue,
ck_qual,
used. */
BOOL_BITFIELD check_copy_constructor_p : 1;
/* If KIND is ck_ptr or ck_pmem, true to indicate that a conversion
- from a pointer-to-derived to pointer-to-base is being performed. */
+ from a pointer-to-derived to pointer-to-base is being performed. */
BOOL_BITFIELD base_p : 1;
/* The type of the expression resulting from the conversion. */
tree type;
static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *);
static bool any_strictly_viable (struct z_candidate *);
static struct z_candidate *add_template_candidate
- (struct z_candidate **, tree, tree, tree, tree, tree,
+ (struct z_candidate **, tree, tree, tree, tree, tree,
tree, tree, int, unification_kind_t);
static struct z_candidate *add_template_candidate_real
- (struct z_candidate **, tree, tree, tree, tree, tree,
+ (struct z_candidate **, tree, tree, tree, tree, tree,
tree, tree, int, tree, unification_kind_t);
-static struct z_candidate *add_template_conv_candidate
+static struct z_candidate *add_template_conv_candidate
(struct z_candidate **, tree, tree, tree, tree, tree, tree);
static void add_builtin_candidates
(struct z_candidate **, enum tree_code, enum tree_code,
(struct z_candidate **, enum tree_code, enum tree_code,
tree, tree, tree, tree *, tree *, int);
static bool is_complete (tree);
-static void build_builtin_candidate
+static void build_builtin_candidate
(struct z_candidate **, tree, tree, tree, tree *, tree *,
int);
-static struct z_candidate *add_conv_candidate
+static struct z_candidate *add_conv_candidate
(struct z_candidate **, tree, tree, tree, tree, tree);
-static struct z_candidate *add_function_candidate
+static struct z_candidate *add_function_candidate
(struct z_candidate **, tree, tree, tree, tree, tree, int);
static conversion *implicit_conversion (tree, tree, tree, int);
static conversion *standard_conversion (tree, tree, tree, int);
static bool is_subseq (conversion *, conversion *);
static tree maybe_handle_ref_bind (conversion **);
static void maybe_handle_implicit_object (conversion **);
-static struct z_candidate *add_candidate
- (struct z_candidate **, tree, tree, size_t,
+static struct z_candidate *add_candidate
+ (struct z_candidate **, tree, tree, size_t,
conversion **, tree, tree, int);
static tree source_type (conversion *);
static void add_warning (struct z_candidate *, struct z_candidate *);
else
{
/* In the case of:
-
+
template <class T> struct S { ~S(); };
int i;
i.~S();
-
+
NAME will be a class template. */
gcc_assert (DECL_CLASS_TEMPLATE_P (name));
return false;
function = build3 (CALL_EXPR, result_type, function, parms, NULL_TREE);
TREE_HAS_CONSTRUCTOR (function) = is_constructor;
TREE_NOTHROW (function) = nothrow;
-
+
return function;
}
validate_conversion_obstack (void)
{
if (conversion_obstack_initialized)
- gcc_assert ((obstack_next_free (&conversion_obstack)
+ gcc_assert ((obstack_next_free (&conversion_obstack)
== obstack_base (&conversion_obstack)));
}
build_identity_conv (tree type, tree expr)
{
conversion *c;
-
+
c = alloc_conversion (ck_identity);
c->type = type;
c->u.expr = expr;
conversion. */
conversion *part_conv = standard_conversion
(TREE_TYPE (to), TREE_TYPE (from), NULL_TREE, flags);
-
+
if (part_conv)
{
conv = build_conv (part_conv->kind, to, conv);
&& TREE_CODE (TREE_TYPE (from)) != FUNCTION_TYPE)
{
from = build_pointer_type
- (cp_build_qualified_type (void_type_node,
+ (cp_build_qualified_type (void_type_node,
cp_type_quals (TREE_TYPE (from))));
conv = build_conv (ck_ptr, from, conv);
}
(TYPE_PTRMEM_POINTED_TO_TYPE (from),
TYPE_PTRMEM_POINTED_TO_TYPE (to))))
{
- from = build_ptrmem_type (tbase,
+ from = build_ptrmem_type (tbase,
TYPE_PTRMEM_POINTED_TO_TYPE (from));
conv = build_conv (ck_pmem, from, conv);
}
else if (IS_AGGR_TYPE (TREE_TYPE (from))
&& IS_AGGR_TYPE (TREE_TYPE (to))
/* [conv.ptr]
-
+
An rvalue of type "pointer to cv D," where D is a
class type, can be converted to an rvalue of type
"pointer to cv B," where B is a base class (clause
access or uniqueness. */
&& DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from)))
{
- from =
+ from =
cp_build_qualified_type (TREE_TYPE (to),
cp_type_quals (TREE_TYPE (from)));
from = build_pointer_type (from);
return 0;
from = cp_build_qualified_type (tbase, cp_type_quals (fbase));
- from = build_method_type_directly (from,
+ from = build_method_type_directly (from,
TREE_TYPE (fromfn),
TREE_CHAIN (TYPE_ARG_TYPES (fromfn)));
from = build_ptrmemfunc_type (build_pointer_type (from));
conv = build_conv (ck_std, to, conv);
if (fcode == POINTER_TYPE
|| TYPE_PTRMEM_P (from)
- || (TYPE_PTRMEMFUNC_P (from)
+ || (TYPE_PTRMEMFUNC_P (from)
&& conv->rank < cr_pbool))
conv->rank = cr_pbool;
return conv;
}
-
+
return NULL;
}
/* We don't check for ENUMERAL_TYPE here because there are no standard
{
tree f = OVL_CURRENT (fns);
tree t2 = TREE_TYPE (TREE_TYPE (f));
-
+
cand = NULL;
/* If this is a template function, try to get an exact
TREE_PURPOSE (conversions),
LOOKUP_NORMAL,
DEDUCE_CONV);
-
+
if (cand)
{
/* Now, see if the conversion function really returns
}
else if (TREE_CODE (t2) == REFERENCE_TYPE
&& reference_compatible_p (t, TREE_TYPE (t2)))
- cand = add_function_candidate (&candidates, f, s, arglist,
- TYPE_BINFO (s),
+ cand = add_function_candidate (&candidates, f, s, arglist,
+ TYPE_BINFO (s),
TREE_PURPOSE (conversions),
LOOKUP_NORMAL);
-
+
if (cand)
{
conversion *identity_conv;
/* Build a standard conversion sequence indicating the
binding from the reference type returned by the
function to the desired REFERENCE_TYPE. */
- identity_conv
- = build_identity_conv (TREE_TYPE (TREE_TYPE
+ identity_conv
+ = build_identity_conv (TREE_TYPE (TREE_TYPE
(TREE_TYPE (cand->fn))),
NULL_TREE);
cand->second_conv
- = (direct_reference_binding
+ = (direct_reference_binding
(reference_type, identity_conv));
cand->second_conv->bad_p |= cand->convs[0]->bad_p;
}
if (cand->viable == -1)
conv->bad_p = true;
-
+
return cand->second_conv;
}
t = TREE_TYPE (type);
- /* [over.ics.rank]
-
+ /* [over.ics.rank]
+
When a parameter of reference type binds directly
(_dcl.init.ref_) to an argument expression, the implicit
conversion sequence is the identity conversion, unless the
argument expression has a type that is a derived class of the
parameter type, in which case the implicit conversion sequence is
a derived-to-base Conversion.
-
+
If the parameter binds directly to the result of applying a
conversion function to the argument expression, the implicit
conversion sequence is a user-defined conversion sequence
{
/* [dcl.init.ref]
- If the initializer expression
-
+ If the initializer expression
+
-- is an lvalue (but not an lvalue for a bit-field), and "cv1 T1"
is reference-compatible with "cv2 T2,"
-
+
the reference is bound directly to the initializer expression
lvalue. */
conv = build_identity_conv (from, expr);
a temporary, so we just issue an error when the conversion
actually occurs. */
conv->need_temporary_p = true;
-
+
return conv;
}
else if (CLASS_TYPE_P (from) && !(flags & LOOKUP_NO_CONVERSION))
"cv1 T1" is reference-compatible with "cv3 T3". (this
conversion is selected by enumerating the applicable
conversion functions (_over.match.ref_) and choosing the
- best one through overload resolution. (_over.match_).
+ best one through overload resolution. (_over.match_).
the reference is bound to the lvalue result of the conversion
in the second case. */
return NULL;
/* [over.ics.rank]
-
+
When a parameter of reference type is not bound directly to an
argument expression, the conversion sequence is the one required
to convert the argument expression to the underlying type of the
return NULL;
/* [dcl.init.ref]
-
+
If the initializer expression is an rvalue, with T2 a class type,
and "cv1 T1" is reference-compatible with "cv2 T2", the reference
is bound in one of the following ways:
-
+
-- The reference is bound to the object represented by the rvalue
- or to a sub-object within that object.
+ or to a sub-object within that object.
-- ...
-
+
We use the first alternative. The implicit conversion sequence
is supposed to be same as we would obtain by generating a
temporary. Fortunately, if the types are reference compatible,
functions. */
static struct z_candidate *
-add_candidate (struct z_candidate **candidates,
- tree fn, tree args,
- size_t num_convs, conversion **convs,
- tree access_path, tree conversion_path,
+add_candidate (struct z_candidate **candidates,
+ tree fn, tree args,
+ size_t num_convs, conversion **convs,
+ tree access_path, tree conversion_path,
int viable)
{
- struct z_candidate *cand
+ struct z_candidate *cand
= conversion_obstack_alloc (sizeof (struct z_candidate));
cand->fn = fn;
comes from for purposes of overload resolution. */
static struct z_candidate *
-add_function_candidate (struct z_candidate **candidates,
- tree fn, tree ctype, tree arglist,
+add_function_candidate (struct z_candidate **candidates,
+ tree fn, tree ctype, tree arglist,
tree access_path, tree conversion_path,
int flags)
{
orig_arglist = arglist;
arglist = skip_artificial_parms_for (fn, arglist);
}
- else
+ else
orig_arglist = arglist;
len = list_length (arglist);
}
out:
- return add_candidate (candidates, fn, orig_arglist, len, convs,
+ return add_candidate (candidates, fn, orig_arglist, len, convs,
access_path, conversion_path, viable);
}
if (!sufficient_parms_p (parmnode))
viable = 0;
- return add_candidate (candidates, totype, arglist, len, convs,
+ return add_candidate (candidates, totype, arglist, len, convs,
access_path, conversion_path, viable);
}
convs[0] = t;
else
viable = 0;
- }
+ }
- add_candidate (candidates, fnname, /*args=*/NULL_TREE,
- num_convs, convs,
+ add_candidate (candidates, fnname, /*args=*/NULL_TREE,
+ num_convs, convs,
/*access_path=*/NULL_TREE,
/*conversion_path=*/NULL_TREE,
viable);
/* Create any builtin operator overload candidates for the operator in
question given the converted operand types TYPE1 and TYPE2. The other
args are passed through from add_builtin_candidates to
- build_builtin_candidate.
-
- TYPE1 and TYPE2 may not be permissible, and we must filter them.
+ build_builtin_candidate.
+
+ TYPE1 and TYPE2 may not be permissible, and we must filter them.
If CODE is requires candidates operands of the same type of the kind
of which TYPE1 and TYPE2 are, we add both candidates
CODE (TYPE1, TYPE1) and CODE (TYPE2, TYPE2). */
&& (TYPE_PTROB_P (type1)
|| TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE))
break;
- return;
+ return;
/* 9 For every type T, there exist candidate operator functions of the form
T* operator+(T*);
/* [over.built]
For every pair of promoted arithmetic types L and R, there
- exist candidate operator functions of the form
+ exist candidate operator functions of the form
- LR operator?(bool, L, R);
+ LR operator?(bool, L, R);
where LR is the result of the usual arithmetic conversions
between types L and R.
if (!(TYPE_PTR_P (type1) || TYPE_PTR_TO_MEMBER_P (type1))
|| !(TYPE_PTR_P (type2) || TYPE_PTR_TO_MEMBER_P (type2)))
return;
-
+
/* We don't check that the two types are the same; the logic
below will actually create two candidates; one in which both
parameter types are TYPE1, and one in which both parameter
one of the input types converts to.
3) arithmetic candidates. According to the standard, we should generate
all of these, but I'm trying not to...
-
+
Here we generate a superset of the possible candidates for this particular
case. That is a subset of the full set the standard defines, plus some
other cases which the standard disallows. add_builtin_candidate will
case GE_EXPR:
enum_p = 1;
/* Fall through. */
-
+
default:
ref1 = 0;
}
/* In [class.copy]:
A member function template is never instantiated to perform the
- copy of a class object to an object of its class type.
+ copy of a class object to an object of its class type.
It's a little unclear what this means; the standard explicitly
does allow a template to be used to copy a class. For example,
};
const A f ();
void g () { A a (f ()); }
-
+
the member template will be used to make the copy. The section
quoted above appears in the paragraph that forbids constructors
whose only parameter is (a possibly cv-qualified variant of) the
class type, and a logical interpretation is that the intent was
to forbid the instantiation of member templates which would then
have that form. */
- if (DECL_CONSTRUCTOR_P (fn) && list_length (arglist) == 2)
+ if (DECL_CONSTRUCTOR_P (fn) && list_length (arglist) == 2)
{
tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn);
if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),
conversion_path, arglist);
else
cand = add_function_candidate (candidates, fn, ctype,
- arglist, access_path,
+ arglist, access_path,
conversion_path, flags);
if (DECL_TI_TEMPLATE (fn) != tmpl)
/* This situation can occur if a member template of a template
tree access_path, tree conversion_path, int flags,
unification_kind_t strict)
{
- return
+ return
add_template_candidate_real (candidates, tmpl, ctype,
- explicit_targs, arglist, return_type,
+ explicit_targs, arglist, return_type,
access_path, conversion_path,
flags, NULL_TREE, strict);
}
tree obj, tree arglist, tree return_type,
tree access_path, tree conversion_path)
{
- return
+ return
add_template_candidate_real (candidates, tmpl, NULL_TREE, NULL_TREE,
arglist, return_type, access_path,
conversion_path, 0, obj, DEDUCE_CONV);
last_viable = &viable;
*any_viable_p = false;
- cand = &cands;
- while (*cand)
+ cand = &cands;
+ while (*cand)
{
struct z_candidate *c = *cand;
if (strict_p ? c->viable == 1 : c->viable)
gcc_assert (user_seq->kind == ck_user);
/* Find the end of the second conversion sequence. */
- t = &(std_seq);
+ t = &(std_seq);
while ((*t)->kind != ck_identity)
t = &((*t)->u.next);
if (DECL_NONCONVERTING_P (ctor))
continue;
- if (TREE_CODE (ctor) == TEMPLATE_DECL)
+ if (TREE_CODE (ctor) == TEMPLATE_DECL)
cand = add_template_candidate (&candidates, ctor, totype,
- NULL_TREE, args, NULL_TREE,
+ NULL_TREE, args, NULL_TREE,
TYPE_BINFO (totype),
TYPE_BINFO (totype),
flags,
DEDUCE_CALL);
- else
+ else
cand = add_function_candidate (&candidates, ctor, totype,
- args, TYPE_BINFO (totype),
+ args, TYPE_BINFO (totype),
TYPE_BINFO (totype),
- flags);
+ flags);
if (cand)
cand->second_conv = build_identity_conv (totype, NULL_TREE);
look for a temporary binding. */
if (TREE_CODE (totype) == REFERENCE_TYPE)
convflags |= LOOKUP_NO_TEMP_BIND;
-
+
for (fns = TREE_VALUE (conv_fns); fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
-
+
/* [over.match.funcs] For conversion functions, the function
is considered to be a member of the class of the implicit
object argument for the purpose of defining the type of
So we pass fromtype as CTYPE to add_*_candidate. */
if (TREE_CODE (fn) == TEMPLATE_DECL)
- cand = add_template_candidate (&candidates, fn, fromtype,
+ cand = add_template_candidate (&candidates, fn, fromtype,
NULL_TREE,
- args, totype,
- TYPE_BINFO (fromtype),
+ args, totype,
+ TYPE_BINFO (fromtype),
conversion_path,
flags,
DEDUCE_CONV);
- else
+ else
cand = add_function_candidate (&candidates, fn, fromtype,
args,
TYPE_BINFO (fromtype),
conversion_path,
- flags);
+ flags);
if (cand)
{
conversion *ics
- = implicit_conversion (totype,
+ = implicit_conversion (totype,
TREE_TYPE (TREE_TYPE (cand->fn)),
0, convflags);
cand->second_conv = ics;
-
+
if (!ics)
cand->viable = 0;
else if (candidates->viable == 1 && ics->bad_p)
for (t = args; t; t = TREE_CHAIN (t))
{
tree arg = TREE_VALUE (t);
-
+
if (arg == error_mark_node)
return error_mark_node;
else if (VOID_TYPE_P (TREE_TYPE (arg)))
that overload resolution fails, *CANDIDATES will be the set of
candidates considered, and ANY_VIABLE_P will be set to true or
false to indicate whether or not any of the candidates were
- viable.
+ viable.
The ARGS should already have gone through RESOLVE_ARGS before this
function is called. */
static struct z_candidate *
-perform_overload_resolution (tree fn,
- tree args,
+perform_overload_resolution (tree fn,
+ tree args,
struct z_candidate **candidates,
bool *any_viable_p)
{
*any_viable_p = true;
/* Check FN and ARGS. */
- gcc_assert (TREE_CODE (fn) == FUNCTION_DECL
+ gcc_assert (TREE_CODE (fn) == FUNCTION_DECL
|| TREE_CODE (fn) == TEMPLATE_DECL
|| TREE_CODE (fn) == OVERLOAD
|| TREE_CODE (fn) == TEMPLATE_ID_EXPR);
/* Return an expression for a call to FN (a namespace-scope function,
or a static member function) with the ARGS. */
-
+
tree
build_new_function_call (tree fn, tree args)
{
/* Figure out what function is being called. */
cand = perform_overload_resolution (fns, args, &candidates, &any_viable_p);
-
+
/* If no suitable function could be found, issue an error message
and give up. */
if (!cand)
/* Skip the size_t parameter. */
arg_types = TREE_CHAIN (arg_types);
/* Check the remaining parameters (if any). */
- if (arg_types
+ if (arg_types
&& TREE_CHAIN (arg_types) == void_list_node
&& same_type_p (TREE_VALUE (arg_types),
ptr_type_node))
tree fn = OVL_CURRENT (fns);
if (TREE_CODE (fn) == TEMPLATE_DECL)
add_template_candidate (&candidates, fn, base, NULL_TREE,
- mem_args, NULL_TREE,
+ mem_args, NULL_TREE,
TYPE_BINFO (type),
TYPE_BINFO (type),
LOOKUP_NORMAL, DEDUCE_CALL);
for (; fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
- if (TREE_CODE (fn) == TEMPLATE_DECL)
- add_template_conv_candidate
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ add_template_conv_candidate
(&candidates, fn, obj, args, totype,
/*access_path=*/NULL_TREE,
/*conversion_path=*/NULL_TREE);
error ("%s for ternary %<operator?:%> in %<%E ? %E : %E%>",
problem, arg1, arg2, arg3);
break;
-
+
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
error ("%s for %<operator%s%> in %<%E%s%>", problem, opname, arg1, opname);
break;
-
+
case ARRAY_REF:
error ("%s for %<operator[]%> in %<%E[%E]%>", problem, arg1, arg2);
break;
case IMAGPART_EXPR:
error ("%s for %qs in %<%s %E%>", problem, opname, opname, arg1);
break;
-
+
default:
if (arg2)
error ("%s for %<operator%s%> in %<%E %s %E%>",
reference must bind directly (_dcl.init.ref_) to E1. */
if (real_lvalue_p (e2))
{
- conv = implicit_conversion (build_reference_type (t2),
+ conv = implicit_conversion (build_reference_type (t2),
t1,
e1,
LOOKUP_NO_TEMP_BIND);
if (good_base && at_least_as_qualified_p (t2, t1))
{
conv = build_identity_conv (t1, e1);
- if (!same_type_p (TYPE_MAIN_VARIANT (t1),
+ if (!same_type_p (TYPE_MAIN_VARIANT (t1),
TYPE_MAIN_VARIANT (t2)))
conv = build_conv (ck_base, t2, conv);
else
}
/* [expr.cond]
-
+
The first expr ession is implicitly converted to bool (clause
_conv_). */
arg1 = perform_implicit_conversion (boolean_type_node, arg1);
type of the other and is an rvalue.
--Both the second and the third operands have type void; the
- result is of type void and is an rvalue.
+ result is of type void and is an rvalue.
We must avoid calling force_rvalue for expressions of type
"void" because it will complain that their value is being
used. */
- if (TREE_CODE (arg2) == THROW_EXPR
+ if (TREE_CODE (arg2) == THROW_EXPR
&& TREE_CODE (arg3) != THROW_EXPR)
{
if (!VOID_TYPE_P (arg3_type))
arg3_type = TREE_TYPE (arg3);
result_type = arg3_type;
}
- else if (TREE_CODE (arg2) != THROW_EXPR
+ else if (TREE_CODE (arg2) != THROW_EXPR
&& TREE_CODE (arg3) == THROW_EXPR)
{
if (!VOID_TYPE_P (arg2_type))
{
conversion *conv2;
conversion *conv3;
-
+
/* Get the high-water mark for the CONVERSION_OBSTACK. */
p = conversion_obstack_alloc (0);
/* If, after the conversion, both operands have class type,
treat the cv-qualification of both operands as if it were the
- union of the cv-qualification of the operands.
+ union of the cv-qualification of the operands.
The standard is not clear about what to do in this
circumstance. For example, if the first operand has type
if ((conv2 || conv3)
&& CLASS_TYPE_P (arg2_type)
&& TYPE_QUALS (arg2_type) != TYPE_QUALS (arg3_type))
- arg2_type = arg3_type =
+ arg2_type = arg3_type =
cp_build_qualified_type (arg2_type,
TYPE_QUALS (arg2_type)
| TYPE_QUALS (arg3_type));
If the second and third operands are lvalues and have the same
type, the result is of that type and is an lvalue. */
- if (real_lvalue_p (arg2)
- && real_lvalue_p (arg3)
+ if (real_lvalue_p (arg2)
+ && real_lvalue_p (arg3)
&& same_type_p (arg2_type, arg3_type))
{
result_type = arg2_type;
args[0] = arg2;
args[1] = arg3;
args[2] = arg1;
- add_builtin_candidates (&candidates,
- COND_EXPR,
+ add_builtin_candidates (&candidates,
+ COND_EXPR,
NOP_EXPR,
ansi_opname (COND_EXPR),
args,
if (arg2 == error_mark_node || arg3 == error_mark_node)
return error_mark_node;
-
+
/* [expr.cond]
-
+
After those conversions, one of the following shall hold:
--The second and third operands have the same type; the result is of
--The second and third operands have arithmetic or enumeration
type; the usual arithmetic conversions are performed to bring
them to a common type, and the result is of that type. */
- else if ((ARITHMETIC_TYPE_P (arg2_type)
+ else if ((ARITHMETIC_TYPE_P (arg2_type)
|| TREE_CODE (arg2_type) == ENUMERAL_TYPE)
&& (ARITHMETIC_TYPE_P (arg3_type)
|| TREE_CODE (arg3_type) == ENUMERAL_TYPE))
{
/* In this case, there is always a common type. */
- result_type = type_after_usual_arithmetic_conversions (arg2_type,
+ result_type = type_after_usual_arithmetic_conversions (arg2_type,
arg3_type);
-
+
if (TREE_CODE (arg2_type) == ENUMERAL_TYPE
&& TREE_CODE (arg3_type) == ENUMERAL_TYPE)
warning (0, "enumeral mismatch in conditional expression: %qT vs %qT",
|| (TREE_CODE (arg3_type) == ENUMERAL_TYPE
&& !same_type_p (arg2_type, type_promotes_to (arg3_type)))))
warning (0, "enumeral and non-enumeral type in conditional expression");
-
+
arg2 = perform_implicit_conversion (result_type, arg2);
arg3 = perform_implicit_conversion (result_type, arg3);
}
them to a common type, whose cv-qualification shall match the
cv-qualification of either the second or the third operand.
The result is of the common type. */
- else if ((null_ptr_cst_p (arg2)
+ else if ((null_ptr_cst_p (arg2)
&& (TYPE_PTR_P (arg3_type) || TYPE_PTR_TO_MEMBER_P (arg3_type)))
- || (null_ptr_cst_p (arg3)
+ || (null_ptr_cst_p (arg3)
&& (TYPE_PTR_P (arg2_type) || TYPE_PTR_TO_MEMBER_P (arg2_type)))
|| (TYPE_PTR_P (arg2_type) && TYPE_PTR_P (arg3_type))
|| (TYPE_PTRMEM_P (arg2_type) && TYPE_PTRMEM_P (arg3_type))
}
valid_operands:
- result = fold_if_not_in_template (build3 (COND_EXPR, result_type, arg1,
+ result = fold_if_not_in_template (build3 (COND_EXPR, result_type, arg1,
arg2, arg3));
/* We can't use result_type below, as fold might have returned a
throw_expr. */
sometimes wrap them in NOP_EXPRs so the test would fail. */
if (!lvalue_p && CLASS_TYPE_P (TREE_TYPE (result)))
result = get_target_expr (result);
-
+
/* If this expression is an rvalue, but might be mistaken for an
lvalue, we must add a NON_LVALUE_EXPR. */
if (!lvalue_p && real_lvalue_p (result))
ACCESS_PATH, and FLAGS are as for add_function_candidate. */
static void
-add_candidates (tree fns, tree args,
+add_candidates (tree fns, tree args,
tree explicit_targs, bool template_only,
tree conversion_path, tree access_path,
int flags,
/* Delay creating the implicit this parameter until it is needed. */
non_static_args = NULL_TREE;
- while (fns)
+ while (fns)
{
tree fn;
tree fn_args;
fn_args = args;
if (TREE_CODE (fn) == TEMPLATE_DECL)
- add_template_candidate (candidates,
- fn,
+ add_template_candidate (candidates,
+ fn,
ctype,
explicit_targs,
fn_args,
bool strict_p;
bool any_viable_p;
- if (error_operand_p (arg1)
- || error_operand_p (arg2)
+ if (error_operand_p (arg1)
+ || error_operand_p (arg2)
|| error_operand_p (arg3))
return error_mark_node;
fnname = ansi_opname (code);
arg1 = prep_operand (arg1);
-
+
switch (code)
{
case NEW_EXPR:
arg2 = prep_operand (arg2);
arg3 = prep_operand (arg3);
-
+
if (code == COND_EXPR)
{
if (arg2 == NULL_TREE
goto user_defined_result_ready;
}
if (fns)
- add_candidates (BASELINK_FUNCTIONS (fns), arglist,
+ add_candidates (BASELINK_FUNCTIONS (fns), arglist,
NULL_TREE, false,
BASELINK_BINFO (fns),
TYPE_BINFO (TREE_TYPE (arg1)),
default:
strict_p = pedantic;
break;
- }
+ }
candidates = splice_viable (candidates, strict_p, &any_viable_p);
if (!any_viable_p)
if (flags & LOOKUP_COMPLAIN)
pedwarn ("no %<%D(int)%> declared for postfix %qs, "
"trying prefix operator instead",
- fnname,
+ fnname,
operator_name_info[code].name);
if (code == POSTINCREMENT_EXPR)
code = PREINCREMENT_EXPR;
else
- code = PREDECREMENT_EXPR;
+ code = PREDECREMENT_EXPR;
result = build_new_op (code, flags, arg1, NULL_TREE, NULL_TREE,
overloaded_p);
break;
case LE_EXPR:
case EQ_EXPR:
case NE_EXPR:
- if (TREE_CODE (TREE_TYPE (arg1)) == ENUMERAL_TYPE
- && TREE_CODE (TREE_TYPE (arg2)) == ENUMERAL_TYPE
+ if (TREE_CODE (TREE_TYPE (arg1)) == ENUMERAL_TYPE
+ && TREE_CODE (TREE_TYPE (arg2)) == ENUMERAL_TYPE
&& (TYPE_MAIN_VARIANT (TREE_TYPE (arg1))
!= TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
{
- warning (0, "comparison between %q#T and %q#T",
+ warning (0, "comparison between %q#T and %q#T",
TREE_TYPE (arg1), TREE_TYPE (arg2));
}
break;
fnname = ansi_opname (code);
- if (CLASS_TYPE_P (type)
+ if (CLASS_TYPE_P (type)
&& COMPLETE_TYPE_P (complete_type (type))
&& !global_p)
/* In [class.free]
If the result of the lookup is ambiguous or inaccessible, or if
the lookup selects a placement deallocation function, the
program is ill-formed.
-
+
Therefore, we ask lookup_fnfields to complain about ambiguity. */
{
fns = lookup_fnfields (TYPE_BINFO (type), fnname, 1);
the first pass, we look for a one-operator (or placement)
operator delete. If we're not doing placement delete, then on
the second pass we look for a two-argument delete. */
- for (pass = 0; pass < (placement ? 1 : 2); ++pass)
+ for (pass = 0; pass < (placement ? 1 : 2); ++pass)
{
/* Go through the `operator delete' functions looking for one
with a matching type. */
- for (fn = BASELINK_P (fns) ? BASELINK_FUNCTIONS (fns) : fns;
- fn;
+ for (fn = BASELINK_P (fns) ? BASELINK_FUNCTIONS (fns) : fns;
+ fn;
fn = OVL_NEXT (fn))
{
tree t;
if (pass == 0)
args = tree_cons (NULL_TREE, addr, args);
else
- args = tree_cons (NULL_TREE, addr,
+ args = tree_cons (NULL_TREE, addr,
build_tree_list (NULL_TREE, size));
if (placement)
enforce_access (tree basetype_path, tree decl)
{
gcc_assert (TREE_CODE (basetype_path) == TREE_BINFO);
-
+
if (!accessible_p (basetype_path, decl, true))
{
if (TREE_PRIVATE (decl))
{
build_special_member_call (NULL_TREE,
complete_ctor_identifier,
- build_tree_list (NULL_TREE, expr),
+ build_tree_list (NULL_TREE, expr),
type,
LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING
| LOOKUP_NO_CONVERSION
to NULL. */
static tree
-build_temp (tree expr, tree type, int flags,
+build_temp (tree expr, tree type, int flags,
void (**diagnostic_fn)(const char *, ...))
{
int savew, savee;
-
+
savew = warningcount, savee = errorcount;
expr = build_special_member_call (NULL_TREE,
complete_ctor_identifier,
- build_tree_list (NULL_TREE, expr),
+ build_tree_list (NULL_TREE, expr),
type, flags);
if (warningcount > savew)
*diagnostic_fn = warning0;
*diagnostic_fn = NULL;
return expr;
}
-
+
/* Perform the conversions in CONVS on the expression EXPR. FN and
ARGNUM are used for diagnostics. ARGNUM is zero based, -1
conversions to inaccessible bases are permitted. */
static tree
-convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
+convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
int inner, bool issue_conversion_warnings,
bool c_cast_p)
{
pedwarn (" initializing argument %P of %qD", argnum, fn);
return cp_convert (totype, expr);
}
-
+
if (issue_conversion_warnings)
{
tree t = non_reference (totype);
variable. */
else if (TYPE_UNSIGNED (t) && TREE_CODE (t) != BOOLEAN_TYPE)
{
- if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr))
+ if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr))
{
if (fn)
warning (0, "passing negative value %qE for argument %P to %qD",
else
warning (0, "converting negative value %qE to %qT", expr, t);
}
-
+
overflow_warning (expr);
}
}
if (IS_AGGR_TYPE (totype)
&& (inner >= 0 || !lvalue_p (expr)))
{
- expr = (build_temp
- (expr, totype,
+ expr = (build_temp
+ (expr, totype,
/* Core issue 84, now a DR, says that we don't
allow UDCs for these args (which deliberately
breaks copy-init of an auto_ptr<Base> from an
auto_ptr<Derived>). */
LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING|LOOKUP_NO_CONVERSION,
&diagnostic_fn));
-
+
if (diagnostic_fn)
{
if (fn)
- diagnostic_fn
+ diagnostic_fn
(" initializing argument %P of %qD from result of %qD",
argnum, fn, convfn);
else
- diagnostic_fn
+ diagnostic_fn
(" initializing temporary from result of %qD", convfn);
}
expr = build_cplus_new (totype, expr);
copy constructor, and we'll end up with an infinite
loop. If we can use a bitwise copy, then we'll be
OK. */
- if ((lvalue & clk_packed)
- && CLASS_TYPE_P (type)
+ if ((lvalue & clk_packed)
+ && CLASS_TYPE_P (type)
&& !TYPE_HAS_TRIVIAL_INIT_REF (type))
{
error ("cannot bind packed field %qE to %qT",
/* Convert it to a pointer to the type referred to by the
reference. This will adjust the pointer if a derived to
base conversion is being performed. */
- expr = cp_convert (build_pointer_type (TREE_TYPE (ref_type)),
+ expr = cp_convert (build_pointer_type (TREE_TYPE (ref_type)),
expr);
/* Convert the pointer to the desired reference type. */
return build_nop (ref_type, expr);
arg = perform_integral_promotions (arg);
arg = require_complete_type (arg);
-
+
if (arg != error_mark_node
&& !pod_type_p (TREE_TYPE (arg)))
{
/* Undefined behavior [expr.call] 5.2.2/7. We used to just warn
here and do a bitwise copy, but now cp_expr_size will abort if we
- try to do that.
- If the call appears in the context of a sizeof expression,
- there is no need to emit a warning, since the expression won't be
+ try to do that.
+ If the call appears in the context of a sizeof expression,
+ there is no need to emit a warning, since the expression won't be
evaluated. We keep the builtin_trap just as a safety check. */
if (!skip_evaluation)
warning (0, "cannot pass objects of non-POD type %q#T through %<...%>; "
{
if (processing_template_decl)
return build_min (VA_ARG_EXPR, type, expr);
-
+
type = complete_type_or_else (type, NULL_TREE);
if (expr == error_mark_node || !type)
return error_mark_node;
-
+
if (! pod_type_p (type))
{
/* Undefined behavior [expr.call] 5.2.2/7. */
expr = build_indirect_ref (expr, NULL);
return expr;
}
-
+
return build_va_arg (expr, type);
}
promote = type_promotes_to (type);
if (same_type_p (type, promote))
promote = type;
-
+
return promote;
}
parm = TREE_CHAIN (parm);
/* We should never try to call the abstract constructor. */
gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (fn));
-
+
if (DECL_HAS_VTT_PARM_P (fn))
{
converted_args = tree_cons
arg = TREE_CHAIN (arg);
parm = TREE_CHAIN (parm);
}
- }
+ }
/* Bypass access control for 'this' parameter. */
else if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
{
tree argtype = TREE_TYPE (TREE_VALUE (arg));
tree converted_arg;
tree base_binfo;
-
+
if (convs[i]->bad_p)
pedwarn ("passing %qT as %<this%> argument of %q#D discards qualifiers",
TREE_TYPE (argtype), fn);
cand->conversion_path,
1);
/* Check that the base class is accessible. */
- if (!accessible_base_p (TREE_TYPE (argtype),
+ if (!accessible_base_p (TREE_TYPE (argtype),
BINFO_TYPE (cand->conversion_path), true))
error ("%qT is not an accessible base of %qT",
BINFO_TYPE (cand->conversion_path),
TREE_TYPE (parmtype), ba_unique, NULL);
converted_arg = build_base_path (PLUS_EXPR, converted_arg,
base_binfo, 1);
-
+
converted_args = tree_cons (NULL_TREE, converted_arg, converted_args);
parm = TREE_CHAIN (parm);
arg = TREE_CHAIN (arg);
/* Default arguments */
for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm), i++)
- converted_args
- = tree_cons (NULL_TREE,
- convert_default_arg (TREE_VALUE (parm),
+ converted_args
+ = tree_cons (NULL_TREE,
+ convert_default_arg (TREE_VALUE (parm),
TREE_PURPOSE (parm),
fn, i - is_method),
converted_args);
if (TREE_CODE (targ) == ADDR_EXPR)
{
targ = TREE_OPERAND (targ, 0);
- if (!same_type_ignoring_top_level_qualifiers_p
+ if (!same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (TREE_TYPE (arg)), TREE_TYPE (targ)))
targ = NULL_TREE;
}
t = convert (TREE_TYPE (TREE_VALUE (args)), t);
val = build_indirect_ref (t, 0);
}
-
+
return val;
}
DECL_CONTEXT (fn),
ba_any, NULL);
gcc_assert (binfo && binfo != error_mark_node);
-
+
*p = build_base_path (PLUS_EXPR, *p, binfo, 1);
if (TREE_SIDE_EFFECTS (*p))
*p = save_expr (*p);
/* If this call might throw an exception, note that fact. */
fndecl = get_callee_fndecl (fn);
- if ((!fndecl || !TREE_NOTHROW (fndecl))
+ if ((!fndecl || !TREE_NOTHROW (fndecl))
&& at_function_scope_p ()
&& cfun)
cp_function_chain->can_throw = 1;
tree lookup_args, lookup_fn, method, idx;
tree klass_ref, iface, iface_ref;
int i;
-
+
if (!java_iface_lookup_fn)
{
tree endlink = build_void_list_node ();
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, java_int_type_node,
endlink)));
- java_iface_lookup_fn
+ java_iface_lookup_fn
= builtin_function ("_Jv_LookupInterfaceMethodIdx",
build_function_type (ptr_type_node, t),
0, NOT_BUILT_IN, NULL, NULL_TREE);
}
- /* Look up the pointer to the runtime java.lang.Class object for `instance'.
+ /* Look up the pointer to the runtime java.lang.Class object for `instance'.
This is the first entry in the vtable. */
- klass_ref = build_vtbl_ref (build_indirect_ref (instance, 0),
+ klass_ref = build_vtbl_ref (build_indirect_ref (instance, 0),
integer_zero_node);
/* Get the java.lang.Class pointer for the interface being called. */
if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL
|| DECL_CONTEXT (iface_ref) != iface)
{
- error ("could not find class$ field in java interface type %qT",
+ error ("could not find class$ field in java interface type %qT",
iface);
return error_mark_node;
}
iface_ref = build_address (iface_ref);
iface_ref = convert (build_pointer_type (iface), iface_ref);
-
+
/* Determine the itable index of FN. */
i = 1;
for (method = TYPE_METHODS (iface); method; method = TREE_CHAIN (method))
}
idx = build_int_cst (NULL_TREE, i);
- lookup_args = tree_cons (NULL_TREE, klass_ref,
+ lookup_args = tree_cons (NULL_TREE, klass_ref,
tree_cons (NULL_TREE, iface_ref,
build_tree_list (NULL_TREE, idx)));
- lookup_fn = build1 (ADDR_EXPR,
+ lookup_fn = build1 (ADDR_EXPR,
build_pointer_type (TREE_TYPE (java_iface_lookup_fn)),
java_iface_lookup_fn);
return build3 (CALL_EXPR, ptr_type_node, lookup_fn, lookup_args, NULL_TREE);
/* Returns the value to use for the in-charge parameter when making a
call to a function with the indicated NAME.
-
+
FIXME:Can't we find a neater way to do this mapping? */
tree
store the newly constructed object into a VAR_DECL. */
tree
-build_special_member_call (tree instance, tree name, tree args,
+build_special_member_call (tree instance, tree name, tree args,
tree binfo, int flags)
{
tree fns;
binfo = TYPE_BINFO (binfo);
}
-
+
gcc_assert (binfo != NULL_TREE);
class_type = BINFO_TYPE (binfo);
}
else
{
- if (name == complete_dtor_identifier
+ if (name == complete_dtor_identifier
|| name == base_dtor_identifier
|| name == deleting_dtor_identifier)
gcc_assert (args == NULL_TREE);
/* Convert to the base class, if necessary. */
- if (!same_type_ignoring_top_level_qualifiers_p
+ if (!same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (instance), BINFO_TYPE (binfo)))
{
if (name != ansi_assopname (NOP_EXPR))
binfo, /*nonnull=*/1);
}
}
-
+
gcc_assert (instance != NULL_TREE);
fns = lookup_fnfields (binfo, name, 1);
-
+
/* When making a call to a constructor or destructor for a subobject
that uses virtual base classes, pass down a pointer to a VTT for
the subobject. */
args = tree_cons (NULL_TREE, sub_vtt, args);
}
- return build_new_method_call (instance, fns, args,
- TYPE_BINFO (BINFO_TYPE (binfo)),
+ return build_new_method_call (instance, fns, args,
+ TYPE_BINFO (BINFO_TYPE (binfo)),
flags);
}
/* Return the NAME, as a C string. The NAME indicates a function that
is a member of TYPE. *FREE_P is set to true if the caller must
- free the memory returned.
+ free the memory returned.
Rather than go through all of this, we should simply set the names
of constructors and destructors appropriately, and dispense with
/* Constructors and destructors are special. */
if (IDENTIFIER_CTOR_OR_DTOR_P (name))
{
- pretty_name
+ pretty_name
= (char *) IDENTIFIER_POINTER (constructor_name (type));
/* For a destructor, add the '~'. */
if (name == complete_dtor_identifier
/* Build a call to "INSTANCE.FN (ARGS)". */
tree
-build_new_method_call (tree instance, tree fns, tree args,
+build_new_method_call (tree instance, tree fns, tree args,
tree conversion_path, int flags)
{
struct z_candidate *candidates = 0, *cand;
gcc_assert (instance != NULL_TREE);
- if (error_operand_p (instance)
+ if (error_operand_p (instance)
|| error_operand_p (fns)
|| args == error_mark_node)
return error_mark_node;
if (TREE_CODE (t) == TEMPLATE_DECL)
/* A member template. */
- add_template_candidate (&candidates, t,
+ add_template_candidate (&candidates, t,
class_type,
explicit_targs,
this_arglist, optype,
- access_binfo,
+ access_binfo,
conversion_path,
flags,
DEDUCE_CALL);
else if (! template_only)
- add_function_candidate (&candidates, t,
+ add_function_candidate (&candidates, t,
class_type,
this_arglist,
access_binfo,
|| DECL_DESTRUCTOR_P (current_function_decl)))
/* This is not an error, it is runtime undefined
behavior. */
- warning (0, (DECL_CONSTRUCTOR_P (current_function_decl) ?
+ warning (0, (DECL_CONSTRUCTOR_P (current_function_decl) ?
"abstract virtual %q#D called from constructor"
: "abstract virtual %q#D called from destructor"),
cand->fn);
-
+
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
&& is_dummy_object (instance_ptr))
{
- error ("cannot call member function %qD without object",
+ error ("cannot call member function %qD without object",
cand->fn);
call = error_mark_node;
}
out to be a static member function, `a' is
none-the-less evaluated. */
if (TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE
- && !is_dummy_object (instance_ptr)
+ && !is_dummy_object (instance_ptr)
&& TREE_SIDE_EFFECTS (instance))
- call = build2 (COMPOUND_EXPR, TREE_TYPE (call),
+ call = build2 (COMPOUND_EXPR, TREE_TYPE (call),
instance, call);
}
}
if (ics2->kind == ics1->kind
&& same_type_p (ics2->type, ics1->type)
- && same_type_p (ics2->u.next->type,
+ && same_type_p (ics2->u.next->type,
ics1->u.next->type))
return true;
}
if ((*ics)->this_p)
{
/* [over.match.funcs]
-
+
For non-static member functions, the type of the
implicit object parameter is "reference to cv X"
where X is the class of which the function is a
if (t->kind == ck_ptr)
t = t->u.next;
t = build_identity_conv (TREE_TYPE (t->type), NULL_TREE);
- t = direct_reference_binding (reference_type, t);
+ t = direct_reference_binding (reference_type, t);
*ics = t;
}
}
--a standard conversion sequence (_over.ics.scs_) is a better
conversion sequence than a user-defined conversion sequence
or an ellipsis conversion sequence, and
-
+
--a user-defined conversion sequence (_over.ics.user_) is a
better conversion sequence than an ellipsis conversion sequence
(_over.ics.ellipsis_). */
rank1 = CONVERSION_RANK (ics1);
rank2 = CONVERSION_RANK (ics2);
-
+
if (rank1 > rank2)
return -1;
else if (rank1 < rank2)
conversion *t1;
conversion *t2;
- /* We're dealing with two standard conversion sequences.
+ /* We're dealing with two standard conversion sequences.
[over.ics.rank]
-
+
Standard conversion sequence S1 is a better conversion
sequence than standard conversion sequence S2 if
-
+
--S1 is a proper subsequence of S2 (comparing the conversion
sequences in the canonical form defined by _over.ics.scs_,
excluding any Lvalue Transformation; the identity
conversion sequence is considered to be a subsequence of
any non-identity conversion sequence */
-
+
t1 = ics1;
while (t1->kind != ck_identity)
t1 = t1->u.next;
from_type1 = t1->type;
-
+
t2 = ics2;
while (t2->kind != ck_identity)
t2 = t2->u.next;
--A conversion that is not a conversion of a pointer, or pointer
to member, to bool is better than another conversion that is such
- a conversion.
+ a conversion.
The ICS_STD_RANK automatically handles the pointer-to-bool rule,
so that we do not have to check it explicitly. */
&& IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type1))
&& IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type2)))
{
- /* This was one of the pointer or pointer-like conversions.
+ /* This was one of the pointer or pointer-like conversions.
[over.ics.rank]
-
+
--If class B is derived directly or indirectly from class A,
conversion of B* to A* is better than conversion of B* to
void*, and conversion of A* to void* is better than
--If class B is derived directly or indirectly from class A
and class C is derived directly or indirectly from B,
-
+
--conversion of C* to B* is better than conversion of C* to
- A*,
-
+ A*,
+
--conversion of B* to A* is better than conversion of C* to
A* */
if (same_type_p (deref_from_type1, deref_from_type2))
tree from = non_reference (from_type1);
/* [over.ics.rank]
-
+
--binding of an expression of type C to a reference of type
B& is better than binding an expression of type C to a
reference of type A&
--binding of an expression of type B to a reference of type
A& is better than binding an expression of type C to a
- reference of type A&,
+ reference of type A&,
--conversion of B to A is better than conversion of C to A */
if (is_properly_derived_from (from_type1, to)
return comp_cv_qual_signature (to_type1, to_type2);
/* [over.ics.rank]
-
+
--S1 and S2 are reference bindings (_dcl.init.ref_), and the
types to which the references refer are the same type except for
top-level cv-qualifiers, and the type to which the reference
initialized by S2 refers is more cv-qualified than the type to
which the reference initialized by S1 refers */
-
+
if (target_type1 && target_type2
&& same_type_ignoring_top_level_qualifiers_p (to_type1, to_type2))
return comp_cv_qualification (target_type2, target_type1);
int static_2 = DECL_STATIC_FUNCTION_P (cand2->fn);
gcc_assert (static_1 != static_2);
-
+
if (static_1)
off2 = 1;
else
{
struct z_candidate *w, *l;
bool give_warning = false;
-
+
if (winner == 1)
w = cand1, l = cand2;
else
w = cand2, l = cand1;
-
+
/* We don't want to complain about `X::operator T1 ()'
beating `X::operator T2 () const', when T2 is a no less
cv-qualified version of T1. */
{
tree t = TREE_TYPE (TREE_TYPE (l->fn));
tree f = TREE_TYPE (TREE_TYPE (w->fn));
-
+
if (TREE_CODE (t) == TREE_CODE (f) && POINTER_TYPE_P (t))
{
t = TREE_TYPE (t);
}
else
give_warning = true;
-
+
if (!give_warning)
/*NOP*/;
else if (warn)
/* or, if not that,
F1 is a non-template function and F2 is a template function
specialization. */
-
+
if (!cand1->template_decl && cand2->template_decl)
return 1;
else if (cand1->template_decl && !cand2->template_decl)
return -1;
-
+
/* or, if not that,
F1 and F2 are template functions and the function template for F1 is
more specialized than the template for F2 according to the partial
ordering rules. */
-
+
if (cand1->template_decl && cand2->template_decl)
{
winner = more_specialized_fn
if (winner)
return winner;
}
-
+
/* Check whether we can discard a builtin candidate, either because we
have two identical ones or matching builtin and non-builtin candidates.
(Pedantically in the latter case the builtin which matched the user
function should not be added to the overload set, but we spot it here.
-
+
[over.match.oper]
... the builtin candidates include ...
- do not have the same parameter type list as any non-template
non-member candidate. */
-
+
if (TREE_CODE (cand1->fn) == IDENTIFIER_NODE
|| TREE_CODE (cand2->fn) == IDENTIFIER_NODE)
{
if (DECL_P (cand1->fn) && DECL_P (cand2->fn)
&& equal_functions (cand1->fn, cand2->fn))
return 1;
-
+
tweak:
/* Extension: If the worst conversion for one candidate is worse than the
/* Make sure the champ is better than all the candidates it hasn't yet
been compared to. */
- for (challenger = candidates;
- challenger != champ
+ for (challenger = candidates;
+ challenger != champ
&& !(champ_compared_to_predecessor && challenger->next == champ);
challenger = challenger->next)
{
cast. */
tree
-perform_direct_initialization_if_possible (tree type,
+perform_direct_initialization_if_possible (tree type,
tree expr,
bool c_cast_p)
{
if (!conv || conv->bad_p)
expr = NULL_TREE;
else
- expr = convert_like_real (conv, expr, NULL_TREE, 0, 0,
+ expr = convert_like_real (conv, expr, NULL_TREE, 0, 0,
/*issue_conversion_warnings=*/false,
c_cast_p);
with the indicated TYPE; this variable will store the value to
which the reference is bound. */
-tree
+tree
make_temporary_var_for_ref_to_temp (tree decl, tree type)
{
tree var;
type, TREE_TYPE (expr));
else
error ("invalid initialization of reference of type "
- "%qT from expression of type %qT", type,
+ "%qT from expression of type %qT", type,
TREE_TYPE (expr));
return error_mark_node;
}
full-expression in which they are created.
In that case, we store the converted expression into a new
- VAR_DECL in a new scope.
+ VAR_DECL in a new scope.
However, we want to be careful not to create temporaries when
they are not required. For example, given:
- struct B {};
+ struct B {};
struct D : public B {};
D f();
const B& b = f();
/* Use its address to initialize the reference variable. */
expr = build_address (var);
if (base_conv_type)
- expr = convert_to_base (expr,
+ expr = convert_to_base (expr,
build_pointer_type (base_conv_type),
/*check_access=*/true,
/*nonnull=*/true);
expr = build_unary_op (ADDR_EXPR, expr, 0);
/* If a BASE_CONV was required, perform it now. */
if (base_conv_type)
- expr = (perform_implicit_conversion
+ expr = (perform_implicit_conversion
(build_pointer_type (base_conv_type), expr));
expr = build_nop (type, expr);
}
&& SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), probe))
|| (code == PLUS_EXPR
&& SAME_BINFO_TYPE_P (BINFO_TYPE (d_binfo), probe)));
-
+
if (binfo == d_binfo)
/* Nothing to do. */
return expr;
else
v_offset = build_vfield_ref (build_indirect_ref (expr, NULL),
TREE_TYPE (TREE_TYPE (expr)));
-
+
v_offset = build2 (PLUS_EXPR, TREE_TYPE (v_offset),
v_offset, BINFO_VPTR_FIELD (v_binfo));
- v_offset = build1 (NOP_EXPR,
+ v_offset = build1 (NOP_EXPR,
build_pointer_type (ptrdiff_type_node),
v_offset);
v_offset = build_indirect_ref (v_offset, NULL);
TREE_INVARIANT (v_offset) = 1;
offset = convert_to_integer (ptrdiff_type_node,
- size_diffop (offset,
+ size_diffop (offset,
BINFO_OFFSET (v_binfo)));
if (!integer_zerop (offset))
}
target_type = code == PLUS_EXPR ? BINFO_TYPE (binfo) : BINFO_TYPE (d_binfo);
-
+
target_type = cp_build_qualified_type
(target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr))));
ptr_target_type = build_pointer_type (target_type);
if (want_pointer)
target_type = ptr_target_type;
-
+
expr = build1 (NOP_EXPR, ptr_target_type, expr);
if (!integer_zerop (offset))
expr = build2 (code, ptr_target_type, expr, offset);
else
null_test = NULL;
-
+
if (!want_pointer)
expr = build_indirect_ref (expr, NULL);
if (d_binfo == NULL_TREE)
{
tree temp;
-
+
gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type);
-
+
/* Transform `(a, b).x' into `(*(a, &b)).x', `(a ? b : c).x'
into `(*(a ? &b : &c)).x', and so on. A COND_EXPR is only
an lvalue in the frontend; only _DECLs and _REFs are lvalues
cp_build_qualified_type (type, type_quals),
expr, field, NULL_TREE);
expr = fold_if_not_in_template (expr);
-
+
/* Mark the expression const or volatile, as appropriate.
Even though we've dealt with the type above, we still have
to mark the expression itself. */
TREE_READONLY (expr) = 1;
if (type_quals & TYPE_QUAL_VOLATILE)
TREE_THIS_VOLATILE (expr) = 1;
-
+
return expr;
}
object_type = TREE_TYPE (object);
binfo = lookup_base (object_type, type,
- check_access ? ba_check : ba_unique,
+ check_access ? ba_check : ba_unique,
NULL);
if (!binfo || binfo == error_mark_node)
return error_mark_node;
pointer_type = build_pointer_type (expr_type);
expr = build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1);
if (!integer_zerop (BINFO_OFFSET (base)))
- expr = build2 (PLUS_EXPR, pointer_type, expr,
+ expr = build2 (PLUS_EXPR, pointer_type, expr,
build_nop (pointer_type, BINFO_OFFSET (base)));
expr = build_nop (build_pointer_type (BINFO_TYPE (base)), expr);
expr = build1 (INDIRECT_REF, BINFO_TYPE (base), expr);
if (!vtbl)
vtbl = build_vfield_ref (instance, basetype);
-
+
assemble_external (vtbl);
aref = build_array_ref (vtbl, idx);
is rather important that such things be ignored because any
effort to actually generate DWARF for them will run into
trouble when/if we encounter code like:
-
+
#pragma interface
struct S { virtual void member (); };
-
+
because the artificial declaration of the vtable itself (as
manufactured by the g++ front end) will say that the vtable is
a static member of `S' but only *after* the debug output for
impossible to actually build the vtable, but is useful to get at those
which are known to exist in the runtime. */
-tree
+tree
get_vtable_decl (tree type, int complete)
{
tree decl;
if (CLASSTYPE_VTABLES (type))
return CLASSTYPE_VTABLES (type);
-
+
decl = build_vtable (type, get_vtable_name (type), vtbl_type_node);
CLASSTYPE_VTABLES (type) = decl;
tree virtuals;
decl = get_vtable_decl (type, /*complete=*/0);
-
+
if (binfo)
{
if (BINFO_NEW_VTABLE_MARKED (binfo))
/* We have already created a vtable for this base, so there's
no need to do it again. */
return 0;
-
+
virtuals = copy_list (BINFO_VIRTUALS (binfo));
TREE_TYPE (decl) = TREE_TYPE (get_vtbl_decl_for_binfo (binfo));
DECL_SIZE (decl) = TYPE_SIZE (TREE_TYPE (decl));
/* Remember that we've created a vtable for this BINFO, so that we
don't try to do so again. */
SET_BINFO_NEW_VTABLE_MARKED (binfo);
-
+
/* Make fresh virtual list, so we can smash it later. */
BINFO_VIRTUALS (binfo) = copy_list (BINFO_VIRTUALS (binfo));
static void
modify_vtable_entry (tree t,
- tree binfo,
- tree fndecl,
- tree delta,
+ tree binfo,
+ tree fndecl,
+ tree delta,
tree *virtuals)
{
tree v;
else if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method))
{
slot = CLASSTYPE_DESTRUCTOR_SLOT;
-
+
if (TYPE_FOR_JAVA (type))
{
if (!DECL_ARTIFICIAL (method))
insert_p = true;
/* See if we already have an entry with this name. */
- for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
+ for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
VEC_iterate (tree, method_vec, slot, m);
++slot)
{
}
}
current_fns = insert_p ? NULL_TREE : VEC_index (tree, method_vec, slot);
-
+
if (processing_template_decl)
/* TYPE is a template class. Don't issue any errors now; wait
until instantiation time to complain. */
&& (TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms1)))
!= TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms2)))))
same = 0;
-
+
/* For templates, the template parms must be identical. */
if (TREE_CODE (fn) == TEMPLATE_DECL
&& !comp_template_parms (DECL_TEMPLATE_PARMS (fn),
DECL_TEMPLATE_PARMS (method)))
same = 0;
-
+
if (! DECL_STATIC_FUNCTION_P (fn))
parms1 = TREE_CHAIN (parms1);
if (! DECL_STATIC_FUNCTION_P (method))
parms2 = TREE_CHAIN (parms2);
- if (same && compparms (parms1, parms2)
- && (!DECL_CONV_FN_P (fn)
+ if (same && compparms (parms1, parms2)
+ && (!DECL_CONV_FN_P (fn)
|| same_type_p (TREE_TYPE (TREE_TYPE (fn)),
TREE_TYPE (TREE_TYPE (method)))))
{
cp_error_at ("%q#D cannot be overloaded", method);
cp_error_at ("with %q#D", fn);
}
-
+
/* We don't call duplicate_decls here to merge the
declarations because that will confuse things if the
methods have inline definitions. In particular, we
}
}
- /* Add the new binding. */
+ /* Add the new binding. */
overload = build_overload (method, current_fns);
-
+
if (!conv_p && slot >= CLASSTYPE_FIRST_CONVERSION_SLOT && !complete_p)
push_class_level_binding (DECL_NAME (method), overload);
tree old_value;
gcc_assert (!processing_template_decl && decl);
-
+
old_value = lookup_member (t, name, /*protect=*/0, /*want_type=*/false);
if (old_value)
{
else
old_value = NULL_TREE;
}
-
+
cp_emit_debug_info_for_using (decl, current_class_type);
-
+
if (is_overloaded_fn (decl))
flist = decl;
cp_error_at (" because of local member %q#D with same name", old_value);
return;
}
-
+
/* Make type T see field decl FDECL with access ACCESS. */
if (flist)
for (; flist; flist = OVL_NEXT (flist))
tree basetype = TREE_TYPE (base_binfo);
gcc_assert (COMPLETE_TYPE_P (basetype));
-
+
/* Effective C++ rule 14. We only need to check TYPE_POLYMORPHIC_P
here because the case of virtual functions but non-virtual
dtor is handled in finish_struct_1. */
/* A lot of properties from the bases also apply to the derived
class. */
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype);
- TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (basetype);
- TYPE_HAS_COMPLEX_ASSIGN_REF (t)
+ TYPE_HAS_COMPLEX_ASSIGN_REF (t)
|= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype);
TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype);
TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (basetype);
- CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t)
+ CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t)
|= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype);
}
}
{
tree parent = BINFO_INHERITANCE_CHAIN (base_binfo);
tree parent_primary = CLASSTYPE_PRIMARY_BINFO (BINFO_TYPE (parent));
-
+
if (parent_primary
&& SAME_BINFO_TYPE_P (BINFO_TYPE (base_binfo),
BINFO_TYPE (parent_primary)))
else
{
tree delta;
-
+
BINFO_PRIMARY_P (this_primary) = 1;
BINFO_INHERITANCE_CHAIN (this_primary) = base_binfo;
-
+
/* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a
primary base, make sure the offsets match. */
BINFO_OFFSET (base_binfo)),
convert (ssizetype,
BINFO_OFFSET (this_primary)));
-
+
propagate_binfo_offsets (this_primary, delta);
}
}
/* Remember the first candidate. */
primary = base_binfo;
}
-
+
found:
/* If we've got a primary base, use it. */
if (primary)
{
tree basetype = BINFO_TYPE (primary);
-
+
CLASSTYPE_PRIMARY_BINFO (t) = primary;
if (BINFO_PRIMARY_P (primary))
/* We are stealing a primary base. */
base, make sure the offsets match. */
delta = size_diffop (ssize_int (0),
convert (ssizetype, BINFO_OFFSET (primary)));
-
+
propagate_binfo_offsets (primary, delta);
}
-
+
primary = TYPE_BINFO (basetype);
-
+
TYPE_VFIELD (t) = TYPE_VFIELD (basetype);
BINFO_VTABLE (type_binfo) = BINFO_VTABLE (primary);
BINFO_VIRTUALS (type_binfo) = BINFO_VIRTUALS (primary);
finish_struct_bits (tree t)
{
tree variants;
-
+
/* Fix up variants (if any). */
for (variants = TYPE_NEXT_VARIANT (t);
variants;
the TYPE_LANG_SPECIFIC component, so they are not shared. */
TYPE_HAS_CONSTRUCTOR (variants) = TYPE_HAS_CONSTRUCTOR (t);
TYPE_NEEDS_CONSTRUCTING (variants) = TYPE_NEEDS_CONSTRUCTING (t);
- TYPE_HAS_NONTRIVIAL_DESTRUCTOR (variants)
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (variants)
= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
TYPE_POLYMORPHIC_P (variants) = TYPE_POLYMORPHIC_P (t);
-
+
TYPE_BINFO (variants) = TYPE_BINFO (t);
/* Copy whatever these are holding today. */
recalculate what's really an abstract virtual at this point (by
looking in the vtables). */
get_pure_virtuals (t);
-
+
/* If this type has a copy constructor or a destructor, force its
mode to be BLKmode, and force its TREE_ADDRESSABLE bit to be
nonzero. This will cause it to be passed by invisible reference
}
/* Issue warnings about T having private constructors, but no friends,
- and so forth.
+ and so forth.
HAS_NONPRIVATE_METHOD is nonzero if T has any non-private methods or
static members. HAS_NONPRIVATE_STATIC_FN is nonzero if T has any
/* We will have warned when the template was declared; there's
no need to warn on every instantiation. */
|| CLASSTYPE_TEMPLATE_INSTANTIATION (t))
- /* There's no reason to even consider warning about this
+ /* There's no reason to even consider warning about this
class. */
return;
-
+
/* We only issue one warning, if more than one applies, because
otherwise, on code like:
for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
/* We're not interested in compiler-generated methods; they don't
provide any way to call private members. */
- if (!DECL_ARTIFICIAL (fn))
+ if (!DECL_ARTIFICIAL (fn))
{
if (!TREE_PRIVATE (fn))
{
- if (DECL_STATIC_FUNCTION_P (fn))
+ if (DECL_STATIC_FUNCTION_P (fn))
/* A non-private static member function is just like a
friend; it can create and invoke private member
functions, and be accessed without a class
instance. */
return;
-
+
has_nonprivate_method = 1;
/* Keep searching for a static member function. */
}
else if (!DECL_CONSTRUCTOR_P (fn) && !DECL_DESTRUCTOR_P (fn))
has_member_fn = 1;
- }
+ }
- if (!has_nonprivate_method && has_member_fn)
+ if (!has_nonprivate_method && has_member_fn)
{
/* There are no non-private methods, and there's at least one
private member function that isn't a constructor or
constructors/destructors.) */
unsigned i;
tree binfo = TYPE_BINFO (t);
-
+
for (i = 0; i != BINFO_N_BASE_BINFOS (binfo); i++)
if (BINFO_BASE_ACCESS (binfo, i) != access_private_node)
{
has_nonprivate_method = 1;
break;
}
- if (!has_nonprivate_method)
+ if (!has_nonprivate_method)
{
warning (0, "all member functions in class %qT are private", t);
return;
if (TYPE_HAS_CONSTRUCTOR (t))
{
int nonprivate_ctor = 0;
-
+
/* If a non-template class does not define a copy
constructor, one is defined for it, enabling it to avoid
this warning. For a template class, this does not
happen, and so we would normally get a warning on:
- template <class T> class C { private: C(); };
-
+ template <class T> class C { private: C(); };
+
To avoid this asymmetry, we check TYPE_HAS_INIT_REF. All
complete non-template or fully instantiated classes have this
flag set. */
if (!TYPE_HAS_INIT_REF (t))
nonprivate_ctor = 1;
- else
- for (fn = CLASSTYPE_CONSTRUCTORS (t); fn; fn = OVL_NEXT (fn))
+ else
+ for (fn = CLASSTYPE_CONSTRUCTORS (t); fn; fn = OVL_NEXT (fn))
{
tree ctor = OVL_CURRENT (fn);
/* Ideally, we wouldn't count copy constructors (or, in
{
const tree *const m1 = m1_p;
const tree *const m2 = m2_p;
-
+
if (*m1 == NULL_TREE && *m2 == NULL_TREE)
return 0;
if (*m1 == NULL_TREE)
/* Resort TYPE_METHOD_VEC because pointers have been reordered. */
-void
+void
resort_type_method_vec (void* obj,
void* orig_obj ATTRIBUTE_UNUSED ,
gt_pointer_operator new_value,
len = VEC_length (tree, method_vec);
/* Clear DECL_IN_AGGR_P for all functions. */
- for (fn_fields = TYPE_METHODS (t); fn_fields;
+ for (fn_fields = TYPE_METHODS (t); fn_fields;
fn_fields = TREE_CHAIN (fn_fields))
DECL_IN_AGGR_P (fn_fields) = 0;
tree atype;
tree vtable;
- atype = build_cplus_array_type (vtable_entry_type,
+ atype = build_cplus_array_type (vtable_entry_type,
build_index_type (size_int (n - 1)));
layout_type (atype);
/* Returns TRUE if DERIVED is a binfo containing the binfo BASE as a
subobject. */
-
+
static bool
base_derived_from (tree derived, tree base)
{
Returns true if an overrider was found; false otherwise. */
static bool
-dfs_find_final_overrider_1 (tree binfo,
+dfs_find_final_overrider_1 (tree binfo,
find_final_overrider_data *ffod,
unsigned depth)
{
if (method)
{
tree *candidate = &ffod->candidates;
-
+
/* Remove any candidates overridden by this new function. */
while (*candidate)
{
else
candidate = &TREE_CHAIN (*candidate);
}
-
+
/* Add the new function. */
ffod->candidates = tree_cons (method, binfo, ffod->candidates);
return true;
struct T { virtual void f (); };
struct U : public S, public T { };
- even though calling `f' in `U' is ambiguous. But,
+ even though calling `f' in `U' is ambiguous. But,
struct R { virtual void f(); };
struct S : virtual public R { virtual void f (); };
struct U : public S, public T { };
is not -- there's no way to decide whether to put `S::f' or
- `T::f' in the vtable for `R'.
-
+ `T::f' in the vtable for `R'.
+
The solution is to look at all paths to BINFO. If we find
different overriders along any two, then there is a problem. */
if (DECL_THUNK_P (fn))
dfs_find_final_overrider_post, &ffod);
VEC_free (tree, heap, ffod.path);
-
+
/* If there was no winner, issue an error message. */
if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
{
- error ("no unique final overrider for %qD in %qT", fn,
+ error ("no unique final overrider for %qD in %qT", fn,
BINFO_TYPE (derived));
return error_mark_node;
}
if (overrider == error_mark_node)
return;
overrider_target = overrider_fn = TREE_PURPOSE (overrider);
-
+
/* Check for adjusting covariant return types. */
over_return = TREE_TYPE (TREE_TYPE (overrider_target));
base_return = TREE_TYPE (TREE_TYPE (target_fn));
-
+
if (POINTER_TYPE_P (over_return)
&& TREE_CODE (over_return) == TREE_CODE (base_return)
&& CLASS_TYPE_P (TREE_TYPE (over_return))
over_return = TREE_TYPE (over_return);
base_return = TREE_TYPE (base_return);
-
+
if (DECL_THUNK_P (fn))
{
gcc_assert (DECL_RESULT_THUNK_P (fn));
if (SAME_BINFO_TYPE_P (BINFO_TYPE (thunk_binfo),
BINFO_TYPE (base_binfo)))
break;
-
+
/* See if virtual inheritance is involved. */
for (virtual_offset = thunk_binfo;
virtual_offset;
virtual_offset = BINFO_INHERITANCE_CHAIN (virtual_offset))
if (BINFO_VIRTUAL_P (virtual_offset))
break;
-
+
if (virtual_offset
|| (thunk_binfo && !BINFO_OFFSET_ZEROP (thunk_binfo)))
{
fixed_offset = offset;
}
}
-
+
if (fixed_offset || virtual_offset)
/* Replace the overriding function with a covariant thunk. We
will emit the overriding function in its own slot as
}
else
gcc_assert (!DECL_THUNK_P (fn));
-
+
/* Assume that we will produce a thunk that convert all the way to
the final overrider, and not to an intermediate virtual base. */
virtual_base = NULL_TREE;
&& (unsigned) list_length (BINFO_VIRTUALS (probe)) > ix)
if (BINFO_VIRTUAL_P (probe))
virtual_base = probe;
-
+
if (virtual_base)
/* Even if we find a virtual base, the correct delta is
between the overrider and the binfo we're building a vtable
for. */
goto virtual_covariant;
}
-
+
/* Compute the constant adjustment to the `this' pointer. The
`this' pointer, when this function is called, will point at BINFO
(or one of its primary bases, which are at the same offset). */
modify_vtable_entry (t, binfo, overrider_fn, delta, virtuals);
if (virtual_base)
- BV_VCALL_INDEX (*virtuals)
+ BV_VCALL_INDEX (*virtuals)
= get_vcall_index (overrider_target, BINFO_TYPE (virtual_base));
else
BV_VCALL_INDEX (*virtuals) = NULL_TREE;
/* A base without a vtable needs no modification, and its bases
are uninteresting. */
return dfs_skip_bases;
-
+
if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), t)
&& !CLASSTYPE_HAS_PRIMARY_BASE_P (t))
/* Don't do the primary vtable, if it's new. */
return NULL_TREE;
make_new_vtable (t, binfo);
-
+
/* Now, go through each of the virtual functions in the virtual
function table for BINFO. Find the final overrider, and update
the BINFO_VIRTUALS list appropriately. */
virtuals;
ix++, virtuals = TREE_CHAIN (virtuals),
old_virtuals = TREE_CHAIN (old_virtuals))
- update_vtable_entry_for_fn (t,
- binfo,
+ update_vtable_entry_for_fn (t,
+ binfo,
BV_FN (old_virtuals),
&virtuals, ix);
size_t i;
/* We go through each separately named virtual function. */
- for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
+ for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
VEC_iterate (tree, method_vec, i, fns);
++i)
{
if (DECL_VINDEX (fndecl))
{
tree *prev = &base_fndecls;
-
- while (*prev)
+
+ while (*prev)
/* If the method from the base class has the same
signature as the method from the derived class, it
has been overridden. */
/* Now give a warning for all base functions without overriders,
as they are hidden. */
- while (base_fndecls)
+ while (base_fndecls)
{
/* Here we know it is a hider, and no overrider exists. */
cp_warning_at ("%qD was hidden", TREE_VALUE (base_fndecls));
though, so we explicitly tolerate that. We use
TYPE_ANONYMOUS_P rather than ANON_AGGR_TYPE_P so that
we also allow unnamed types used for defining fields. */
- if (DECL_ARTIFICIAL (elt)
+ if (DECL_ARTIFICIAL (elt)
&& (!DECL_IMPLICIT_TYPEDEF_P (elt)
|| TYPE_ANONYMOUS_P (TREE_TYPE (elt))))
continue;
will be used later during class template instantiation.
When FRIEND_P is zero, T can be a static member data (VAR_DECL),
a non-static member data (FIELD_DECL), a member function
- (FUNCTION_DECL), a nested type (RECORD_TYPE, ENUM_TYPE),
+ (FUNCTION_DECL), a nested type (RECORD_TYPE, ENUM_TYPE),
a typedef (TYPE_DECL) or a member class template (TEMPLATE_DECL)
When FRIEND_P is nonzero, T is either a friend class
(RECORD_TYPE, TEMPLATE_DECL) or a friend function
a const reference, respectively. */
static void
-add_implicitly_declared_members (tree t,
+add_implicitly_declared_members (tree t,
int cant_have_const_cctor,
int cant_have_const_assignment)
{
}
/* If we can't get away with being lazy, generate the destructor
- now. */
+ now. */
if (!lazy_p)
lazily_declare_fn (sfk_destructor, t);
}
cp_warning_at ("%qD is too small to hold all values of %q#T",
field, type);
}
-
+
/* Remove the bit-field width indicator so that the rest of the
compiler does not treat that value as an initializer. */
DECL_INITIAL (field) = NULL_TREE;
/* Never let anything with uninheritable virtuals
make it through without complaint. */
abstract_virtuals_error (field, type);
-
+
if (TREE_CODE (t) == UNION_TYPE)
{
if (TYPE_NEEDS_CONSTRUCTING (type))
else
{
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type);
- TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type);
TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type);
TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type);
/* If one of the data members contains an empty class,
so does T. */
element_type = strip_array_types (type);
- if (CLASS_TYPE_P (element_type)
+ if (CLASS_TYPE_P (element_type)
&& CLASSTYPE_CONTAINS_EMPTY_CLASS_P (element_type))
CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t) = 1;
}
if (type == error_mark_node)
continue;
-
+
if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL)
continue;
-- Warn only if there is a non-trivial destructor. We assume that the
user at least implemented the cleanup correctly, and a destructor
is needed to free dynamic memory.
-
+
This seems enough for practical purposes. */
if (warn_ecpp
&& has_pointers
&& !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
{
warning (0, "%q#T has pointer data members", t);
-
+
if (! TYPE_HAS_INIT_REF (t))
{
warning (0, " but does not override %<%T(const %T&)%>", t, t);
/* Record the location of this empty object in OFFSETS. */
n = splay_tree_lookup (offsets, (splay_tree_key) offset);
if (!n)
- n = splay_tree_insert (offsets,
+ n = splay_tree_insert (offsets,
(splay_tree_key) offset,
(splay_tree_value) NULL_TREE);
- n->value = ((splay_tree_value)
+ n->value = ((splay_tree_value)
tree_cons (NULL_TREE,
type,
(tree) n->value));
is returned. Otherwise, returns zero. */
static int
-walk_subobject_offsets (tree type,
- subobject_offset_fn f,
- tree offset,
- splay_tree offsets,
- tree max_offset,
+walk_subobject_offsets (tree type,
+ subobject_offset_fn f,
+ tree offset,
+ splay_tree offsets,
+ tree max_offset,
int vbases_p)
{
int r = 0;
if (max_offset && INT_CST_LT (max_offset, offset))
return 0;
- if (!TYPE_P (type))
+ if (!TYPE_P (type))
{
if (abi_version_at_least (2))
type_binfo = type;
{
tree binfo_offset;
- if (abi_version_at_least (2)
+ if (abi_version_at_least (2)
&& BINFO_VIRTUAL_P (binfo))
continue;
- if (!vbases_p
- && BINFO_VIRTUAL_P (binfo)
+ if (!vbases_p
+ && BINFO_VIRTUAL_P (binfo)
&& !BINFO_PRIMARY_P (binfo))
continue;
class yet, but the offsets for direct non-virtual
bases can be calculated by going back to the TYPE. */
orig_binfo = BINFO_BASE_BINFO (TYPE_BINFO (type), i);
- binfo_offset = size_binop (PLUS_EXPR,
+ binfo_offset = size_binop (PLUS_EXPR,
offset,
BINFO_OFFSET (orig_binfo));
}
binfo_offset,
offsets,
max_offset,
- (abi_version_at_least (2)
+ (abi_version_at_least (2)
? /*vbases_p=*/0 : vbases_p));
if (r)
return r;
virtual. (If it is non-virtual, then it was walked
above.) */
tree vbase = get_primary_binfo (type_binfo);
-
+
if (vbase && BINFO_VIRTUAL_P (vbase)
&& BINFO_PRIMARY_P (vbase)
&& BINFO_INHERITANCE_CHAIN (vbase) == type_binfo)
{
- r = (walk_subobject_offsets
+ r = (walk_subobject_offsets
(vbase, f, offset,
offsets, max_offset, /*vbases_p=*/0));
if (r)
/* Step through each of the elements in the array. */
for (index = size_zero_node;
/* G++ 3.2 had an off-by-one error here. */
- (abi_version_at_least (2)
+ (abi_version_at_least (2)
? !INT_CST_LT (TYPE_MAX_VALUE (domain), index)
: INT_CST_LT (index, TYPE_MAX_VALUE (domain)));
index = size_binop (PLUS_EXPR, index, size_one_node))
/*vbases_p=*/1);
if (r)
return r;
- offset = size_binop (PLUS_EXPR, offset,
+ offset = size_binop (PLUS_EXPR, offset,
TYPE_SIZE_UNIT (TREE_TYPE (type)));
/* If this new OFFSET is bigger than the MAX_OFFSET, then
there's no point in iterating through the remaining
examined. */
static void
-record_subobject_offsets (tree type,
- tree offset,
- splay_tree offsets,
+record_subobject_offsets (tree type,
+ tree offset,
+ splay_tree offsets,
int vbases_p)
{
walk_subobject_offsets (type, record_subobject_offset, offset,
static int
layout_conflict_p (tree type,
- tree offset,
- splay_tree offsets,
+ tree offset,
+ splay_tree offsets,
int vbases_p)
{
splay_tree_node max_node;
the position of the DECL. */
static void
-layout_nonempty_base_or_field (record_layout_info rli,
- tree decl,
- tree binfo,
+layout_nonempty_base_or_field (record_layout_info rli,
+ tree decl,
+ tree binfo,
splay_tree offsets)
{
tree offset = NULL_TREE;
bool field_p;
tree type;
-
+
if (binfo)
{
/* For the purposes of determining layout conflicts, we want to
/* We have to check to see whether or not there is already
something of the same type at the offset we're about to use.
For example, consider:
-
+
struct S {};
struct T : public S { int i; };
struct U : public S, public T {};
-
+
Here, we put S at offset zero in U. Then, we can't put T at
offset zero -- its S component would be at the same address
as the S we already allocated. So, we have to skip ahead.
virtual base. */
if (!abi_version_at_least (2) && binfo && BINFO_VIRTUAL_P (binfo))
break;
- if (layout_conflict_p (field_p ? type : binfo, offset,
+ if (layout_conflict_p (field_p ? type : binfo, offset,
offsets, field_p))
{
/* Strip off the size allocated to this field. That puts us
/* Bump up by the alignment required for the type. */
rli->bitpos
- = size_binop (PLUS_EXPR, rli->bitpos,
- bitsize_int (binfo
+ = size_binop (PLUS_EXPR, rli->bitpos,
+ bitsize_int (binfo
? CLASSTYPE_ALIGN (type)
: TYPE_ALIGN (type)));
normalize_rli (rli);
this point because their BINFO_OFFSET is copied from another
hierarchy. Therefore, we may not need to add the entire
OFFSET. */
- propagate_binfo_offsets (binfo,
+ propagate_binfo_offsets (binfo,
size_diffop (convert (ssizetype, offset),
- convert (ssizetype,
+ convert (ssizetype,
BINFO_OFFSET (binfo))));
}
"change in a future version of GCC",
BINFO_TYPE (binfo));
}
-
+
/* This is an empty base class. We first try to put it at offset
zero. */
if (layout_conflict_p (binfo,
BINFO_OFFSET (binfo),
- offsets,
+ offsets,
/*vbases_p=*/0))
{
/* That didn't work. Now, we move forward from the next
available spot in the class. */
atend = true;
propagate_binfo_offsets (binfo, convert (ssizetype, eoc));
- while (1)
+ while (1)
{
if (!layout_conflict_p (binfo,
- BINFO_OFFSET (binfo),
+ BINFO_OFFSET (binfo),
offsets,
/*vbases_p=*/0))
/* We finally found a spot where there's no overlap. */
any base class. OFFSETS gives the location of empty base
subobjects. T is the most derived type. Return nonzero if the new
object cannot be nearly-empty. A new FIELD_DECL is inserted at
- *NEXT_FIELD, unless BINFO is for an empty base class.
+ *NEXT_FIELD, unless BINFO is for an empty base class.
Returns the location at which the next field should be inserted. */
/* This error is now reported in xref_tag, thus giving better
location information. */
return next_field;
-
+
/* Place the base class. */
if (!is_empty_class (basetype))
{
/* The containing class is non-empty because it has a non-empty
base class. */
CLASSTYPE_EMPTY_P (t) = 0;
-
+
/* Create the FIELD_DECL. */
decl = build_decl (FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype));
DECL_ARTIFICIAL (decl) = 1;
/* The check above (used in G++ 3.2) is insufficient because
an empty class placed at offset zero might itself have an
empty base at a nonzero offset. */
- else if (walk_subobject_offsets (basetype,
+ else if (walk_subobject_offsets (basetype,
empty_base_at_nonzero_offset_p,
size_zero_node,
/*offsets=*/NULL,
"future version of GCC", t);
}
}
-
+
/* We do not create a FIELD_DECL for empty base classes because
it might overlap some other field. We want to be able to
create CONSTRUCTORs for the class by iterating over the
/* Record the offsets of BINFO and its base subobjects. */
record_subobject_offsets (binfo,
BINFO_OFFSET (binfo),
- offsets,
+ offsets,
/*vbases_p=*/0);
return next_field;
parmtypes = TREE_CHAIN (parmtypes);
/* If this is subobject constructor or destructor, add the vtt
parameter. */
- TREE_TYPE (clone)
+ TREE_TYPE (clone)
= build_method_type_directly (basetype,
TREE_TYPE (TREE_TYPE (clone)),
parmtypes);
if (exceptions)
TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone),
exceptions);
- TREE_TYPE (clone)
+ TREE_TYPE (clone)
= cp_build_type_attribute_variant (TREE_TYPE (clone),
TYPE_ATTRIBUTES (TREE_TYPE (fn)));
}
/* Create the RTL for this function. */
SET_DECL_RTL (clone, NULL_RTX);
rest_of_decl_compilation (clone, /*top_level=*/1, at_eof);
-
+
/* Make it easy to find the CLONE given the FN. */
TREE_CHAIN (clone) = TREE_CHAIN (fn);
TREE_CHAIN (fn) = clone;
{
tree result;
- DECL_TEMPLATE_RESULT (clone)
+ DECL_TEMPLATE_RESULT (clone)
= build_clone (DECL_TEMPLATE_RESULT (clone), name);
result = DECL_TEMPLATE_RESULT (clone);
DECL_TEMPLATE_INFO (result) = copy_node (DECL_TEMPLATE_INFO (result));
version. We clone the deleting version first because that
means it will go second on the TYPE_METHODS list -- and that
corresponds to the correct layout order in the virtual
- function table.
+ function table.
For a non-virtual destructor, we do not build a deleting
destructor. */
adjust_clone_args (tree decl)
{
tree clone;
-
+
for (clone = TREE_CHAIN (decl); clone && DECL_CLONED_FUNCTION (clone);
clone = TREE_CHAIN (clone))
{
tree decl_parms, clone_parms;
clone_parms = orig_clone_parms;
-
+
/* Skip the 'this' parameter. */
orig_clone_parms = TREE_CHAIN (orig_clone_parms);
orig_decl_parms = TREE_CHAIN (orig_decl_parms);
orig_decl_parms = TREE_CHAIN (orig_decl_parms);
if (DECL_HAS_VTT_PARM_P (decl))
orig_decl_parms = TREE_CHAIN (orig_decl_parms);
-
+
clone_parms = orig_clone_parms;
if (DECL_HAS_VTT_PARM_P (clone))
clone_parms = TREE_CHAIN (clone_parms);
-
+
for (decl_parms = orig_decl_parms; decl_parms;
decl_parms = TREE_CHAIN (decl_parms),
clone_parms = TREE_CHAIN (clone_parms))
{
gcc_assert (same_type_p (TREE_TYPE (decl_parms),
TREE_TYPE (clone_parms)));
-
+
if (TREE_PURPOSE (decl_parms) && !TREE_PURPOSE (clone_parms))
{
/* A default parameter has been added. Adjust the
if (exceptions)
type = build_exception_variant (type, exceptions);
TREE_TYPE (clone) = type;
-
+
clone_parms = NULL_TREE;
break;
}
{
tree *fieldsp;
- fieldsp = &TYPE_FIELDS (t);
+ fieldsp = &TYPE_FIELDS (t);
while (*fieldsp)
{
if (TREE_CODE (*fieldsp) == FIELD_DECL
- && DECL_C_BIT_FIELD (*fieldsp)
+ && DECL_C_BIT_FIELD (*fieldsp)
&& DECL_INITIAL (*fieldsp))
*fieldsp = TREE_CHAIN (*fieldsp);
else
argument is of type `size_t', then we have to pass the size of
the array to the deallocation function, so we will need to store
a cookie. */
- fns = lookup_fnfields (TYPE_BINFO (type),
+ fns = lookup_fnfields (TYPE_BINFO (type),
ansi_opname (VEC_DELETE_EXPR),
/*protect=*/0);
/* If there are no `operator []' members, or the lookup is
CLASSTYPE_NON_AGGREGATE (t)
|= (TYPE_HAS_CONSTRUCTOR (t) || TYPE_POLYMORPHIC_P (t));
CLASSTYPE_NON_POD_P (t)
- |= (CLASSTYPE_NON_AGGREGATE (t)
+ |= (CLASSTYPE_NON_AGGREGATE (t)
|| TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|| TYPE_HAS_ASSIGN_REF (t));
TYPE_HAS_COMPLEX_ASSIGN_REF (t)
&& TREE_CODE (DECL_VINDEX (fn)) != INTEGER_CST)
{
tree new_virtual = make_node (TREE_LIST);
-
+
BV_FN (new_virtual) = fn;
BV_DELTA (new_virtual) = integer_zero_node;
BV_VCALL_INDEX (new_virtual) = NULL_TREE;
TREE_CHAIN (new_virtual) = *virtuals_p;
*virtuals_p = new_virtual;
}
-
+
/* If we couldn't find an appropriate base class, create a new field
here. Even if there weren't any new virtual functions, we might need a
new virtual function table if we're supposed to include vptrs in
the derived class vtable pointer, since they have different
types. Thus, in a derived class destructor, where the base
class constructor was inlined, we could generate bad code for
- setting up the vtable pointer.
+ setting up the vtable pointer.
Therefore, we use one type for all vtable pointers. We still
use a type-correct type; it's just doesn't indicate the array
DECL_ARTIFICIAL (field) = 1;
DECL_FIELD_CONTEXT (field) = t;
DECL_FCONTEXT (field) = t;
-
+
TYPE_VFIELD (t) = field;
-
+
/* This class is non-empty. */
CLASSTYPE_EMPTY_P (t) = 0;
/* Update BINFO's offset. */
BINFO_OFFSET (binfo)
- = convert (sizetype,
+ = convert (sizetype,
size_binop (PLUS_EXPR,
convert (ssizetype, BINFO_OFFSET (binfo)),
offset));
if (primary_binfo && BINFO_INHERITANCE_CHAIN (primary_binfo) == binfo)
propagate_binfo_offsets (primary_binfo, offset);
-
+
/* Scan all of the bases, pushing the BINFO_OFFSET adjust
downwards. */
for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
the results which is not particularly tractable. */
if (warn_abi
&& first_vbase
- && (tree_int_cst_lt
+ && (tree_int_cst_lt
(size_binop (CEIL_DIV_EXPR,
round_up (CLASSTYPE_SIZE (t),
CLASSTYPE_ALIGN (basetype)),
/* If there are no repeated bases, nothing can be ambiguous. */
if (!CLASSTYPE_REPEATED_BASE_P (t))
return;
-
+
/* Check direct bases. */
for (binfo = TYPE_BINFO (t), i = 0;
BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
VEC_iterate (tree, vbases, i, binfo); i++)
{
basetype = BINFO_TYPE (binfo);
-
+
if (!lookup_base (t, basetype, ba_unique | ba_quiet, NULL))
warning (0, "virtual base %qT inaccessible in %qT due to ambiguity",
basetype, t);
because we are willing to overlay multiple bases at the same
offset. However, now we need to make sure that RLI is big enough
to reflect the entire class. */
- eoc = end_of_class (rli->t,
+ eoc = end_of_class (rli->t,
CLASSTYPE_AS_BASE (rli->t) != NULL_TREE);
rli_size = rli_size_unit_so_far (rli);
if (TREE_CODE (rli_size) == INTEGER_CST
/* The size should have been rounded to a whole byte. */
gcc_assert (tree_int_cst_equal
(rli->bitpos, round_down (rli->bitpos, BITS_PER_UNIT)));
- rli->bitpos
- = size_binop (PLUS_EXPR,
+ rli->bitpos
+ = size_binop (PLUS_EXPR,
rli->bitpos,
size_binop (MULT_EXPR,
convert (bitsizetype,
next_field = &TYPE_FIELDS (t);
/* Build FIELD_DECLs for all of the non-virtual base-types. */
- empty_base_offsets = splay_tree_new (splay_tree_compare_integer_csts,
+ empty_base_offsets = splay_tree_new (splay_tree_compare_integer_csts,
NULL, NULL);
build_base_fields (rli, empty_base_offsets, next_field);
-
+
/* Layout the non-static data members. */
for (field = non_static_data_members; field; field = TREE_CHAIN (field))
{
{
place_field (rli, field);
/* If the static data member has incomplete type, keep track
- of it so that it can be completed later. (The handling
+ of it so that it can be completed later. (The handling
of pending statics in finish_record_layout is
insufficient; consider:
struct S1;
struct S2 { static S1 s1; };
-
+
At this point, finish_record_layout will be called, but
S1 is still incomplete.) */
if (TREE_CODE (field) == VAR_DECL)
}
type = TREE_TYPE (field);
-
+
padding = NULL_TREE;
/* If this field is a bit-field whose width is greater than its
of the field. Then, we are supposed to use the left over
bits as additional padding. */
for (itk = itk_char; itk != itk_none; ++itk)
- if (INT_CST_LT (DECL_SIZE (field),
+ if (INT_CST_LT (DECL_SIZE (field),
TYPE_SIZE (integer_types[itk])))
break;
if (warn_abi && TREE_CODE (t) == UNION_TYPE)
warning (0, "size assigned to %qT may not be "
"ABI-compliant and may change in a future "
- "version of GCC",
+ "version of GCC",
t);
padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
TYPE_SIZE (integer_type));
/* Remember the location of any empty classes in FIELD. */
if (abi_version_at_least (2))
- record_subobject_offsets (TREE_TYPE (field),
+ record_subobject_offsets (TREE_TYPE (field),
byte_position(field),
empty_base_offsets,
/*vbases_p=*/1);
and yet it starts in the middle of a byte, we have failed to
comply with the ABI. */
if (warn_abi
- && DECL_C_BIT_FIELD (field)
+ && DECL_C_BIT_FIELD (field)
/* The TREE_NO_WARNING flag gets set by Objective-C when
laying out an Objective-C class. The ObjC ABI differs
from the C++ ABI, and so we do not want a warning
DECL_FIELD_BIT_OFFSET (field),
bitsize_unit_node)))
cp_warning_at ("offset of %qD is not ABI-compliant and may "
- "change in a future version of GCC",
+ "change in a future version of GCC",
field);
/* G++ used to use DECL_FIELD_OFFSET as if it were the byte
offset of the field. */
- if (warn_abi
+ if (warn_abi
&& !tree_int_cst_equal (DECL_FIELD_OFFSET (field),
byte_position (field))
&& contains_empty_class_p (TREE_TYPE (field)))
{
tree padding_field;
- padding_field = build_decl (FIELD_DECL,
+ padding_field = build_decl (FIELD_DECL,
NULL_TREE,
- char_type_node);
+ char_type_node);
DECL_BIT_FIELD (padding_field) = 1;
DECL_SIZE (padding_field) = padding;
DECL_CONTEXT (padding_field) = t;
DECL_ARTIFICIAL (padding_field) = 1;
DECL_IGNORED_P (padding_field) = 1;
layout_nonempty_base_or_field (rli, padding_field,
- NULL_TREE,
+ NULL_TREE,
empty_base_offsets);
}
if (CLASSTYPE_NON_POD_P (t) || CLASSTYPE_EMPTY_P (t))
{
base_t = make_node (TREE_CODE (t));
-
+
/* Set the size and alignment for the new type. In G++ 3.2, all
empty classes were considered to have size zero when used as
base classes. */
rli_size_so_far, rather than rli_size_unit_so_far, is
used to compute TYPE_SIZE_UNIT. */
eoc = end_of_class (t, /*include_virtuals_p=*/0);
- TYPE_SIZE_UNIT (base_t)
+ TYPE_SIZE_UNIT (base_t)
= size_binop (MAX_EXPR,
convert (sizetype,
size_binop (CEIL_DIV_EXPR,
rli_size_so_far (rli),
bitsize_int (BITS_PER_UNIT))),
eoc);
- TYPE_SIZE (base_t)
+ TYPE_SIZE (base_t)
= size_binop (MAX_EXPR,
rli_size_so_far (rli),
size_binop (MULT_EXPR,
if (TREE_CODE (field) == FIELD_DECL)
{
*next_field = build_decl (FIELD_DECL,
- DECL_NAME (field),
+ DECL_NAME (field),
TREE_TYPE (field));
DECL_CONTEXT (*next_field) = base_t;
DECL_FIELD_OFFSET (*next_field) = DECL_FIELD_OFFSET (field);
base subobject fields. */
layout_virtual_bases (rli, empty_base_offsets);
- /* Make sure that empty classes are reflected in RLI at this
+ /* Make sure that empty classes are reflected in RLI at this
point. */
include_empty_classes(rli);
/* Make sure not to create any structures with zero size. */
if (integer_zerop (rli_size_unit_so_far (rli)) && CLASSTYPE_EMPTY_P (t))
- place_field (rli,
+ place_field (rli,
build_decl (FIELD_DECL, NULL_TREE, char_type_node));
/* Let the back-end lay out the type. */
CLASSTYPE_PRIMARY_BINFO (t) = NULL_TREE;
fixup_inline_methods (t);
-
+
/* Make assumptions about the class; we'll reset the flags if
necessary. */
CLASSTYPE_EMPTY_P (t) = 1;
= chainon (BINFO_VIRTUALS (TYPE_BINFO (t)), virtuals);
/* Set DECL_VINDEX for all functions declared in this class. */
- for (vindex = 0, fn = BINFO_VIRTUALS (TYPE_BINFO (t));
- fn;
- fn = TREE_CHAIN (fn),
+ for (vindex = 0, fn = BINFO_VIRTUALS (TYPE_BINFO (t));
+ fn;
+ fn = TREE_CHAIN (fn),
vindex += (TARGET_VTABLE_USES_DESCRIPTORS
? TARGET_VTABLE_USES_DESCRIPTORS : 1))
{
/* Make the rtl for any new vtables we have created, and unmark
the base types we marked. */
finish_vtbls (t);
-
+
/* Build the VTT for T. */
build_vtt (t);
if it were virtual, we would have created it by now. */
!dtor
|| (!DECL_VINDEX (dtor)
- && (!TREE_PRIVATE (dtor)
- || CLASSTYPE_FRIEND_CLASSES (t)
+ && (!TREE_PRIVATE (dtor)
+ || CLASSTYPE_FRIEND_CLASSES (t)
|| DECL_FRIENDLIST (TYPE_MAIN_DECL (t)))))
- warning (0, "%q#T has virtual functions but non-virtual destructor",
+ warning (0, "%q#T has virtual functions but non-virtual destructor",
t);
}
maybe_suppress_debug_info (t);
dump_class_hierarchy (t);
-
+
/* Finish debugging output for this type. */
rest_of_type_compilation (t, ! LOCAL_CLASS_P (t));
}
/* Actually, for the TYPE_FIELDS, only the non TYPE_DECLs are in
reverse order, so we can't just use nreverse. */
prev = NULL_TREE;
- for (x = TYPE_FIELDS (t);
- x && TREE_CODE (x) != TYPE_DECL;
+ for (x = TYPE_FIELDS (t);
+ x && TREE_CODE (x) != TYPE_DECL;
x = next)
{
next = TREE_CHAIN (x);
{
if (nonnull)
*nonnull = 1;
-
+
/* if we're in a ctor or dtor, we know our type. */
if (DECL_LANG_SPECIFIC (current_function_decl)
&& (DECL_CONSTRUCTOR_P (current_function_decl)
/* Reference variables should be references to objects. */
if (nonnull)
*nonnull = 1;
-
+
/* DECL_VAR_MARKED_P is used to prevent recursion; a
variable's initializer may refer to the variable
itself. */
- if (TREE_CODE (instance) == VAR_DECL
+ if (TREE_CODE (instance) == VAR_DECL
&& DECL_INITIAL (instance)
&& !DECL_VAR_MARKED_P (instance))
{
{
tree t = TREE_TYPE (instance);
int cdtorp = 0;
-
+
tree fixed = fixed_type_or_null (instance, nonnull, &cdtorp);
if (fixed == NULL_TREE)
return 0;
{
current_class_depth = 0;
current_class_stack_size = 10;
- current_class_stack
+ current_class_stack
= xmalloc (current_class_stack_size * sizeof (struct class_stack_node));
local_classes = VEC_alloc (tree, gc, 8);
push_binding_level (previous_class_level);
class_binding_level = previous_class_level;
/* Restore IDENTIFIER_TYPE_VALUE. */
- for (type = class_binding_level->type_shadowed;
- type;
+ for (type = class_binding_level->type_shadowed;
+ type;
type = TREE_CHAIN (type))
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (type), TREE_TYPE (type));
}
type = TYPE_MAIN_VARIANT (type);
/* Make sure there is enough room for the new entry on the stack. */
- if (current_class_depth + 1 >= current_class_stack_size)
+ if (current_class_depth + 1 >= current_class_stack_size)
{
current_class_stack_size *= 2;
current_class_stack
/* By default, things in classes are private, while things in
structures or unions are public. */
- current_access_specifier = (CLASSTYPE_DECLARED_CLASS (type)
- ? access_private_node
+ current_access_specifier = (CLASSTYPE_DECLARED_CLASS (type)
+ ? access_private_node
: access_public_node);
if (previous_class_level
invalidate_class_lookup_cache ();
}
- if (!previous_class_level
+ if (!previous_class_level
|| type != previous_class_level->this_entity
|| current_class_depth > 1)
pushlevel_class ();
{
previous_class_level = NULL;
}
-
+
/* Get out of the current class scope. If we were in a class scope
previously, that is the one popped to. */
tree context;
/* A namespace might be passed in error cases, like A::B:C. */
- if (type == NULL_TREE
- || type == error_mark_node
+ if (type == NULL_TREE
+ || type == error_mark_node
|| TREE_CODE (type) == NAMESPACE_DECL
|| ! IS_AGGR_TYPE (type)
|| TREE_CODE (type) == TEMPLATE_TYPE_PARM
|| TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
return;
-
+
context = DECL_CONTEXT (TYPE_MAIN_DECL (type));
if (context && CLASS_TYPE_P (context))
else
error ("language string %<\"%E\"%> not recognized", name);
}
-
+
/* Get out of the current language scope. */
void
template arguments. */
static tree
-resolve_address_of_overloaded_function (tree target_type,
+resolve_address_of_overloaded_function (tree target_type,
tree overload,
tsubst_flags_t flags,
bool template_only,
tree explicit_targs)
{
/* Here's what the standard says:
-
+
[over.over]
If the name is a function template, template argument deduction
|| TREE_CODE (TREE_TYPE (target_type)) != METHOD_TYPE);
gcc_assert (is_overloaded_fn (overload));
-
+
/* Check that the TARGET_TYPE is reasonable. */
if (TYPE_PTRFN_P (target_type))
/* This is OK. */;
target_type = build_reference_type (target_type);
is_reference = 1;
}
- else
+ else
{
if (flags & tf_error)
error ("cannot resolve overloaded function %qD based on"
- " conversion to type %qT",
+ " conversion to type %qT",
DECL_NAME (OVL_FUNCTION (overload)), target_type);
return error_mark_node;
}
-
+
/* If we can find a non-template function that matches, we can just
use it. There's no point in generating template instantiations
if we're just going to throw them out anyhow. But, of course, we
/* Now, if we've already got a match (or matches), there's no need
to proceed to the template functions. But, if we don't have a
match we need to look at them, too. */
- if (!matches)
+ if (!matches)
{
tree target_fn_type;
tree target_arg_types;
/* Never do unification on the 'this' parameter. */
if (TREE_CODE (target_fn_type) == METHOD_TYPE)
target_arg_types = TREE_CHAIN (target_arg_types);
-
+
for (fns = overload; fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
/* See if there's a match. */
instantiation_type = TREE_TYPE (instantiation);
if (is_ptrmem)
- instantiation_type =
+ instantiation_type =
build_ptrmemfunc_type (build_pointer_type (instantiation_type));
else if (!is_reference)
instantiation_type = build_pointer_type (instantiation_type);
/* There were *no* matches. */
if (flags & tf_error)
{
- error ("no matches converting function %qD to type %q#T",
+ error ("no matches converting function %qD to type %q#T",
DECL_NAME (OVL_FUNCTION (overload)),
target_type);
for (; overload; overload = OVL_NEXT (overload))
matches = tree_cons (NULL_TREE, OVL_CURRENT (overload),
matches);
-
+
print_candidates (matches);
}
return error_mark_node;
{
tree match;
- error ("converting overloaded function %qD to type %q#T is ambiguous",
+ error ("converting overloaded function %qD to type %q#T is ambiguous",
DECL_NAME (OVL_FUNCTION (overload)),
target_type);
print_candidates (matches);
}
-
+
return error_mark_node;
}
&& !(flags & tf_ptrmem_ok) && !flag_ms_extensions)
{
static int explained;
-
+
if (!(flags & tf_error))
return error_mark_node;
we complain on errors. If we are not complaining, never modify rhs,
as overload resolution wants to try many possible instantiations, in
the hope that at least one will work.
-
+
For non-recursive calls, LHSTYPE should be a function, pointer to
function, or a pointer to member function. */
instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
{
tsubst_flags_t flags_in = flags;
-
+
flags &= ~tf_ptrmem_ok;
-
+
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
{
if (flags & tf_error)
{
if (same_type_p (lhstype, TREE_TYPE (rhs)))
return rhs;
- if (flag_ms_extensions
+ if (flag_ms_extensions
&& TYPE_PTRMEMFUNC_P (lhstype)
&& !TYPE_PTRMEMFUNC_P (TREE_TYPE (rhs)))
/* Microsoft allows `A::f' to be resolved to a
case OVERLOAD:
case FUNCTION_DECL:
- return
+ return
resolve_address_of_overloaded_function (lhstype, rhs, flags_in,
/*template_only=*/false,
/*explicit_targs=*/NULL_TREE);
TREE_TYPE (rhs) = lhstype;
return rhs;
-
+
case ADDR_EXPR:
{
if (PTRMEM_OK_P (rhs))
flags |= tf_ptrmem_ok;
-
+
return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
}
|| !TYPE_CONTAINS_VPTR_P (BINFO_TYPE (base_binfo)))
break;
}
-
+
type = BINFO_TYPE (binfo);
buf = alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2);
sprintf (buf, VFIELD_NAME_FORMAT,
if (!(innermost_scope_kind() == sk_class
&& TYPE_BEING_DEFINED (current_class_type)))
return;
-
+
/* If there's already a binding for this NAME, then we don't have
anything to worry about. */
- if (lookup_member (current_class_type, name,
+ if (lookup_member (current_class_type, name,
/*protect=*/0, /*want_type=*/false))
return;
names_used = current_class_stack[current_class_depth - 1].names_used;
splay_tree_insert (names_used,
- (splay_tree_key) name,
+ (splay_tree_key) name,
(splay_tree_value) decl);
}
splay_tree_node n;
/* Look to see if we ever used this name. */
- names_used
+ names_used
= current_class_stack[current_class_depth - 1].names_used;
if (!names_used)
return;
if (n)
{
/* [basic.scope.class]
-
+
A name N used in a class S shall refer to the same declaration
in its context and when re-evaluated in the completed scope of
S. */
error ("declaration of %q#D", decl);
- cp_error_at ("changes meaning of %qD from %q+#D",
+ cp_error_at ("changes meaning of %qD from %q+#D",
DECL_NAME (OVL_CURRENT (decl)),
(tree) n->value);
}
{
tree primary_base;
tree result;
-
+
primary_base = CLASSTYPE_PRIMARY_BINFO (BINFO_TYPE (binfo));
if (!primary_base)
return NULL_TREE;
int indented = 0;
tree base_binfo;
int i;
-
+
indented = maybe_indent_hierarchy (stream, indent, 0);
fprintf (stream, "%s (0x%lx) ",
type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER),
return igo;
}
igo = TREE_CHAIN (binfo);
-
+
fprintf (stream, HOST_WIDE_INT_PRINT_DEC,
tree_low_cst (BINFO_OFFSET (binfo), 0));
if (is_empty_class (BINFO_TYPE (binfo)))
if (!(flags & TDF_SLIM))
{
int indented = 0;
-
+
if (BINFO_SUBVTT_INDEX (binfo))
{
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
expr_as_string (BINFO_VTABLE (binfo),
TFF_PLAIN_IDENTIFIER));
}
-
+
if (indented)
fprintf (stream, "\n");
}
for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
igo = dump_class_hierarchy_r (stream, flags, base_binfo, igo, indent + 2);
-
+
return igo;
}
if (!(flags & TDF_SLIM))
{
int ctor_vtbl_p = TYPE_BINFO (t) != binfo;
-
+
fprintf (stream, "%s for %s",
ctor_vtbl_p ? "Construction vtable" : "Vtable",
type_as_string (BINFO_TYPE (binfo), TFF_PLAIN_IDENTIFIER));
dump_array (stream, vtable);
fprintf (stream, "\n");
}
-
+
dump_end (TDI_class, stream);
}
dump_array (stream, vtt);
fprintf (stream, "\n");
}
-
+
dump_end (TDI_class, stream);
}
static const char spaces[] = " ";
tree name = DECL_NAME (thunk);
tree thunks;
-
+
fprintf (stream, "%.*s%p %s %s", indent, spaces,
(void *)thunk,
!DECL_THUNK_P (thunk) ? "function"
list = build_tree_list (BINFO_VTABLE (TYPE_BINFO (t)), NULL_TREE);
accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
TYPE_BINFO (t), t, list);
-
+
/* Then come the virtual bases, also in inheritance graph order. */
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
{
/* Build the VTT (virtual table table) for T.
A class requires a VTT if it has virtual bases.
-
+
This holds
1 - primary virtual pointer for complete object T
2 - secondary VTTs for each direct non-virtual base of T which requires a
3 - secondary virtual pointers for each direct or indirect base of T which
has virtual bases or is reachable via a virtual path from T.
4 - secondary VTTs for each direct or indirect virtual base of T.
-
+
Secondary VTTs look like complete object VTTs without part 4. */
static void
/* Figure out the type of the VTT. */
type = build_index_type (size_int (list_length (inits) - 1));
type = build_cplus_array_type (const_ptr_type_node, type);
-
+
/* Now, build the VTT object itself. */
vtt = build_vtable (t, get_vtt_name (t), type);
initialize_artificial_var (vtt, inits);
BINFO_VPTR_INDEX (binfo) = *index;
}
*index = size_binop (PLUS_EXPR, *index, TYPE_SIZE_UNIT (ptr_type_node));
-
+
/* Recursively add the secondary VTTs for non-virtual bases. */
for (i = 0; BINFO_BASE_ITERATE (binfo, i, b); ++i)
if (!BINFO_VIRTUAL_P (b))
inits = build_vtt_inits (b, t, inits, index);
-
+
/* Add secondary virtual pointers for all subobjects of BINFO with
either virtual bases or reachable along a virtual path, except
subobjects that are non-virtual primary bases. */
data.index = *index;
data.inits = NULL;
data.type_being_constructed = BINFO_TYPE (binfo);
-
+
dfs_walk_once (binfo, dfs_build_secondary_vptr_vtt_inits, NULL, &data);
*index = data.index;
{
if (!BINFO_VIRTUAL_P (b))
continue;
-
+
inits = build_vtt_inits (b, t, inits, index);
}
else
if (!(CLASSTYPE_VBASECLASSES (BINFO_TYPE (binfo))
|| binfo_via_virtual (binfo, data->type_being_constructed)))
return dfs_skip_bases;
-
+
/* We're not interested in non-virtual primary bases. */
if (!BINFO_VIRTUAL_P (binfo) && BINFO_PRIMARY_P (binfo))
return NULL_TREE;
-
+
/* Record the index where this secondary vptr can be found. */
if (data->top_level_p)
{
binfo = BINFO_INHERITANCE_CHAIN (binfo);
}
}
-
+
/* Add the initializer for the secondary vptr itself. */
data->inits = tree_cons (NULL_TREE, binfo_ctor_vtable (binfo), data->inits);
if (!TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo)))
/* If this class has no vtable, none of its bases do. */
return dfs_skip_bases;
-
+
if (!vtable)
/* This might be a primary base, so have no vtable in this
hierarchy. */
return NULL_TREE;
-
+
/* If we scribbled the construction vtable vptr into BINFO, clear it
out now. */
if (TREE_CODE (vtable) == TREE_LIST
/* Add the vtables for each of our virtual bases using the vbase in T
binfo. */
- for (vbase = TYPE_BINFO (BINFO_TYPE (binfo));
- vbase;
+ for (vbase = TYPE_BINFO (BINFO_TYPE (binfo));
+ vbase;
vbase = TREE_CHAIN (vbase))
{
tree b;
if (!BINFO_VIRTUAL_P (vbase))
continue;
b = copied_binfo (vbase, binfo);
-
+
accumulate_vtbl_inits (b, vbase, binfo, t, list);
}
inits = TREE_VALUE (list);
/* If it doesn't have a vptr, we don't do anything. */
if (!TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo)))
return;
-
+
/* If we're building a construction vtable, we're not interested in
subobjects that don't require construction vtables. */
- if (ctor_vtbl_p
+ if (ctor_vtbl_p
&& !CLASSTYPE_VBASECLASSES (BINFO_TYPE (binfo))
&& !binfo_via_virtual (orig_binfo, BINFO_TYPE (rtti_binfo)))
return;
/* Build the initializers for the BINFO-in-T vtable. */
- TREE_VALUE (inits)
+ TREE_VALUE (inits)
= chainon (TREE_VALUE (inits),
dfs_accumulate_vtbl_inits (binfo, orig_binfo,
rtti_binfo, t, inits));
-
+
/* Walk the BINFO and its bases. We walk in preorder so that as we
initialize each vtable we can figure out at what offset the
secondary vtable lies from the primary vtable. We can't use
primary, we still need a VTT entry for the vtable, but it
should point to the ctor vtable for the base it is a
primary for within the sub-hierarchy of RTTI_BINFO.
-
+
There are three possible cases:
-
+
1) We are in the same place.
2) We are a primary base within a lost primary virtual base of
RTTI_BINFO.
3) We are primary to something not a base of RTTI_BINFO. */
-
+
tree b;
tree last = NULL_TREE;
if (BINFO_VIRTUAL_P (b) || b == rtti_binfo)
break;
found:
-
+
/* If we found RTTI_BINFO, this is case 1. If we found a virtual
base B and it is a base of RTTI_BINFO, this is case 2. In
either case, we share our vtable with LAST, i.e. the
The value returned is a TREE_LIST suitable for wrapping in a
CONSTRUCTOR to use as the DECL_INITIAL for a vtable. If
NON_FN_ENTRIES_P is not NULL, *NON_FN_ENTRIES_P is set to the
- number of non-function entries in the vtable.
+ number of non-function entries in the vtable.
It might seem that this function should never be called with a
BINFO for which BINFO_PRIMARY_P holds, the vtable for such a
unsigned ix;
tree vbinfo;
VEC(tree,gc) *vbases;
-
+
/* Initialize VID. */
memset (&vid, 0, sizeof (vid));
vid.binfo = binfo;
vid.fns = VEC_alloc (tree, gc, 32);
/* Add the vcall and vbase offset entries. */
build_vcall_and_vbase_vtbl_entries (binfo, &vid);
-
+
/* Clear BINFO_VTABLE_PATH_MARKED; it's set by
build_vbase_offset_vtbl_entries. */
for (vbases = CLASSTYPE_VBASECLASSES (t), ix = 0;
tree vcall_index;
tree fn, fn_original;
tree init = NULL_TREE;
-
+
fn = BV_FN (v);
fn_original = fn;
if (DECL_THUNK_P (fn))
}
fn_original = THUNK_TARGET (fn);
}
-
+
/* If the only definition of this function signature along our
primary base chain is from a lost primary, this vtable slot will
never be used, so just zero it out. This is important to avoid
/* The initializers for virtual functions were built up in reverse
order; straighten them out now. */
vfun_inits = nreverse (vfun_inits);
-
+
/* The negative offset initializers are also in reverse order. */
vid.inits = nreverse (vid.inits);
return;
t = vid->derived;
-
+
/* We might be a primary base class. Go up the inheritance hierarchy
until we find the most derived class of which we are a primary base:
it is the offset of that which we need to use. */
{
tree b;
tree delta;
-
+
if (!BINFO_VIRTUAL_P (vbase))
continue;
BINFO_VTABLE_PATH_MARKED (b) = 1;
/* Figure out where we can find this vbase offset. */
- delta = size_binop (MULT_EXPR,
+ delta = size_binop (MULT_EXPR,
vid->index,
convert (ssizetype,
TYPE_SIZE_UNIT (vtable_entry_type)));
we are walking in inheritance graph order so these end up in
the right order. */
delta = size_diffop (BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
-
- *vid->last_init
+
+ *vid->last_init
= build_tree_list (NULL_TREE,
- fold_build1 (NOP_EXPR,
+ fold_build1 (NOP_EXPR,
vtable_entry_type,
delta));
vid->last_init = &TREE_CHAIN (*vid->last_init);
through the recursion in build_vcall_and_vbase_vtbl_entries. */
if (BINFO_VIRTUAL_P (binfo) && vid->vbase != binfo)
return;
-
+
/* If BINFO has a primary base, process it first. */
primary_binfo = get_primary_binfo (binfo);
if (primary_binfo)
where rtti_binfo is the most derived type. */
non_primary_binfo
= original_binfo (non_primary_binfo, vid->rtti_binfo);
-
+
for (base_virtuals = BINFO_VIRTUALS (binfo),
derived_virtuals = BINFO_VIRTUALS (non_primary_binfo),
orig_virtuals = BINFO_VIRTUALS (TYPE_BINFO (BINFO_TYPE (binfo)));
signature as FN, then we do not need a second vcall offset.
Check the list of functions already present in the derived
class vtable. */
- for (i = 0; VEC_iterate (tree, vid->fns, i, derived_entry); ++i)
+ for (i = 0; VEC_iterate (tree, vid->fns, i, derived_entry); ++i)
{
if (same_signature_p (derived_entry, orig_fn)
/* We only use one vcall offset for virtual destructors,
elt->purpose = orig_fn;
elt->value = vid->index;
}
-
+
/* The next vcall offset will be found at a more negative
offset. */
vid->index = size_binop (MINUS_EXPR, vid->index,
decl = build_address (get_tinfo_decl (t));
else
decl = integer_zero_node;
-
+
/* Convert the declaration to a type that can be stored in the
vtable. */
init = build_nop (vfunc_ptr_type_node, decl);
CLEANUP_EXPR (stmt));
pointer_set_insert (p_set, *stmt_p);
-
+
return NULL;
}
the result. Since the "s" subobject is never
constructed, this is a valid transformation. */
|| CP_AGGREGATE_TYPE_P (type));
-
+
/* This would be wrong for a type with virtual bases, but they are
caught by the assert above. */
return (is_empty_class (type)
/* This file contains the definitions and documentation for the
additional tree codes used in the GNU C++ compiler (see tree.def
for the standard codes).
- Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998, 2003, 2004, 2005,
+ Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998, 2003, 2004, 2005,
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-
+
/* An OFFSET_REF is used in two situations:
1. An expression of the form `A::m' where `A' is a class and `m' is
The expression is a pointer-to-member if its address is taken,
but simply denotes a member of the object if its address is not
taken.
-
+
This form is only used during the parsing phase; once semantic
analysis has taken place they are eliminated.
functions. BASELINK_BINFO gives the base from which the functions
come, i.e., the base to which the `this' pointer must be converted
before the functions are called. BASELINK_ACCESS_BINFO gives the
- base used to name the functions.
+ base used to name the functions.
A BASELINK is an expression; the TREE_TYPE of the BASELINK gives
the type of the expression. This type is either a FUNCTION_TYPE,
gives the level (from 1) of the parameter.
Here's an example:
-
+
template <class T> // Index 0, Level 1.
struct S
{
template <class U, // Index 0, Level 2.
class V> // Index 1, Level 2.
void f();
- };
+ };
The DESCENDANTS will be a chain of TEMPLATE_PARM_INDEXs descended
from this one. The first descendant will have the same IDX, but
class V> // Index 1, Level 1, Orig Level 2
void f();
};
-
+
The LEVEL is the level of the parameter when we are worrying about
the types of things; the ORIG_LEVEL is the level when we are
worrying about instantiating things. */
DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", tcc_exceptional, 0)
/* Index into a template parameter list for template template parameters.
- This parameter must be a type. The TYPE_FIELDS value will be a
+ This parameter must be a type. The TYPE_FIELDS value will be a
TEMPLATE_PARM_INDEX.
- It is used without template arguments like TT in C<TT>,
+ It is used without template arguments like TT in C<TT>,
TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO is NULL_TREE
and TYPE_NAME is a TEMPLATE_DECL. */
DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", tcc_type, 0)
macros in tree.h. Changing the order will degrade the speed of the
compiler. TEMPLATE_TYPE_PARM, TYPENAME_TYPE, TYPEOF_TYPE,
BOUND_TEMPLATE_TEMPLATE_PARM. */
-
+
/* Index into a template parameter list. This parameter must be a type.
The type.value field will be a TEMPLATE_PARM_INDEX. */
DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", tcc_type, 0)
expression in question. */
DEFTREECODE (TYPEOF_TYPE, "typeof_type", tcc_type, 0)
-/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments
+/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments
like TT<int>.
In this case, TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO contains the
template name and its bound arguments. TYPE_NAME is a TYPE_DECL. */
not an alias, but is later expanded into multiple aliases. */
DEFTREECODE (USING_DECL, "using_decl", tcc_declaration, 0)
-/* A using directive. The operand is USING_STMT_NAMESPACE. */
+/* A using directive. The operand is USING_STMT_NAMESPACE. */
DEFTREECODE (USING_STMT, "using_directive", tcc_statement, 1)
/* An un-parsed default argument. Holds a vector of input tokens and
member template, the template may be an IDENTIFIER_NODE. */
DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", tcc_expression, 2)
-/* A list-like node for chaining overloading candidates. TREE_TYPE is
+/* A list-like node for chaining overloading candidates. TREE_TYPE is
the original name, and the parameter is the FUNCTION_DECL. */
DEFTREECODE (OVERLOAD, "overload", tcc_exceptional, 0)
"OBJECT.SCOPE::~DESTRUCTOR. The first operand is the OBJECT. The
second operand (if non-NULL) is the SCOPE. The third operand is
the TYPE node corresponding to the DESTRUCTOR. The type of the
- first operand will always be a scalar type.
+ first operand will always be a scalar type.
The type of a PSEUDO_DTOR_EXPR is always "void", even though it can
be used as if it were a zero-argument function. We handle the
function-call case specially, and giving it "void" type prevents it
- being used in expressions in ways that are not permitted. */
+ being used in expressions in ways that are not permitted. */
DEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", tcc_expression, 3)
/* A whole bunch of tree codes for the initial, superficial parsing of
/* Represents an 'if' statement. The operands are IF_COND,
THEN_CLAUSE, and ELSE_CLAUSE, respectively. */
-/* ??? It is currently still necessary to distinguish between IF_STMT
+/* ??? It is currently still necessary to distinguish between IF_STMT
and COND_EXPR for the benefit of templates. */
DEFTREECODE (IF_STMT, "if_stmt", tcc_statement, 3)
unsigned java_interface : 1;
unsigned debug_requested : 1;
unsigned fields_readonly : 1;
-
+
unsigned use_template : 2;
unsigned ptrmemfunc_flag : 1;
unsigned was_anonymous : 1;
it has not yet been declared. */
#define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
-
+
/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
#define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref)
unsigned initialized_in_class : 1;
unsigned assignment_operator_p : 1;
unsigned u1sel : 1;
-
+
unsigned u2sel : 1;
unsigned can_be_full : 1;
unsigned thunk_p : 1;
unsigned u3sel : 1;
unsigned pending_inline_p : 1;
unsigned spare : 22;
-
+
/* For a non-thunk function decl, this is a tree list of
friendly classes. For a thunk function decl, it is the
thunked to function decl. */
/* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is
DECL_CLONED_FUNCTION. */
tree GTY ((tag ("0"))) cloned_function;
-
+
/* In a FUNCTION_DECL for which THUNK_P holds this is the
THUNK_FIXED_OFFSET. */
HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset;
} GTY ((desc ("%0.decl_flags.thunk_p"))) u5;
-
+
union lang_decl_u3
{
struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields")))
(TREE_CODE (NODE) == FUNCTION_DECL \
&& DECL_LANG_SPECIFIC (NODE) \
&& DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p)
-
+
/* Set DECL_THUNK_P for node. */
#define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \
(DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p = 1, \
intype_class = TREE_TYPE (intype);
type_class = TREE_TYPE (type);
- same_p = same_type_p (TYPE_MAIN_VARIANT (intype_class),
+ same_p = same_type_p (TYPE_MAIN_VARIANT (intype_class),
TYPE_MAIN_VARIANT (type_class));
binfo = NULL_TREE;
/* Try derived to base conversion. */
}
else if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
{
- tree b1;
+ tree b1;
tree b2;
tree binfo;
enum tree_code code = PLUS_EXPR;
expr = cplus_expand_constant (expr);
if (binfo && !integer_zerop (BINFO_OFFSET (binfo)))
- expr = size_binop (code,
+ expr = size_binop (code,
build_nop (sizetype, expr),
BINFO_OFFSET (binfo));
return build_nop (type, expr);
}
else
expr = build_int_cst (type, 0);
-
+
return expr;
}
else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form))
as a pointer. */
gcc_assert (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr)))
== GET_MODE_SIZE (TYPE_MODE (type)));
-
+
return convert_to_pointer (type, expr);
}
{
tree intype = TREE_TYPE (expr);
enum tree_code form = TREE_CODE (intype);
-
+
if (form == POINTER_TYPE)
{
intype = TYPE_MAIN_VARIANT (intype);
/* Process the initializer for the declaration. */
DECL_INITIAL (arg) = targ;
- cp_finish_decl (arg, targ, NULL_TREE,
+ cp_finish_decl (arg, targ, NULL_TREE,
LOOKUP_ONLYCONVERTING|DIRECT_BIND);
}
else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg))
/* Subroutine of convert_to_reference. REFTYPE is the target reference type.
INTYPE is the original rvalue type and DECL is an optional _DECL node
for diagnostics.
-
+
[dcl.init.ref] says that if an rvalue is used to
initialize a reference, then the reference must be to a
non-volatile const type. */
warn_ref_binding (tree reftype, tree intype, tree decl)
{
tree ttl = TREE_TYPE (reftype);
-
+
if (!CP_TYPE_CONST_NON_VOLATILE_P (ttl))
{
const char *msg;
tree rval_as_conversion = NULL_TREE;
bool can_convert_intype_to_type;
- if (TREE_CODE (type) == FUNCTION_TYPE
+ if (TREE_CODE (type) == FUNCTION_TYPE
&& TREE_TYPE (expr) == unknown_type_node)
- expr = instantiate_type (type, expr,
+ expr = instantiate_type (type, expr,
(flags & LOOKUP_COMPLAIN)
? tf_error | tf_warning : tf_none);
if (! real_lvalue_p (expr))
warn_ref_binding (reftype, intype, decl);
-
+
if (! (convtype & CONV_CONST)
&& !at_least_as_qualified_p (ttl, ttr))
pedwarn ("conversion from %qT to %qT discards qualifiers",
COMPARE_BASE | COMPARE_DERIVED)))
warning (0, "casting %qT to %qT does not dereference pointer",
intype, reftype);
-
+
rval = build_unary_op (ADDR_EXPR, expr, 0);
&n