diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-03-30 10:56:25 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-03-30 05:56:25 -0500 |
commit | f94ae2f5c0d797557bd800a5e313b0083310834a (patch) | |
tree | b08d530f6d88dec32d59a69c6659e7844957685c /gcc/cp | |
parent | 7bae46f4b2043eea685ca1a5e153c60f2ad34447 (diff) | |
download | gcc-f94ae2f5c0d797557bd800a5e313b0083310834a.zip gcc-f94ae2f5c0d797557bd800a5e313b0083310834a.tar.gz gcc-f94ae2f5c0d797557bd800a5e313b0083310834a.tar.bz2 |
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
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-tree.def | 2 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 8 | ||||
-rw-r--r-- | gcc/cp/ptree.c | 6 | ||||
-rw-r--r-- | gcc/cp/tree.c | 10 |
5 files changed, 30 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d2f5665..f7d586f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ 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. * pt.c (tsubst_copy): Likewise. diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index 98217c3..5ee7500 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -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 types of things; the ORIG_LEVEL is the level when we are 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 expression is to ensure against the case where sizeof(char*) does not evenly divide diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 82fd16a..e65d855 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3007,8 +3007,12 @@ finish_file () /* 9.5p5: The initializer of a static member of a class has the same access rights as a member function. */ - DECL_CLASS_CONTEXT (current_function_decl) = DECL_CONTEXT (decl); - DECL_STATIC_FUNCTION_P (current_function_decl) = 1; + if (member_p (decl)) + { + DECL_CLASS_CONTEXT (current_function_decl) + = DECL_CONTEXT (decl); + DECL_STATIC_FUNCTION_P (current_function_decl) = 1; + } if (protect) { diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index 6ad4d39..fa74997 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -175,6 +175,12 @@ lang_print_xnode (file, node, indent) print_node (file, "value", BINDING_VALUE (node), indent+4); print_node (file, "chain", TREE_CHAIN (node), indent+4); 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: break; } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index d23a3cd..52a148a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2183,3 +2183,13 @@ varargs_function_p (function) return 0; 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'); +} |