Commit Graph

379 Commits

Author SHA1 Message Date
Mark Mitchell 46e8c075d0 Make-lang.in (CXX_SRCS): Add optimize.c.
1999-11-25  Mark Mitchell  <mark@codesourcery.com>

	* 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.
	(class.o, call.o, friend.o, init.o, method.o, cvt.o): Likewise.
	(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.
	* class.c: Don't include splay-tree.h.
	* 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.
	(flag_inline_trees): New variable.
	(local_variable_p): New function.
	(nonstatic_local_decl_p): Likewise.
	(optimize_function): Likewise.
	(cplus_unsave_expr_now): Remove.
	(copy_tree_r): Declare.
	(remap_save_expr): Likewise.
	* decl.c (local_variable_p): Don't
	make it static.
	(local_variable_p_walkfn): New function.
	(make_rtl_for_local_static): Remove code to try to avoid writing
	out static constants.
	(emit_local_var): Fix indentation.
	(nonstatic_local_decl_p): New function.
	(check_default_argument): Use local_variable_p_walkfn, not
	local_variable_p, when walking the tree.
	(start_function): Set the DECL_CONTEXT for automatically generated
	labels.
	(finish_constructor_body): Use CTOR_STMT to mark the end of a
	constructor.
	* decl2.c: Don't include splay-tree.h.
	(flag_inline_trees): Define.
	* dump.c: Don't include
	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.
	* lex.c (cplus_tree_code_type): Make it static.
	(cplus_tree_code_length): Likewise.
	(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
	CTOR_STMT.
	(expand_stmt): Handle CTOR_STMT, not CTOR_COMPLETE.
	(expand_body): Call optimize_function.  Save bodies if we're doing
	inlining on trees.
	* tree.c: Don't include splay-tree.h.  Include insn-config.h and
	integrate.h.
	(copy_tree_r): Make it public.
	(statement_code_p): New function.
	(mark_local_for_remap_r): Likewise.
	(cp_usave_r): Likewise.
	(cp_unsave): Likewise.
	(build_cplus_new): Set DECL_CONTEXT for temporary variables.
	(walk_tree): Walk into `s' class nodes.  Walk statement chains.
	(copy_tree_r): Handle 's' class nodes.  Restore chains for
	statements.  Nullify scopes.  Don't copy types.
	(init_tree): Set lang_unsave to cp_unsave.
	(remap_save_expr): Define.
	* ir.texi: Document CTOR_STMT.

From-SVN: r30669
1999-11-25 20:32:04 +00:00
Mark Mitchell f0adc63709 pt.c (tsubst_decl): Copy TREE_ASM_WRITTEN for VAR_DECLs.
* pt.c (tsubst_decl): Copy TREE_ASM_WRITTEN for VAR_DECLs.

	* decl2.c (finish_vtable_vardecl): Don't prune vtables here.

From-SVN: r30656
1999-11-25 01:56:13 +00:00
Alexandre Oliva c7edeea32a cp-tree.h (build_vec_delete): Remove `auto_delete' argument.
* cp-tree.h (build_vec_delete): Remove `auto_delete' argument.
* init.c (build_vec_delete, build_vec_delete_1): Likewise.
Always destruct virtual bases of array components, but never
delete them.
(build_vec_init): Adjust invocations.
(build_delete): Likewise.
* decl2.c (delete_sanity): Likewise.

From-SVN: r30606
1999-11-21 17:44:34 +00:00
Nathan Sidwell 535233a89f extend.texi: Document C++ restricted pointers and references.
* extend.texi: Document C++ restricted pointers and references.

	* cp-tree.h (grok_method_quals): Return this pointer qualifiers.
	* decl.c (grokdeclarator): Adjust calls to grok_method_quals.
	* decl2.c (grok_method_quals): Accept `restrict' as applying to
	the object pointer. Return such qualifiers.
	(grokclassfn): Apply this pointer qualifiers. Cleanup unused
	variables.

From-SVN: r30587
1999-11-19 13:03:00 +00:00
Jason Merrill ae673f1403 class.c (finish_struct): If we're a local class in a template function, add a TAG_DEFN.
* class.c (finish_struct): If we're a local class in a template
        function, add a TAG_DEFN.
        * pt.c (lookup_template_class): If this is a local class in a
        template function, call pushtag.
        (tsubst_expr, case TAG_DEFN): Handle classes, too.

        Emit debug info with the vtable.
        * search.c (maybe_suppress_debug_info): New function...
        * class.c (finish_struct_1): ...split out from here.
        * 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,
        note_debug_info_needed): #if 0 out.

From-SVN: r30541
1999-11-15 20:37:39 -05:00
Mark Mitchell cd9f6678b3 cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro.
* cp-tree.h (DECL_LOCAL_FUCNTION_P): New macro.
	* call.c (equal_functions): Use DECL_LOCAL_FUCNTION_P, not
	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): Likewise.
	(push_scratch_obstack): Likewise.
	(DECL_TEMPLATE_PARM_P): Robustify.
	(SET_DECL_TEMPLATE_PARM_P): New macro.
	* class.c (add_method): Don't manipulate obstacks.
	(finish_vtbls): Likewise.
	* cvt.c (build_up_reference): Adjust calls to cp_finish_decl.
	* decl.c (binding_for_name): Don't manipulate obstacks.
	(maybe_push_to_top_level): Likewise.
	(pop_from_top_level): Likewise.
	(duplicate_decls): Likewise.
	(pushdecl): Likewise.
	(implicitly_declare): Likewise.
	(build_typename_type): Likewise.
	(start_decl): Likewise.
	(cp_finish_decl): Likewise.
	(finish_decl): Likewise.
	(destroy_local_static): Likewise.
	(expand_static_init): Likewise.
	(complete_array_type): Likewise.
	(grokvardecl): Likewise.
	(build_ptrmemfnc_type): Likewise.
	(grokdeclarator): Likewise.
	(xref_tag): Likewise.
	(xref_basetypes): Likewise.
	(start_enum): Likewise.
	(finish_enum): Likewise.
	(start_function): Likewise.
	(finish_function): Likewise.
	(start_method): Adjust call to cp_finish_decl.
	* decl2.c (finish_static_data_member_decl): Don't manipulate
	obstacks.
	(grokfield): Likewise.
	(grokbitfield): Likewise.
	(get_temp_name): Likewise.
	(get_sentry): Likewise.
	(fnish_file): Likewise.
	(lookup_arg_dependent): Likewise.
	* except.c (call_eh_info): Likewise.
	(push_eh_info): Likewise.
	(do_pop_exception): Likewise.
	(initialize_handler_parm): Likewise.
	(expand_end_eh_spec): Likewise.
	(alloc_eh_object): Likewise.
	(expand_throw): Likewise.
	* expr.c (extract_scalar_init): Likewise.
	* init.c (build_java_class_ref): Likewise.
	* lex.c (get_time_identifier): Likewise.
	(snarf_defarg): Likewise.
	(add_defarg_fn): Likewise.
	(is_global): Simplify.
	(do_identifier): Don't check TREE_PERMANENT.
	* method.c (emit_thunk): Don't manipulate obstacks.
	* parse.y (condition): Adjust call to cp_finish_decl.
	(primary): Likewise.
	(initdcl): Likewise.
	(initdcl0_innards): Likewise.
	(nomods_initdcl0): Likewise.
	* pt.c (push_inline_template_parms_recursive): Use
	SET_DECL_TEMPLATE_PARM_P.
	(process_template_parm): Likewise.
	(lookup_template_class): Don't manipulate obstacks.
	(instantiate_class_template): Adjust call to
	finish_static_data_member_decl.
	(tsubst_decl): Don't manipulate obstacks.
	(tsubst_expr): Likewise.
	(instantiate_template): Likewise.
	(instantiate_decl): Adjust calls to cp_finish_decl.
	* rtti.c (call_void_fn): Don't manipulate obstacks.
	(get_tinfo_var): Likewise.
	(get_tinfo_fn_unused): Likewise.
	(build_dynamic_cast_1): Likewise.
	(expand_si_desc): Likewise.
	(expand_class_desc): Likewise.
	(expand_ptr_desc): Likewise.
	(expand_attr_desc): Likewise.
	(expand_generic_desc): Likewise.
	(synthesize_tinfo_fn): Likewise.
	* search.c (expand_upcast_fixups): Likewise.
	* semantics.c (finish_asm_stmt): Likewise.
	(finish_named_return_value): Likewise.
	(begin_class_definition): Likewise.
	(finish_class_definition): Likewise.
	(finish_typeof): Likewise.
	* tree.c (build_cplus_method_type): Likewise.
	(reverse_path): Likewise.
	(copy_template_template_parm): Likewise.
	(build_expr_ptr_wrapper): Likewise.
	(push_expression_obstack): Remove.
	(push_permanent_obstack): Likewise.
	* typeck.c (mark_addressable): Likewise.

