Commit 3afb32a4 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (revert_static_member_fn): Change prototype.

	* cp-tree.h (revert_static_member_fn): Change prototype.
	* decl.c (grokfndecl): Adjust call to revert_static_member_fn.
	(grok_op_properties): Likewise.
	(start_function): Likewise.
	(revert_static_member_fn): Simplify.
	* pt.c (check_explicit_specialization): Adjust call to
	revert_static_member_fn.

From-SVN: r32501
parent f01fc059
2000-03-12 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (revert_static_member_fn): Change prototype.
* decl.c (grokfndecl): Adjust call to revert_static_member_fn.
(grok_op_properties): Likewise.
(start_function): Likewise.
(revert_static_member_fn): Simplify.
* pt.c (check_explicit_specialization): Adjust call to
revert_static_member_fn.
2000-03-11 Mark Mitchell <mark@codesourcery.com> 2000-03-11 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (scope_kind): New type. * cp-tree.h (scope_kind): New type.
......
...@@ -3826,7 +3826,7 @@ extern void finish_stmt PARAMS ((void)); ...@@ -3826,7 +3826,7 @@ extern void finish_stmt PARAMS ((void));
extern int in_function_p PARAMS ((void)); extern int in_function_p PARAMS ((void));
extern void replace_defarg PARAMS ((tree, tree)); extern void replace_defarg PARAMS ((tree, tree));
extern void print_other_binding_stack PARAMS ((struct binding_level *)); extern void print_other_binding_stack PARAMS ((struct binding_level *));
extern void revert_static_member_fn PARAMS ((tree*, tree*, tree*)); extern void revert_static_member_fn PARAMS ((tree));
extern void fixup_anonymous_aggr PARAMS ((tree)); extern void fixup_anonymous_aggr PARAMS ((tree));
extern int check_static_variable_definition PARAMS ((tree, tree)); extern int check_static_variable_definition PARAMS ((tree, tree));
extern tree compute_array_index_type PARAMS ((tree, tree)); extern tree compute_array_index_type PARAMS ((tree, tree));
......
...@@ -8814,7 +8814,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, ...@@ -8814,7 +8814,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
{ {
/* Remove the `this' parm added by grokclassfn. /* Remove the `this' parm added by grokclassfn.
XXX Isn't this done in start_function, too? */ XXX Isn't this done in start_function, too? */
revert_static_member_fn (&decl, NULL, NULL); revert_static_member_fn (decl);
last_function_parms = TREE_CHAIN (last_function_parms); last_function_parms = TREE_CHAIN (last_function_parms);
} }
if (old_decl && DECL_ARTIFICIAL (old_decl)) if (old_decl && DECL_ARTIFICIAL (old_decl))
...@@ -12070,7 +12070,7 @@ grok_op_properties (decl, virtualp, friendp) ...@@ -12070,7 +12070,7 @@ grok_op_properties (decl, virtualp, friendp)
/* When the compiler encounters the definition of A::operator new, it /* When the compiler encounters the definition of A::operator new, it
doesn't look at the class declaration to find out if it's static. */ doesn't look at the class declaration to find out if it's static. */
if (methodp) if (methodp)
revert_static_member_fn (&decl, NULL, NULL); revert_static_member_fn (decl);
/* Take care of function decl if we had syntax errors. */ /* Take care of function decl if we had syntax errors. */
if (argtypes == NULL_TREE) if (argtypes == NULL_TREE)
...@@ -12085,7 +12085,7 @@ grok_op_properties (decl, virtualp, friendp) ...@@ -12085,7 +12085,7 @@ grok_op_properties (decl, virtualp, friendp)
|| name == ansi_opname[(int) VEC_DELETE_EXPR]) || name == ansi_opname[(int) VEC_DELETE_EXPR])
{ {
if (methodp) if (methodp)
revert_static_member_fn (&decl, NULL, NULL); revert_static_member_fn (decl);
if (argtypes == NULL_TREE) if (argtypes == NULL_TREE)
TREE_TYPE (decl) TREE_TYPE (decl)
...@@ -13204,7 +13204,7 @@ start_function (declspecs, declarator, attrs, flags) ...@@ -13204,7 +13204,7 @@ start_function (declspecs, declarator, attrs, flags)
if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1) if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1)
&& TREE_CODE (TREE_TYPE (decl1)) == METHOD_TYPE) && TREE_CODE (TREE_TYPE (decl1)) == METHOD_TYPE)
{ {
revert_static_member_fn (&decl1, NULL, NULL); revert_static_member_fn (decl1);
last_function_parms = TREE_CHAIN (last_function_parms); last_function_parms = TREE_CHAIN (last_function_parms);
ctype = NULL_TREE; ctype = NULL_TREE;
} }
...@@ -14560,20 +14560,16 @@ finish_stmt () ...@@ -14560,20 +14560,16 @@ finish_stmt ()
last_expr_type = NULL_TREE; last_expr_type = NULL_TREE;
} }
/* Change a static member function definition into a FUNCTION_TYPE, instead /* DECL was originally constructed as a non-static member function,
of the METHOD_TYPE that we create when it's originally parsed. but turned out to be static. Update it accordingly. */
WARNING: DO NOT pass &TREE_TYPE (decl) to FN or &TYPE_ARG_TYPES
(TREE_TYPE (decl)) to ARGTYPES, as doing so will corrupt the types of
other decls. Either pass the addresses of local variables or NULL. */
void void
revert_static_member_fn (decl, fn, argtypes) revert_static_member_fn (decl)
tree *decl, *fn, *argtypes; tree decl;
{ {
tree tmp; tree tmp;
tree function = fn ? *fn : TREE_TYPE (*decl); tree function = TREE_TYPE (decl);
tree args = argtypes ? *argtypes : TYPE_ARG_TYPES (function); tree args = TYPE_ARG_TYPES (function);
if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args))) if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args)))
!= TYPE_UNQUALIFIED) != TYPE_UNQUALIFIED)
...@@ -14585,14 +14581,10 @@ revert_static_member_fn (decl, fn, argtypes) ...@@ -14585,14 +14581,10 @@ revert_static_member_fn (decl, fn, argtypes)
tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function)); tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function));
tmp = build_exception_variant (tmp, tmp = build_exception_variant (tmp,
TYPE_RAISES_EXCEPTIONS (function)); TYPE_RAISES_EXCEPTIONS (function));
TREE_TYPE (*decl) = tmp; TREE_TYPE (decl) = tmp;
if (DECL_ARGUMENTS (*decl)) if (DECL_ARGUMENTS (decl))
DECL_ARGUMENTS (*decl) = TREE_CHAIN (DECL_ARGUMENTS (*decl)); DECL_ARGUMENTS (decl) = TREE_CHAIN (DECL_ARGUMENTS (decl));
DECL_STATIC_FUNCTION_P (*decl) = 1; DECL_STATIC_FUNCTION_P (decl) = 1;
if (fn)
*fn = tmp;
if (argtypes)
*argtypes = args;
} }
/* Initialize the variables used during compilation of a C++ /* Initialize the variables used during compilation of a C++
......
...@@ -1500,7 +1500,7 @@ check_explicit_specialization (declarator, decl, template_count, flags) ...@@ -1500,7 +1500,7 @@ check_explicit_specialization (declarator, decl, template_count, flags)
if (DECL_STATIC_FUNCTION_P (tmpl) if (DECL_STATIC_FUNCTION_P (tmpl)
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
{ {
revert_static_member_fn (&decl, 0, 0); revert_static_member_fn (decl);
last_function_parms = TREE_CHAIN (last_function_parms); last_function_parms = TREE_CHAIN (last_function_parms);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment