cp-tre.h (finish_function): Change prototype.

* cp-tre.h (finish_function): Change prototype.
	* decl.c (end_cleanup_fn): Adjust caller.
	(finish_function): Take only one parameter.
	* decl2.c (finish_objects): Adjust caller.
	(finish_static_storage_duration_function): Likewise.
	* method.c (emit_thunk): Likewise.
	* parse.y: Likewise.
	* parse.c: Regenerated.
	* pt.c (instantiate_decl): Likewise.
	* rtti.c (synthesize_tinfo_fn): Likewise.
	* semantics.c (expand_body): Likewise.

	* cp-tree.h (copy_decl): New function.
	* class.c (finish_struct_1): Use it.
	* lex.c (copy_decl): Define it.
	* pt.c (tsubst_decl): Likewise.
	* tree.c (copy_template_template_parm): Likewise.

From-SVN: r33079
This commit is contained in:
Mark Mitchell 2000-04-11 16:27:42 +00:00 committed by Mark Mitchell
parent 2133335f6a
commit 0acf7199cc
13 changed files with 61 additions and 44 deletions

View File

@ -1,5 +1,23 @@
2000-04-11 Mark Mitchell <mark@codesourcery.com>
* cp-tre.h (finish_function): Change prototype.
* decl.c (end_cleanup_fn): Adjust caller.
(finish_function): Take only one parameter.
* decl2.c (finish_objects): Adjust caller.
(finish_static_storage_duration_function): Likewise.
* method.c (emit_thunk): Likewise.
* parse.y: Likewise.
* parse.c: Regenerated.
* pt.c (instantiate_decl): Likewise.
* rtti.c (synthesize_tinfo_fn): Likewise.
* semantics.c (expand_body): Likewise.
* cp-tree.h (copy_decl): New function.
* class.c (finish_struct_1): Use it.
* lex.c (copy_decl): Define it.
* pt.c (tsubst_decl): Likewise.
* tree.c (copy_template_template_parm): Likewise.
* cp-tree.h (lang_type): Remove has_nonpublic_ctor and
has_nonpublic_assign_ref.
(TYPE_HAS_NONPUBLIC_CTOR): Don't declare.

View File

@ -4645,8 +4645,7 @@ finish_struct_1 (t)
{
tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
vfield = copy_node (vfield);
copy_lang_decl (vfield);
vfield = copy_decl (vfield);
DECL_FIELD_CONTEXT (vfield) = t;
DECL_FIELD_OFFSET (vfield)

View File

@ -3833,7 +3833,7 @@ extern int start_function PARAMS ((tree, tree, tree, int));
extern void expand_start_early_try_stmts PARAMS ((void));
extern void store_parm_decls PARAMS ((void));
extern void store_return_init PARAMS ((tree));
extern tree finish_function PARAMS ((int, int));
extern tree finish_function PARAMS ((int));
extern tree start_method PARAMS ((tree, tree, tree));
extern tree finish_method PARAMS ((tree));
extern void hack_incomplete_structures PARAMS ((tree));
@ -4048,6 +4048,7 @@ extern int real_yylex PARAMS ((void));
extern int is_rid PARAMS ((tree));
extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree));
extern void retrofit_lang_decl PARAMS ((tree));
extern tree copy_decl PARAMS ((tree));
extern void copy_lang_decl PARAMS ((tree));
extern tree cp_make_lang_type PARAMS ((enum tree_code));
extern tree make_aggr_type PARAMS ((enum tree_code));

View File