From-SVN: r30527
1999-11-14 20:29:06 +00:00
Jason Merrill 794d4a61f8 decl.c (duplicate_decls): Propagate DECL_DEFER_OUTPUT.
* decl.c (duplicate_decls): Propagate DECL_DEFER_OUTPUT.
	* decl2.c (comdat_linkage): Set DECL_DEFER_OUTPUT.
	* rtti.c (get_tinfo_fn_unused): Split out from get_tinfo_fn.
	* class.c (set_rtti_entry): Use it.

From-SVN: r30523
1999-11-13 04:39:11 -05:00
Martin v. Löwis 7c355bca10 cp-tree.h (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK): New macro.
* cp-tree.h (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK): New macro.
	(DECL_TEMPLATE_INFO): Use it.
	* decl.c (warn_extern_redeclared_static): Do nothing for
	TEMPLATE_DECLs.
	* decl2.c (mark_used): Explicitly check for function or variable.
	* semantics.c (finish_unary_op_expr): Check whether result is also
	an INTEGER_CST.

From-SVN: r30426
1999-11-05 23:11:58 +00:00
Scott Snyder f5733617e3 decl2.c (build_expr_from_tree): Handle REALPART_EXPR and IMAGPART_EXPR.
1999-11-02  Scott Snyder  <snyder@fnal.gov>

        * decl2.c (build_expr_from_tree): Handle REALPART_EXPR and
        IMAGPART_EXPR.
	* pt.c (tsubst_copy): Likewise.

From-SVN: r30366
1999-11-03 06:52:46 +00:00
Jason Merrill b78121f657 decl2.c (maybe_make_one_only): Always make things comdat on ELF targets, too.
* decl2.c (maybe_make_one_only): Always make things comdat on
	ELF targets, too.

From-SVN: r30341
1999-11-02 02:33:05 -05:00
Mark Mitchell 13ef1ec581 decl2.c (start_static_storage_duration_function): Push the function declaration so it ends up in namespace scope.
* decl2.c (start_static_storage_duration_function): Push the
	function declaration so it ends up in namespace scope.

From-SVN: r29838
1999-10-06 06:18:18 +00:00
Nathan Sidwell ce7695e001 decl2.c (grok_alignof): Don't decay lvalues.
* decl2.c (grok_alignof): Don't decay lvalues.

	* init.c (build_new): Remove unused variable.

From-SVN: r29805
1999-10-04 15:13:26 +00:00
Mark Mitchell 2b76013c9a cp-tree.h (lang_decl_flags): Add global_ctor_p and global_dtor_p.
* cp-tree.h (lang_decl_flags): Add global_ctor_p and
	global_dtor_p.  Add init_priority.
	(DECL_ACCESS): Adjust accordingly.
	(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,
	and GLOBAL_INIT_PRIORITY.
	* dump.c (dequeue_and_dump): Print them.
	* ir.texi: Document them.

From-SVN: r29738
1999-10-01 00:43:27 +00:00
Mark Mitchell 313bc2c262 decl2.c (struct priority_info_s): Remove initialization_sequence and destruction_sequence.
* decl2.c (struct priority_info_s): Remove initialization_sequence
	and destruction_sequence.
	(start_static_storage_duration_function): Return the body of the
	function.  Convert for function-at-a-time mode.
	(generate_inits_for_priority): Remove.
	(finish_static_storage_duration_function): Change prototype.
	Adjust for function-at-a-time mode.
	(do_static_initialization): Likewise.
	(do_static_destruction): Likewise.
	(do_static_initialization_and_destruction): Remove.
	(start_static_initialization_or_destruction): New function.
	(finish_static_initialization_or_destruction): Likewise.
	(get_priority_info): Don't manipulation initialization_sequence or
	destruction_sequence.
	(prune_vars_needing_no_initialization): New function.
	(write_out_vars): Likewise.
	(finish_file): Use the various new functions instead of the old.

From-SVN: r29731
1999-09-30 15:48:19 +00:00
Dirk Zoller 1bdba2c09c cp-tree.h (warn_float_equal): Declare.
* cp-tree.h (warn_float_equal): Declare.
        * decl2.c (warn_float_equal): Define.
        (lang_decode_option): Recognize -W[no-]float-equal.
        * typeck.c (build_binary_op_nodefault): Conditionally warn
        about equality tests of floating point types.

From-SVN: r29721
1999-09-30 00:15:53 -06:00
Jason Merrill db48b8315f Support normal type_info-based EH mechanisms with -fno-rtti.
* except.c (build_eh_type_type): Remove special -fno-rtti handling.
	(build_eh_type_type_ref): Likewise.
	(build_eh_type): Remove.
	(expand_throw): Call build_eh_type_type, not build_eh_type.
	* decl2.c (import_export_decl): Don't associate the tinfo fn with
	the vtable if -fno-rtti.
	* decl.c (init_decl_processing): Always init_rtti_processing.

	* rtti.c (get_typeid): Don't complain about -fno-rtti.

From-SVN: r29715
1999-09-29 20:50:29 -04:00
Mark Mitchell 84df082b38 cp-tree.h (UPT_TEMPLATE): Remove.
* cp-tree.h (UPT_TEMPLATE): Remove.
	(UPT_PARMS): Likewise.
	(DECL_NEEDED_P): New macro.
	* decl2.c (finish_vtable_vardecl): Use it.
	(finish_objects): Don't crash with -fsyntax-only.
	(finish_file): Use DECL_NEEDED_P.  Don't prune vtables when
	-fsyntax-only.
	* pt.c (tsubst_friend_function): Remove FIXME that talks about
	obstacks.
	(tsubst_expr): Correct handling of function try-blocks.
	* semantics.c: Include flags.h.
	(expand_body): Don't do RTL generation if -fsyntax-only.
	* Makefile.in (semantics.o): Depends on flags.h.

From-SVN: r29705
1999-09-29 08:06:21 +00:00
Mark Mitchell 914653a2a7 cp-tree.h (language_function): Add cannot_inline.
* cp-tree.h (language_function): Add cannot_inline.
	* decl.c (start_function): Restore current_function_cannot_inline
	from the saved value.
	(save_function_data): Save current_function_cannot_inline.
	* decl2.c (start_objects): Change prototype.  Build the function
	in function-at-a-time mode.
	(finish_objects): Likewise.
	(generate_ctor_or_dtor_function): Adjust accordingly.

From-SVN: r29646
1999-09-24 01:29:29 +00:00
Mark Mitchell 0fa5e05c2f cp-tree.h (DECL_ANON_UNION_ELEMS): New macro.
* 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.

From-SVN: r29645
1999-09-24 01:17:29 +00:00
Jason Merrill 5096c664f7 lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
* lex.c: Get WCHAR_TYPE_SIZE from wchar_type_node.
	* 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
	int' for wchar_t.

From-SVN: r29639
1999-09-23 17:04:10 -04:00
Mark Mitchell 5fdaba8942 decl.c (pushdecl): Do create a binding for extern "C" functions...
* decl.c (pushdecl): Do create a binding for extern "C" functions,
	but not for their DECL_ASSEMBLER_NAMEs.
	(lookup_name_current_level): Fix formatting.
	(xref_tag): Likewise.
	* decl2.c (start_objects): Mark static constructors and
	destructors as used.

From-SVN: r29609
1999-09-23 02:04:33 +00:00
Jason Merrill b0a1da1950 decl.c (define_case_label): Don't crash if we're not in a switch.
* decl.c (define_case_label): Don't crash if we're not in a switch.

	* decl2.c (lang_decode_option): Don't bother explicitly ignoring flags.
	* lang-options.h: Restore -fthis-is-variable.  Remove help strings
	for unsupported flags.
	* decl2.c (lang_decode_option): Accept and ignore -finit-priority.
	Accept and warn about -fthis-is-variable.

From-SVN: r29594
1999-09-22 15:16:37 -04:00
Jason Merrill 2a135ded8c decl2.c (lang_decode_option): Accept and ignore -finit-priority.
* decl2.c (lang_decode_option): Accept and ignore -finit-priority.
	Accept and warn about -fthis-is-variable.

From-SVN: r29571
1999-09-21 20:30:34 -04:00
Mark Mitchell 69ca76581e decl2.c (lang_decode_option): Adjust, in the wake of recent changes to option processing.
* decl2.c (lang_decode_option): Adjust, in the wake of recent
	changes to option processing.

From-SVN: r29562
1999-09-21 20:19:18 +00:00
Mark Mitchell 9bfadf57a2 Remove support for assigning to `this'.
* NEWS: Note that fact.
	* class.c (build_vbase_path): Don't check flag_this_is_variable.
	* cp-tree.h (EXPR_STMT_ASSIGNS_THIS): Remove.
	(language_function): Remove assigns_this, just_assigned_this, and
	x_base_init_expr.  Add x_vcalls_possible_p.  Add vtbls_set_up_p.
	(base_init_expr): Remove.
	(current_vcalls_possible_p): New macro.
	(vtbls_set_up_p): Likewise.
	(emit_base_init): Change prototype.
	* decl.c (finish_destructor_body): New function, split out from
	finish_function.
	(current_function_assigns_this): Remove.
	(current_function_just_assigned_this): Likewise.
	(start_function): Don't set them.
	(finish_function): Don't check them.  Don't emit
	base-initialization code here.  Generate code for destructors when
	doing semantic analysis.
	(finish_stmt): Don't check current_function_just_assigned_this.
	* decl2.c (lang_f_options): Remove this-is-variable.
	(lang_decode_option): Likewise.
	(grokclassfn): Don't check flag_this_is_variable.
	* init.c (emit_base_init): Return the expression generated.
	(construct_virtual_bases): Don't push/pop obstacks.  Fix
	typo.
	(build_new_1): Don't check flag_this_is_variable.
	(get_temp_regvar): Don't set DECL_REGISTER.
	(build_vec_init): Don't call use_variable.
	* lang-options.h: Remove "-fthis-is-variable" and
	"-fno-this-is-variable".
	* pt.c (tsubst_expr): Don't check EXPR_STMT_ASSIGNS_THIS.
	* search.c (expand_upcast_fixups): Use finish_expr_stmt, not
	expand_expr_stmt.
	* semantics.c (finish_expr_stmt_real): Rename to ...
	(finish_expr_stmt): This.  Remove assigned_this parameter.
	(begin_if_stmt): Call do_pushlevel before starting the statement.
	(begin_compound_stmt): Don't declare __FUNCTION__ in scope-less
	blocks.
	(setup_vtbl_ptr): Emit initialization code for bases and members
	at semantic-analysis time.  Emit code to initialize vtables in
	destructors here.
	(expand_stmt): Use finish_expr_stmt, not finish_expr_stmt_real.
	Don't handle CTOR_INITIALIZER any more.
	* 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.
	(call.o): Likewise.
	(method.o): Likewise.
	(search.o): Likewise.
	(tree.o): Likewise.
	(pt.o): Likewise.

	* decl.c (duplicate_decls): When a builtin function is redeclared
	as static, make sure it is mangled correctly.

	* ir.texi (CTOR_INITIALIZER): Remove mention.  Fix typo.  Add
	detail about the statement-tree.

From-SVN: r29531
1999-09-20 20:19:04 +00:00
Nick Clifton 03d32d1a08 Add comment saying that lang_decode_options should not complain about
unrecognised options.

From-SVN: r29522
1999-09-20 14:26:59 +00:00
Jason Merrill 033ed3404f decl2.c (finish_file): Also call check_global_declarations for the pending_statics list.
* decl2.c (finish_file): Also call check_global_declarations for
	the pending_statics list.

From-SVN: r29458
1999-09-16 13:48:20 -04:00
Mark Mitchell 371534a917 decl2.c (build_expr_from_tree): Handle VA_ARG_EXPR.
* decl2.c (build_expr_from_tree): Handle VA_ARG_EXPR.
	* pt.c (tsubst_copy): Likewise.
	* tree.c (search_tree): Likewise.
	(mapcar): Likewise.

From-SVN: r29440
1999-09-15 22:49:33 +00:00
Mark Mitchell 5868eb4e0a decl.c (add_decl_to_level): Remove TREE_PERMANENT assertion.
* decl.c (add_decl_to_level): Remove TREE_PERMANENT assertion.
	(init_decl_processing): Don't set TREE_PERMANENT for the
	error_mark_node.
	(start_decl): Don't rebuild non-permanent ARRAY_TYPEs.
	(grokdeclarator): Likewise.
	(grokparms): Don't check TREE_PERMANENT when building up lists.
	* decl2.c (grokfield): Don't assert TREE_PERMANENT.
	(mark_inline_for_output): Likewise.
	* expr.c (cplus_expand_expr): Don't check TREE_PERMANENT.
	* init.c (build_offset_ref): Don't check TREE_PERMANENT.
	* lex.c (check_newline): Don't check ggc_p; it is always one.
	* pt.c (process_template_parm): Don't check TREE_PERMANENT.
	* spew.c (yylex): Don't copy_node or probe_obstacks for
	non-permanent CONSTANTs and STRINGs.
	* tree.c (build_cplus_array_type_1): Don't fuss with
	TREE_PERMANENT on ARRAY_TYPEs.

From-SVN: r29350
1999-09-12 02:45:30 +00:00
Mark Mitchell ed5511d94e cp-tree.h (language_function): Rename expanding_p to x_expanding_p.
* cp-tree.h (language_function): Rename expanding_p to
	x_expanding_p.  Rename named_label_uses to x_named_label_uses.
	(expanding_p): Adjust accordingly.
	(TREE_VIA_PRIVATE): Fix typo in comment.
	(DECL_REFERENCE_SLOT): Remove.
	(SET_DECL_REFERENCE_SLOT): Likewise.
	* decl.c (named_label_uses): Adjust. Remove chicken comment.
	(push_overloaded_decl): Don't truncate the chain of bindings when
	adding an overloaded function.
	(grok_reference_init): Don't use DECL_REFERENCE_SLOT.
	(initialize_local_var): Fix typo in comment.
	(store_parm_decls): Don't set DECL_REFERENCE_SLOT.  Tidy up.
	* decl2.c (start_objects): Make the fact that we are expanding
	the generated function right away explicit.
	(start_static_storage_duration_function): Likewise.
	(finish_file): Fix typo in comment.
	* init.c (build_vec_init): Correct bugs in handling cleanups.
	* semantics.c (maybe_convert_cond): New function.
	(FINISH_COND): Always store the condition, even if there's
	a declaration.
	(finish_if_stmt_cond): Use maybe_convert_cond.
	(finish_while_stmt_cond): Likewise.
	(finish_do_stmt): Likewise.
	(finish_for_cond): Likewise.
	(expand_cond): Adjust.

From-SVN: r29265
1999-09-10 10:19:47 +00:00
Mark Mitchell a8f73d4b36 Reorganize per-function data.
* cp-tree.h (saved_scope): Add function_decl, bindings.
	(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 function.
	(current_class_ref): Likewise.
	(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
	start_function.
	(current_binding_level): Adjust definition.
	(pushlevel): Simplify.
	(poplevel): Don't use named_label_uses when we're outside
	a function scope.
	(mark_saved_scope): Mark function_decl and bindings.
	(maybe_push_to_top_level): Don't unconditionally push a new
	function context.  Save bindings and the current_function_decl.
	Don't clear named_labels.
	(pop_from_top_level): Pop function context if appropriate.
	(init_decl_processing): Set init_lang_status and free_lang_status,
	rather than save_lang_status and restore_lang_status.
	(start_function): Take SF_* flags.  Don't clear per-function data.
	Reorder and simplify to use new per-function data code.  Add
	asserts.
	(store_parm_decls): Don't call init_function_start here.
	(finish_function): Adjust for new handling of per-function data.
	(push_cp_function_context): Simplify.
	(mark_cp_function_context): Change binding_level to bindings.
	* 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
	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
	data.
	* method.c (emit_thunk): Clear current_function after calling
	assemble_end_function.  Use SF flags for start_function.
	(synthesize_method): Use SF flags for start_function.
	* parse.c: Regenerated.
	* parse.y (fn.defpen): Likewise.
	(pending_inline): Clear current_function, even if something goes
	wrong.
	* pt.c (instantiate_decl): Use SF flags to start_function.
	Don't save and restore expanding_p.
	(add_tree): Handle the case where we are outside any function.
	(end_tree): Likewise.
	* rtti.c (sythesize_tinfo_fn): Use SF flags to start_function.
	* semantics.c (begin_function_definition): Likewise.
	(expand_body): Likewise.

From-SVN: r29240
1999-09-09 19:02:39 +00:00
Mark Mitchell e1b3e07d15 cp-tree.h (scratch_tree_cons): Remove.
* cp-tree.h (scratch_tree_cons): Remove.
	* call.c: Replace all uses of expr_tree_cons, saveable_tree_cons,
	and perm_tree_cons with plain tree_cons.
	* class.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* except.c: Likewise.
	* expr.c: Likewise.
	* init.c: Likewise.
	* lex.c: Likewise.
	* method.c: Likewise.
	* parse.y: Likewise.
	* pt.c: Likewise.
	* repo.c: Likewise.
	* rtti.c: Likewise.
	* search.c: Likewise.
	* typeck.c: Likewise.
	* parse.c: Regenerated.
	* tree.c (build_srcloc): Simplify.

From-SVN: r29225
1999-09-09 06:17:13 +00:00
Mark Mitchell 87e3dbc92a Makefile.in (tree.o): Depend on ggc.h.
* Makefile.in (tree.o): Depend on ggc.h.
	* class.c (make_method_vec): Remove.
	(free_method_vec): Likewise.
	(free_method_vecs): Remove.
	(add_method): Don't use them.
	* cp-tree.def (PTRMEM_CST): Make it longer.
	(TEMPLATE_PARM_INDEX): Make it shorter.
	* cp-tree.h (BINDING_HAS_LEVEL_P): New macro.
	(template_parm_index): Remove RTL field.
	(ptrmem_cst): Add RTL field.
	(finish_function): Removed parameter.
	(process_next_inline): Change prototype.
	(init_cplus_unsave): Rename to init_tree.
	(binding_init): Remove.
	* decl.c (free_binding_nodes): Remove.
	(push_binding): Don't use them.  Set BINDING_HAS_LEVEL_P.
	(pop_binding): Don't use free_binding_nodes.
	(free_binding_vecs): Remove.
	(store_bindings): Don't use them.
	(pop_from_top_level): Likewise.
	(lookup_namespace_name): Simplify.
	(build_typename_type): Don't use obstack_free.
	(unqualified_namespace_lookup): Simplify.
	(lookup_name_real): Simplify.
	(start_function): Remove comment about leaks.
	(finish_function): Removed nested parameter.  Call
	expand_end_bindings even when building_stmt_tree.
	Call ggc_push_context and ggc_pop_context around
	rest_of_compilation, if necessary.
	(mark_cp_function_context): Handle a NULL language-context.
	(lang_mark_false_label_stack): Fix typo.
	(lang_mark_tree): Handle CPLUS_BINDING, OVERLOAD,
	TEMPLATE_PARM_INDEX.  Handle the funny TYPE_LANG_SPECIFIC on
	pointer to method types.
	(lang_cleanup_tree): Use free to free TYPE_LANG_SPECIFIC.
	* decl2.c (finish_objects): Adjust call to finish_function.
	(finish_static_store_duration_function): Likewise.
	(do_nonmember_using_decl): Remove call to binding_init.
	* except.c (end_anon_func): Adjust call to finish_function.
	* lex.c (mark_impl_file_chain): New function.
	(init_parse): Call init_tree, not init_cplus_unsave.
	Add GC roots.
	(cp_pramga_interface): Use xmalloc, not permalloc.
	(cp_pragma_implementation): Likewise.
	(begin_definition_of_inclass_inline): Simplify.
	(process_next_inline): Adjust prototype.
	(do_scoped_id): Don't call binding_init.
	(make_lang_type): Allocate TYPE_LANG_SPECIFIC with xmalloc.
	(emit_thunk): Adjust call to finish_function.
	(synthesize_method): Likewise.
	* parse.y (%union): Add a new `pi' variant.
	(PRE_PARSED_FUNCTION_DECL): Use it.
	(fn.defpen): Likewise.
	(fndef): Adjust call to finish_function.
	(instantiate_decl): Likewise.
	(rtti.c): Likewise.
	(semantics.c): Likewise.
	* tree.c: Include ggc.h.
	(mark_list_hash): New function.
	(binding_init): Remove.
	(init_cplus_unsave): Rename to ...
	(init_tree): This.  Add GC roots.

From-SVN: r29172
1999-09-07 16:07:42 +00:00
Mark Mitchell 9cd64686e8 Get ready for garbage collection.
* Makefile.in (CXX_TREE_H): Add varray.h
	(lex.o): Depend on ggc.h.
	(decl.o): Likewise.
	(decl2.o): Likewise.
	(method.o): Likewise.
	(search.o): Likewise.
	(pt.o): Likewise.
	(repo.o): Likewise.
	* class.c: Include ggc.h.
	(current_class_name): Remove.
	(current_class_type): Likewise.
	(current_access_specifier): Likewise.
	(previous_class_type): Likewise.
	(previous_class_values): Likewise.
	(class_cache_firstobj): Likewise.
	(current_lang_base): Likewise.
	(current_lang_stack): Likewise.
	(current_lang_stacksize): Likewise.
	(lang_name_c): Likewise.
	(lang_name_cplusplus): Likewise.
	(lang_name_java): Likewise.
	(current_lang_name): Likewise.
	(base_layout_decl): Likewise.
	(access_default_node): Likewise.
	(access_public_node): Likewise.
	(access_protected_node): Likewise.
	(access_private_node): Likewise.
	(access_default_virtual_node): Likewise.
	(access_public_virtual_node): Likewise.
	(access_protected_virtual_node): Likewise.
	(access_private_virtual_node): Likewise.
	(signed_zero_node): Likewise.
	(init_class_processing): Don't build base_layout_decl.
	(push_lang_context): Adjust now that current_lang_base is a varray.
	(pop_lang_context): Likewise.
	* cp-tree.h: Include varray.h.
	(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,
	delta_identifier, dtor_identifier, in_charge_identifier,
	index_identifier, nelts_identifier, this_identifier,
	pfn_identifier, pfn_or_delta2_identifier, vptr_identifier,
	lang_name_c, lang_name_cplusplus, lang_name_java,
	empty_except_spec, null, jclass, minus_one, terminate.
	(saved_scope): Move here from decl.c.  Define globals in terms of
	saved_scope: current_namespace, current_class_name,
	current_class_type, current_access_specifier, current_lang_stack,
	current_lang_base, current_lang_name, current_function_parms,
	current_template_parms, processing_template_decl,
	processing_specialization, processing_explicit_instantiation,
	previous_class_type, previous_class_values, class_cache_firstobj.
	(scope_chain): New variable.
	(init_pt): New function.
	* decl.c (current_namespace): Remove.
	(this_identifier, in_charge_identifier, ctor_identifier): Likewise.
	(dtor_identifier, pfn_identifier, index_identifier): Likewise.
	(delta_identifier, delta2_identifier): Likewise.
	(pfn_or_delta2_identifier, tag_identifier): Likewise
	(vt_off_identifier, empty_except_spec, null_node): Likewise.
	(current_function_parms, current_lang_base): Remove.
	(current_lang_stack, previous_class_values): Remove.
	(class_binding_level): Macroize.
	(saved_scope): Remove.
	(current_saved_scope): Rename to scope_chain.
	(mark_saved_scope): Adjust for new scope structure.
	(maybe_push_to_top_level): Likewise.
	(pop_from_top_level): Likewise.
	(duplicate_decls): Adjust now that current_lang_base is a varray.
	(build_typename_type): Call ggc_add_tree_hash_table_root.
	(init_decl_processing): Call init_pt.  Call push_to_top_level to
	set up globals.  Add GC roots.
	(xref_basetypes): Adjust now that current_lang_base is a varray.
	* decl.h (this_identifier): Remove.
	(in_charge_identifier): Likewise.
	* decl2.c: Don't include varray.h.
	(current_namespace): Remove.
	(init_decl2): Add GC roots.
	* except.c (Terminate): Remove.
	(init_exception_processing): Use terminate_node instead.
	(build_terminate_handler): Likewise.
	* init.c (nc_nelts_field_id): Remove.
	(minus_one): Likewise.
	(init_init_processing): Use minus_one_node and nelts_identifier
	instead.  Add GC roots.
	(jclass_node): Remove.
	(build_new_1): Use nelts_identifier.
	(build_vec_init): Likewise.
	(build_vec_delete): Likewise.
	* lex.c: Include ggc.h.
	(defarg_fn): Move declaration early.
	(defarg_parms): Likewise.
	(init_parse): Add GC roots.
	(handle_cp_pragma): Remove redundant declaration of
	pending_vtables.
	* method.c: Include ggc.h.
	(btypelist): Make it a varray.  All uses changed.
	(ktypelist): Likewise.
	(init_method): Add GC roots.
	* pt.c: Don't include varray.h.  Include ggc.h.
	(current_template_parms): Remove.
	(processing_template_decl): Likewise.
	(processing_specialization): Likewise.
	(processing_explicit_instantiation): Likewise.
	(init_pt): New function.
	* repo.c: Include ggc.h.
	(init_repo): Add GC roots.
	* search.c: Don't include varray.h.
	(_vptr_name): Remove.
	(lookup_field_1): Use vtpr_identifier instead.
	(expand_indirect_vtbls_init): Remove redundant declaration of
	in_charge_identifier.
	(init_search_processing): Use vptr_identifier.

From-SVN: r29135
1999-09-06 02:43:09 +00:00
Richard Henderson fc6af6e322 Makefile.in (parse.o): Depend on ggc.h.
* Makefile.in (parse.o): Depend on ggc.h.
	(decl2.o): Depend on ggc.h.
	(init.o): Depend on ggc.h.
	* cp-tree.h (init_decl2): Declare.
	(cp_parse_init): Likewise.
	* decl.c (ggc_p): Define to zero.
	(mark_saved_scope): New function.
	(init_decl_processing): Call cp_parse_init, and cp_decl2.
	Register GC roots.
	(expand_static_init): Add GC roots.
	* decl2.c: Include ggc.h.
	(init_decl2): New function.
	* init.c: Include ggc.h.
	(init_init_processing): Add GC roots.
	* parse.y: Include ggc.h.
	(cp_parse_init): New function.

Co-Authored-By: Bernd Schmidt <bernds@cygnus.co.uk>
Co-Authored-By: Mark Mitchell <mark@codesourcery.com>

From-SVN: r29126
1999-09-05 16:21:30 +00:00
Mark Mitchell b4b8bee7bd decl.c (init_decl_processing): Set mark_lang_status.
* decl.c (init_decl_processing): Set mark_lang_status.
	(lang_mark_false_label_stack): Adjust prototype.
	* decl2.c (grok_function_init): Remove extraneous declaration of
	abort_fndecl.

From-SVN: r29120
1999-09-05 02:53:03 +00:00
Mark Mitchell 99dccabc3c Makefile.in (CXX_TREE_H): Include function.h.
* Makefile.in (CXX_TREE_H): Include function.h.
	(decl.o): Don't depend on function.h.
	(decl2.o): Likewise.
	(typeck.o): Likewise.
	(init.o): Likewise.
	(method.o): Likewise.
	* cp-tree.h: Include function.h.
	(cp_function): Rename to language_function.  Remove next.
	(cp_function_chain): Make it a macro, not a variable.
	(push_cp_function_context): Don't declare.
	(pop_cp_function_context): Likewise.
	* decl.c: Don't include function.h.
	(push_cp_function_context): Make it static.  Make it suitable for
	a save_lang_status callback.
	(pop_cp_function_context): Likewise.
	(maybe_push_to_top_level): Call push_function_context_to, not
	push_cp_function_context.
	(pop_from_top_level): Call pop_function_context_from, not
	pop_cp_function_context.
	(init_decl_processing):  Set save_lang_status and
	restore_lang_status.  Call push_function_context_to, not
	push_cp_function_context.
	(cp_function_chain): Remove.
	* decl2.c: Don't include function.h.
	* except.c: Don't include function.h.
	(start_anon_func): Call push_function_context_to, not
	push_cp_function_context.
	(end_anon_func):  Call pop_function_context_from, not
	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.
	(process_next_inline):  Call pop_function_context_from, not
	pop_cp_function_context.
	* method.c: Don't include function.h.
	(synthesize_method): Call push_function_context_to, not
	push_cp_function_context.  Call pop_function_context_from, not
	pop_cp_function_context.
	* typeck.c: Don't include function.h.

From-SVN: r29096
1999-09-04 02:19:29 +00:00
Mark Mitchell 8012c98334 cp-tree.h (cp_function): Move here, from decl.c.
* cp-tree.h (cp_function): Move here, from decl.c.
	(cp_function_chain): Declare.
	(dtor_label): New macro, instead of variable.
	(ctor_label): Likewise.
	(current_base_init_list): Likewise.
	(current_member_init_list): Likewise.
	(base_init_expr): Likewise.
	(current_class_ptr): Likewise.
	(current_class_ref): Likewise.
	(last_tree): Likewise.
	(last_expr_type): Likewise.
	(current_function_returns_value): Likewise.
	(current_function_returns_null): Likewise.
	(current_function_just_assigned_this): Likewise.
	(current_function_parms_stored): Likewise.
	(temp_name_counter): Likewise.
	(static_labelno): Likewise.
	(expanding_p): Likewise.
	(stmts_are_full_exprs_p): Likewise.
	(in_function_try_handler): Likewise.
	(lang_type): Remove nested type_flags.  All uses changed.
	* call.c (ctor_label): Remove.
	(dtor_label): Likewise.
	* class.c (current_class_ptr): Remove.
	(current_class_ref): Likewise.
	* decl.c (static_labelno): Remove.
	(dtor_label): Likewise.
	(last_dtor_insn): New macro, instead of variable.
	(last_parm_cleanup_insn): Likewise.
	(original_result_rtx): Likewise.
	(in_function_try_handler): Remove.
	(named_label_uses): New macro, instead of variable.
	(named_labels): Likewise.
	(current_function_returns_value): Remove.
	(current_function_returns_null): Likewise.
	(current_function_assigns_this): New macro, instead of variable.
	(current_function_just_assigned_this): Likewise.
	(current_binding_level): Likewise.
	(init_decl_processing): Call push_cp_function_context.
	(cp_function): Move to cp-tree.h
	(cp_function_chain): Make it global.
	(temp_name_counter): Remove.
	(push_cp_function_context): Simplify.
	(pop_cp_function_context): Likewise.
	* decl2.c (temp_name_counter): Remove.
	* init_c (current_base_init_list): Likewise.
	(current_member_init_list): Likewise.
	(base_init_expr): Likewise.
	* method.c (static_labelno): Likewise.
	* pt.c (last_tree): Likewise.
	* semantics.c (expanding_p): Likewise.
	(stmts_are_full_exprs_p): Likewise.
	(last_expr_type): Likewise.
	* typeck.c (dtor_label): Likewise.
	(ctor_label): Likewise.

From-SVN: r29062
1999-09-02 19:14:06 +00:00
Alex Samuel ec4f972f6c decl2.c (arg_assoc_template_arg): New prototype.
* decl2.c (arg_assoc_template_arg): New prototype.  New function.
	(arg_assoc_class): Use arg_assoc_template_arg for template
	arguments.
	(arg_assoc): Likewise.
	* pt.c (mangle_class_name_for_template): Allow member template
	template arguments.

From-SVN: r29060
1999-09-02 17:29:11 +00:00
Mark Mitchell b7b8bcd23a cp-tree.h (TYPE_NEEDS_CONSTRUCTING): Remove #if 0'd definition.
* cp-tree.h (TYPE_NEEDS_CONSTRUCTING): Remove #if 0'd definition.
	(maybe_inject_for_scope_var): Declare it.
	(initialize_local_var): Likewise.
	* decl.c (maybe_inject_for_scope_var): Make it global.
	(initialize_local_var): Likewise.  Move cleanup handling here,
	from cp_finish_decl.
	(make_rtl_for_nonlocal_decl): Use
	push_obstacks_nochange/pop_obstacks, rather than
	end_temporary_allocation/resume_temporary_allocation.
	(cp_finish_decl): Try to complete the type of a variable when it
	is declared.  Move cleanup-handling to initialize_local_var.
	(expand_static_init): Use tree-building code, rather than
	RTL-building code.
	* decl2.c (get_temp_name): Assert non-initializedness of
	temporaries.
	* init.c (create_temporary_var): Move RTL-assigning code to ...
	(get_temp_regvar): Here.
	* 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.

From-SVN: r28973
1999-08-29 19:03:31 +00:00
Richard Henderson 31aa49b770 * decl2.c (arg_assoc_class): Bail if the class is a builtin type.
From-SVN: r28954
1999-08-28 18:20:54 -07:00
Mark Mitchell f1dedc319f cp-tree.def (SUBOBJECT): New tree node.
* cp-tree.def (SUBOBJECT): New tree node.
	* cp-tree.h (CLEANUP_P): New macro.
	(SUBOBJECT_CLEANUP): Likewise.
	(keep_next_level): Add parameter.
	(get_temp_regvar): Don't declare.
	(emit_base_init): Remove parameter.
	(expand_aggr_init): Rename to build_aggr_init.
	(expand_vec_init): Rename to build_vec_init.
	(do_pushlevel): Remove.
	(do_poplevel): Likewise.
	(finish_cleanup): New function.
	(finish_subobject): Likewise.
	(stmts_are_full_exprs_p): New variable.
	* decl.c (keep_next_level): Add parameter.
	(cp_finish_decl): Use build_aggr_init, not
	expand_aggr_init.  Use finish_expr_stmt to expand the code.
	(expand_static_init): Use tree-generating, not RTL-generating,
	functions to handle the initialization.
	(start_function): Remove dead code.  Always have a momentary
	obstack inside the function, even before hitting the first curly
	brace.
	(cplus_expand_expr_stmt): Move calls to
	expand_{start,end}_target_temps into semantics.c.
	(cp_function): Add stmts_are_full_exprs_p.
	(push_cp_function_context): Save it.
	(pop_cp_function_context): Restore it.
	* decl2.c (get_temp_regvar): Move to init.c.
	(do_static_initialization): Use build_{aggr,vec}_init.
	(do_static_destruction): Fix typo in comment.
	* dump.c (dequeue_and_dump): Handle INIT_EXPR.
	* except.c (expand_throw): Use create_temporary_var.
	* expr.c (cplus_expand_expr): Use build_{aggr,vec}_init.
	* init.c (expand_vec_init_try_block): Remove.
	(expand_vec_init_catch_clause): Likewise.
	(get_temp_regvar): New function.
	(begin_init_stmts): Likewise.
	(finish_init_stmts): Likewise.
	(perform_member_init): Use build_{aggr,vec}_init.  Build up tree
	structure here.
	(emit_base_init): Likewise.  Remove unused parameter.
	(expand_virtual_init): Likewise.
	(expand_cleanup_for_base): Use finish_subobject.
	(expand_aggr_vbase_init_1): Simplify.
	(construct_virtual_bases): Use tree-generating functions to build
	up initialization.
	(expand_aggr_init): Likewise.  Rename to build_aggr_init.
	(expand_default_init): Likewise.
	(expand_aggr_init_1): Likewise.
	(expand_vec_init): Rename to build_vec_init.
	* method.c (do_build_copy_constructor): Use tree-generating
	functions.  Don't call clear_last_expr.
	(do_build_assign_ref): Likewise.
	(synthesize_method): Call clear_last_expr here.
	* parse.y (base_init): Don't call clear_last_expr here.
	(nodecls): Likewise.
	* pt.c (tsubst_expr): Handle a TRY_BLOCK with CLEANUP_P set.
	* semantics.c (do_pushlevel): Move to here.
	(do_poplevel): Likewise.
	(stmts_are_full_exprs_p): New variable.
	(finish_expr_stmt): Handle logic for temoprary cleanup here.
	(finish_for_stmt): Use finish_expr_stmt.
	(finish_cleanup): New function.
	(finish_function_try_block): Fix indentation.
	(finish_subobject): New function.
	(setup_vtbl_ptr): Call keep_next_level here.
	(finish_stmt_expr): Handle a block with no scope inside the
	statement-expression.
	(expand_stmt): Handle a TRY_BLOCK with CLEANUP_P set.  Handle
	SUBOBJECT.
	* tree.c (search_tree): Handle INIT_EXPR.
	(mapcar): Likewise.
	* typeck.c (build_modify_expr): Don't build an RTL_EXPR.
	* typeck2.c (store_init_value): Change expand_aggr_init to
	build_aggr_init in comment.

From-SVN: r28878
1999-08-25 22:07:18 +00:00
Nathan Sidwell d7f426dc12 decl2.c (handle_class_head): Be graceful about additional scope qualifiers.
* decl2.c (handle_class_head): Be graceful about additional
scope qualifiers. Adjust comments to reflect reality.

From-SVN: r28856
1999-08-25 12:04:47 +00:00
Jason Merrill 2aaf816dad cp-tree.h: Declare flag_use_repository.
* cp-tree.h: Declare flag_use_repository.
	* pt.c (do_decl_instantiation): Don't complain about duplicate
	instantiation with -frepo.
	(do_type_instantiation): Likewise.

	* pt.c (push_template_decl_real): Complain about everything
	that isn't a valid template.

	* decl2.c (import_export_decl): If -fnew-abi, class linkage doesn't
	affect inlines.

From-SVN: r28767
1999-08-19 17:19:37 -04:00
Mark Mitchell 40242ccfbd cp-tree.def (PSEUDO_DTOR_EXPR): New tree code.
* cp-tree.def (PSEUDO_DTOR_EXPR): New tree code.
	* decl2.c (build_expr_from_tree): Handle it.
	* error.c (dump_expr): Likewise.
	* pt.c (for_each_template_parm): Likewise.
	(tsubst_copy): Likewise.
	* tree.c (search_tree): Likewise.
	* semantics.c (finish_pseudo_destructor_call): Create it.

From-SVN: r28760
1999-08-19 08:06:17 +00:00
Mark Mitchell 4ce3d53730 cp-tree.h (build_lang_field_decl): Remove.
* cp-tree.h (build_lang_field_decl): Remove.
	* class.c (build_vtable): Replace calls to build_lang_field_decl
	with build_lang_decl.
	(prepare_fresh_vtable): Likewise.
	(finish_struct_1): Likewise.
	(init_class_processing): Likewise.
	* decl.c (push_using_decl): Likewise.
	(init_decl_processsing): Likewise.
	(grokvardecl): Likewise.
	(build_ptrmemfunc_type): Likewise.
	(grokdeclarator): Likewise.
	(build_enumerator): Likewise.
	* decl2.c (grok_x_components): Likewise.
	(do_class_using_decl): Likewise.
	* except.c (call_eh_info): Likewise.
	* init.c (init_init_processing): Likewise.
	* rtti.c (expand_class_decl): Likewise.
	* tree.c (build_base_fields): Likewise.
	(build_vbase_pointer_fields): Likewise.
	* lex.c (build_lang_decl): Build declarations on the permanent
	obstack if we're building statmeent trees.
	(retrofit_lang_decl): Handle both the full lang_decl and also the
	smaller lang_decl_flags here.
	(build_lang_field_decl): Remove.
	* pt.c (push_template_decl_real): Issue errors for variable
	declarations that are not static members.

From-SVN: r28755
1999-08-18 20:44:14 +00:00
Mark Mitchell 1b12a13e40 cp-tree.h (back_end_hook): New variable.
* cp-tree.h (back_end_hook): New variable.
	* decl2.c (back_end_hook): Define it.
	(finish_file): If it's non-NULL, call it.

From-SVN: r28741
1999-08-17 23:07:54 +00:00
Mark Mitchell 43f887f9f6 cp-tree.h (CALL_DECLARATOR_PARMS): New macro.
* cp-tree.h (CALL_DECLARATOR_PARMS): New macro.
	(CALL_DECLARATOR_QUALS): Likewise.
	(CALL_DECARATOR_EXCEPTION_SPEC): Likewise.
	* decl.c (grokdeclarator): Adjust to use them.
	* decl2.c (grokfield): Likewise.
	(reparse_absdcl_as_casts): Likewise.
	* lex.c (make_call_declarator): Likewise.
	(set_quals_and_spec): Likewise.
	* pt.c (tsubst): Likewise.
	* tree.c (mapcar): Remove special hack to handle third operand of
	a CALL_EXPR.

From-SVN: r28733
1999-08-17 07:20:23 +00:00
Mark Mitchell 558475f07c cp-tree.def (STMT_EXPR): New tree node.
* cp-tree.def (STMT_EXPR): New tree node.
	* cp-tree.h (STMT_EXPR_STMT): New macro.
	(store_return_init): Change prototype.
	(finish_named_return_value): New function.
	(expand_stmt): Likewise.
	(expand_body): Likewise.
	(begin_stmt_tree): Likewise.
	(finish_stmt_tree): Likewise.
	(expanding_p): New variable.
	(last_expr_type): Likewise.
	(building_stmt_tree): New macro.
	* decl.c (start_function): Use building_stmt_tree, not
	processing_template_decl, where appropriate.
	(store_parm_decls): Likewise.
	(store_return_init): Move most of the body to semantics.c.
	(finish_function): Use building_stmt_tree.
	(finish_stmt): Clear last_expr_type here.
	(cp_function): Add expanding_p, last_tree, last_expr_type.
	(push_cp_function_context): Save them.
	(pop_cp_function_context): Restore them.
	* decl2.c (setup_vtbl_ptr): Move to semantics.c.
	* error.c (dump_expr): Handle STMT_EXPR.
	* except.c (expand_start_catch_block): Use building_stmt_tree.
	Use add_decl_stmt.
	* expr.c (cplus_expand_expr): Handle STMT_EXPR.
	(do_case): Move add_tree call to semantics.c.
	* parse.y (return_init): Use finish_named_return_value.
	(for.init.statement): Use finish_expr_stmt.
	* parse.c: Regenerated.
	* pt.c (do_pushlevel): Move to semantics.c.
	(do_poplevel): Likewise.
	(tsubst_copy): Handle STMT_EXPR instead of BIND_EXPR.
	(tsubst_expr): Don't expand all the way to RTL here.  Handle
	RETURN_INIT and CTOR_INITIALIZER.
	(instantiate_decl): Call expand_body after tsubst'ing into
	DECL_SAVED_TREE.
	* semantics.c (expand_stmts): New function.
	(expanding_p): New variable.
	(last_expr_type): Likewise.
	(finish_expr_stmt): Use building_stmt_tree.
	(begin_if_stmt): Likewise.
	(finish_if_stmt_cond): Likewise.
	(finish_then_clause): Likewise.
	(begin_else_clause): Likewise.
	(finish_else_clause): Likewise.
	(begin_while_stmt): Likewise.
	(finish_while_stmt_cond): Likewise.
	(finish_while_stmt): Likewise.
	(finish_do_body): Likewise.
	(finish_do_stmt): Likewise.
	(finish_return_stmt): Likewise.
	(begin_for_stmt): Likewise.
	(fnish_for_init_stmt): Likewise.
	(finish_for_cond): Likewise.
	(finish_for_expr): Likewise.
	(finish_for_stmt): Likewise.
	(finish_break_stmt): Likewise.
	(finish_continue_stmt): Likewise.
	(finish_switch_cond): Likewise.
	(finish_switch_stmt): Likewise.
	(finish_case_label): Call add_tree here if necessary.
	(finish_goto_statement): Use building_stmt_tree.
	(begin_try_block): Likewise.
	(begin_function_try_block): Likewise.
	(finish_try_block): Likewise.
	(finish_function_try_block): Likewise.
	(finish_handler_sequence): Likewise.
	(finish_function_handler_sequence): Likewise.
	(begin_handler): Likewise.
	(finish_handler_parms): Likewise.
	(finish_handler): Likewise.
	(begin_compound_stmt): Likewise.
	(finish_compound_stmt): Likewise.
	(finish_asm_stmt): Likewise.
	(finish_label_stmt): Likewise.
	(finish_named_return_value): New function.
	(setup_vtbl_ptr): Moved here from decl2.c.
	(do_pushlevel): Moved here from pt.c.
	(do_poplevel): Likewise.
	(begin_stmt_expr): Use building_stmt_tree.
	(finish_stmt_expr): Likewise.  Build a STMT_EXPR, not a BIND_EXPR,
	when building_stmt_tree.
	(begin_stmt_tree): New function.
	(finish_stmt_tree): Likewise.
	(expand_stmt): Likewise.
	(expand_body): Likewise.
	* tree.c (build_cplus_method_type): Make sure the argument types
	end up on the same obstack as the METHOD_TYPE.
	(search_tree): Handle COMPOUND_EXPR, MODIFY_EXPR,
	THROW_EXPR, STMT_EXPR.
	(mapcar): Break out common cases.  Handle COMPOUND_EXPR,
	MODIFY_EXPR, THROW_EXPR, STMT_EXPR, RTL_EXPR.  Abort, rather than
	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.

From-SVN: r28729
1999-08-16 19:01:36 +00:00
Jason Merrill 2c169babb6 Speed up Koenig lookup.
* decl.c (unqualified_namespace_lookup): Nonstatic.  Add spacep parm
	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
	namespaces seen in unqualified lookup.
	* call.c (equal_functions): Move here from tree.c.
	(joust): Use it to handle duplicate candidates.
	* tree.c (ovl_member): Use ==.

From-SVN: r28710
1999-08-14 07:08:53 -04:00