Commit f94ae2f5 by Jason Merrill Committed by Jason Merrill

tree.c (member_p): New fn.

	* tree.c (member_p): New fn.
	* decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for
	initializing class members.
	* cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'.
	* ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX.

From-SVN: r18909
parent 7bae46f4
Mon Mar 30 08:55:42 1998 Jason Merrill <jason@yorick.cygnus.com> Mon Mar 30 08:55:42 1998 Jason Merrill <jason@yorick.cygnus.com>
* tree.c (member_p): New fn.
* decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for
initializing class members.
* cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'.
* ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX.
* call.c (build_method_call): Handle non-scoped destructors, too. * call.c (build_method_call): Handle non-scoped destructors, too.
* pt.c (tsubst_copy): Likewise. * pt.c (tsubst_copy): Likewise.
......
...@@ -120,7 +120,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0) ...@@ -120,7 +120,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
The LEVEL is the level of the parameter when we are worrying about 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 the types of things; the ORIG_LEVEL is the level when we are
worrying about instantiating things. */ worrying about instantiating things. */
DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'c', DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x',
/* The addition of (sizeof(char*) - 1) in the next /* The addition of (sizeof(char*) - 1) in the next
expression is to ensure against the case where expression is to ensure against the case where
sizeof(char*) does not evenly divide sizeof(char*) does not evenly divide
......
...@@ -3007,8 +3007,12 @@ finish_file () ...@@ -3007,8 +3007,12 @@ finish_file ()
/* 9.5p5: The initializer of a static member of a class has /* 9.5p5: The initializer of a static member of a class has
the same access rights as a member function. */ the same access rights as a member function. */
DECL_CLASS_CONTEXT (current_function_decl) = DECL_CONTEXT (decl); if (member_p (decl))
DECL_STATIC_FUNCTION_P (current_function_decl) = 1; {
DECL_CLASS_CONTEXT (current_function_decl)
= DECL_CONTEXT (decl);
DECL_STATIC_FUNCTION_P (current_function_decl) = 1;
}
if (protect) if (protect)
{ {
......
...@@ -175,6 +175,12 @@ lang_print_xnode (file, node, indent) ...@@ -175,6 +175,12 @@ lang_print_xnode (file, node, indent)
print_node (file, "value", BINDING_VALUE (node), indent+4); print_node (file, "value", BINDING_VALUE (node), indent+4);
print_node (file, "chain", TREE_CHAIN (node), indent+4); print_node (file, "chain", TREE_CHAIN (node), indent+4);
break; break;
case TEMPLATE_PARM_INDEX:
indent_to (file, indent + 3);
fprintf (file, "index %d level %d orig_level %d",
TEMPLATE_PARM_IDX (node), TEMPLATE_PARM_LEVEL (node),
TEMPLATE_PARM_ORIG_LEVEL (node));
break;
default: default:
break; break;
} }
......
...@@ -2183,3 +2183,13 @@ varargs_function_p (function) ...@@ -2183,3 +2183,13 @@ varargs_function_p (function)
return 0; return 0;
return 1; return 1;
} }
/* Returns 1 if decl is a member of a class. */
int
member_p (decl)
tree decl;
{
tree ctx = DECL_CONTEXT (decl);
return (ctx && TREE_CODE_CLASS (TREE_CODE (ctx)) == 't');
}
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