@ -8283,7 +8283,7 @@ end_cleanup_fn ()
{
do_poplevel ();
expand_body (finish_function (lineno, 0));
expand_body (finish_function (0));
pop_from_top_level ();
}
@ -13939,8 +13939,7 @@ finish_destructor_body ()
after the class definition is complete.) */
tree
finish_function (lineno, flags)
int lineno;
finish_function (flags)
int flags;
{
register tree fndecl = current_function_decl;
@ -13951,6 +13950,7 @@ finish_function (lineno, flags)
int inclass_inline = (flags & 2) != 0;
int expand_p;
int nested;
int current_line = lineno;
/* When we get some parse errors, we can end up without a
current_function_decl, so cope. */
@ -14065,7 +14065,7 @@ finish_function (lineno, flags)
DECL_CONTEXT (no_return_label) = fndecl;
DECL_INITIAL (no_return_label) = error_mark_node;
DECL_SOURCE_FILE (no_return_label) = input_filename;
DECL_SOURCE_LINE (no_return_label) = lineno;
DECL_SOURCE_LINE (no_return_label) = current_line;
expand_goto (no_return_label);
}
@ -14104,7 +14104,7 @@ finish_function (lineno, flags)
immediate_size_expand = 1;
/* Generate rtl for function exit. */
expand_function_end (input_filename, lineno, 1);
expand_function_end (input_filename, current_line, 1);
}
/* We have to save this value here in case

View File

@ -2861,7 +2861,7 @@ finish_objects (method_type, initp, body)
/* Finish up. */
finish_compound_stmt(/*has_no_scope=*/0, body);
fn = finish_function (lineno, 0);
fn = finish_function (0);
expand_body (fn);
/* When only doing semantic analysis, and no RTL generation, we
@ -3045,7 +3045,7 @@ finish_static_storage_duration_function (body)
{
/* Close out the function. */
finish_compound_stmt (/*has_no_scope=*/0, body);
expand_body (finish_function (lineno, 0));
expand_body (finish_function (0));
}
/* Return the information about the indicated PRIORITY level. If no

View File

@ -5014,6 +5014,19 @@ copy_lang_decl (node)
DECL_LANG_SPECIFIC (node) = ld;
}
/* Copy DECL, including any language-specific parts. */
tree
copy_decl (decl)
tree decl;
{
tree copy;
copy = copy_node (decl);
copy_lang_decl (copy);
return copy;
}
tree
cp_make_lang_type (code)
enum tree_code code;

View File

@ -2157,7 +2157,7 @@ emit_thunk (thunk_fndecl)
t = build_call (function, t);
finish_return_stmt (t);
expand_body (finish_function (lineno, 0));
expand_body (finish_function (0));
/* Don't let the backend defer this function. */
if (DECL_DEFER_OUTPUT (thunk_fndecl))
@ -2405,7 +2405,7 @@ synthesize_method (fndecl)
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
}
expand_body (finish_function (lineno, 0));
expand_body (finish_function (0));
extract_interface_info ();
if (! context)

View File

@ -4908,11 +4908,11 @@ case 85:
break;}
case 91:
#line 735 "parse.y"
{ expand_body (finish_function (lineno, (int)yyvsp[-1].itype)); ;
{ expand_body (finish_function ((int)yyvsp[-1].itype)); ;
break;}
case 92:
#line 737 "parse.y"
{ expand_body (finish_function (lineno, (int)yyvsp[0].itype)); ;
{ expand_body (finish_function ((int)yyvsp[0].itype)); ;
break;}
case 93:
#line 739 "parse.y"
@ -6419,21 +6419,21 @@ case 458:
case 459:
#line 2104 "parse.y"
{
expand_body (finish_function (lineno, (int)yyvsp[-1].itype | 2));
expand_body (finish_function ((int)yyvsp[-1].itype | 2));
process_next_inline (yyvsp[-3].pi);
;
break;}
case 460:
#line 2109 "parse.y"
{
expand_body (finish_function (lineno, (int)yyvsp[0].itype | 2));
expand_body (finish_function ((int)yyvsp[0].itype | 2));
process_next_inline (yyvsp[-2].pi);
;
break;}
case 461:
#line 2114 "parse.y"
{
finish_function (lineno, 2);
finish_function (2);
process_next_inline (yyvsp[-2].pi); ;
break;}
case 464:

View File

@ -732,9 +732,9 @@ eat_saved_input:
fndef:
fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
{ expand_body (finish_function (lineno, (int)$3)); }
{ expand_body (finish_function ((int)$3)); }
| fn.def1 maybe_return_init function_try_block
{ expand_body (finish_function (lineno, (int)$3)); }
{ expand_body (finish_function ((int)$3)); }
| fn.def1 maybe_return_init error
{ }
;
@ -2102,17 +2102,17 @@ fn.defpen:
pending_inline:
fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
{
expand_body (finish_function (lineno, (int)$3 | 2));
expand_body (finish_function ((int)$3 | 2));
process_next_inline ($1);
}
| fn.defpen maybe_return_init function_try_block
{
expand_body (finish_function (lineno, (int)$3 | 2));
expand_body (finish_function ((int)$3 | 2));
process_next_inline ($1);
}
| fn.defpen maybe_return_init error
{
finish_function (lineno, 2);
finish_function (2);
process_next_inline ($1); }
;

View File

@ -5440,8 +5440,7 @@ tsubst_decl (t, args, type, in_decl)
We also create a new function declaration, which is just
like the old one, but points to this new template, rather
than the old one. */
r = copy_node (t);
copy_lang_decl (r);
r = copy_decl (t);
my_friendly_assert (DECL_LANG_SPECIFIC (r) != 0, 0);
TREE_CHAIN (r) = NULL_TREE;
@ -5681,9 +5680,7 @@ tsubst_decl (t, args, type, in_decl)
point, as they may not represent instantiations of this
template, and in any case are considered separate under the
discrete model. Instead, see add_maybe_template. */
r = copy_node (t);
copy_lang_decl (r);
r = copy_decl (t);
DECL_USE_TEMPLATE (r) = 0;
TREE_TYPE (r) = type;
@ -5819,8 +5816,7 @@ tsubst_decl (t, args, type, in_decl)
case FIELD_DECL:
{
r = copy_node (t);
copy_lang_decl (r);
r = copy_decl (t);
TREE_TYPE (r) = type;
c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
@ -5899,10 +5895,7 @@ tsubst_decl (t, args, type, in_decl)
break;
}
/* This declaration is going to have to be around for a while,
so me make sure it is on a saveable obstack. */
r = copy_node (t);
r = copy_decl (t);
TREE_TYPE (r) = type;
c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
DECL_CONTEXT (r) = ctx;
@ -5912,7 +5905,6 @@ tsubst_decl (t, args, type, in_decl)
DECL_INITIAL (r) = NULL_TREE;
DECL_RTL (r) = 0;
DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0;
copy_lang_decl (r);
/* For __PRETTY_FUNCTION__ we have to adjust the initializer. */
if (DECL_PRETTY_FUNCTION_P (r))
@ -9585,7 +9577,7 @@ instantiate_decl (d, defer_ok)
/*complain=*/1, tmpl);
/* Finish the function. */
expand_body (finish_function (lineno, 0));
expand_body (finish_function (0));
}
/* We're not deferring instantiation any more. */

View File

@ -1274,7 +1274,7 @@ synthesize_tinfo_fn (fndecl)
finish_return_stmt (tmp);
/* Finish the function body. */
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
expand_body (finish_function (lineno, 0));
expand_body (finish_function (0));
}
/* Return the runtime bit mask encoding the qualifiers of TYPE. */

View File

@ -1957,11 +1957,6 @@ begin_class_definition (t)
|| ! CLASSTYPE_INTERFACE_ONLY (t))
CLASSTYPE_VTABLE_NEEDS_WRITING (t) = 1;
}
#if 0
tmp = TYPE_IDENTIFIER ($<ttype>0);
if (tmp && IDENTIFIER_TEMPLATE (tmp))
overload_template_name (tmp, 1);
#endif
reset_specialization();
/* Make a declaration for this class in its own scope. */
@ -2788,7 +2783,7 @@ expand_body (fn)
lineno = STMT_LINENO (DECL_SAVED_TREE (fn));
/* Generate code for the function. */
finish_function (lineno, 0);
finish_function (0);
/* If possible, obliterate the body of the function so that it can
be garbage collected. */

View File

@ -1181,8 +1181,7 @@ copy_template_template_parm (t)
tree t2;
t2 = make_aggr_type (TEMPLATE_TEMPLATE_PARM);
template = copy_node (template);
copy_lang_decl (template);
template = copy_decl (template);
TREE_TYPE (template) = t2;
TYPE_NAME (t2) = template;