summaryrefslogtreecommitdiff
path: root/gcc/cp/cp-lang.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-07 06:03:17 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-07 06:03:17 +0000
commit295e387a04a57eea2a4932d20328369452399388 (patch)
tree85a5a4cad3cfe432c546c4df2134dac37924265c /gcc/cp/cp-lang.c
parent6fcaa06776757d517ee0abf333c03d431e182bea (diff)
downloadgcc-295e387a04a57eea2a4932d20328369452399388.tar.gz
* tree.c (tree_size): For all 'c' and 'x' nodes, look directly
at the sizes of the relevant structures, rather than relying on TREE_CODE_LENGTH. Call lang_hooks.tree_size to get the sizes of any such we don't know about. Use lang_hooks.identifier_size for IDENTIFIER_NODE. (initializer_zerop): Use CONSTRUCTOR_ELTS. * tree.def: Update commentary. Make fourth element of the definition for all 'c' and 'x' nodes zero. * langhooks.h: New hook, tree_size / LANG_HOOKS_TREE_SIZE. * langhooks-def.h: Update to match. * langhooks.c: New default, lhd_tree_size. * c-common.def (SRCLOC): Kill. * c-pretty-print.c (pp_c_postfix_expression [case SRCLOC]): Remove entirely - was already #if-ed out. ada: * ada-tree.def: Make fourth element for GNAT_LOOP_ID zero. * misc.c (gnat_tree_size): New function. (LANG_HOOKS_TREE_SIZE): Override. cp: * cp-tree.def: Make fourth element for all 'c' and 'x' nodes zero. * cp-lang.c (cp_tree_size): New function. (LANG_HOOKS_TREE_SIZE): Override. * cp-tree.h (SOURCE_LOCUS, SRCLOC_FILE, SRCLOC_LINE, struct tree_srcloc, TS_CP_COMMON, TS_CP_SRCLOC): Kill. (union lang_tree_node): Remove common and srcloc members. (build_srcloc_here): Don't prototype. * decl.c (cp_tree_node_structure): Kill SRCLOC case. * pt.c (pending_templates): Correct comment. * tree.c (build_srcloc, build_srcloc_here): Kill. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65323 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cp-lang.c')
-rw-r--r--gcc/cp/cp-lang.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index b35c31c0763..0caa3360a77 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -34,10 +34,13 @@ static HOST_WIDE_INT cxx_get_alias_set (tree);
static bool ok_to_generate_alias_set_for_type (tree);
static bool cxx_warn_unused_global_decl (tree);
static tree cp_expr_size (tree);
+static size_t cp_tree_size (enum tree_code);
static bool cp_var_mod_type_p (tree);
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU C++"
+#undef LANG_HOOKS_TREE_SIZE
+#define LANG_HOOKS_TREE_SIZE cp_tree_size
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT cxx_init
#undef LANG_HOOKS_FINISH
@@ -318,6 +321,24 @@ cp_expr_size (tree exp)
return lhd_expr_size (exp);
}
+/* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */
+static size_t
+cp_tree_size (enum tree_code code)
+{
+ switch (code)
+ {
+ case PTRMEM_CST: return sizeof (struct ptrmem_cst);
+ case BASELINK: return sizeof (struct tree_baselink);
+ case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
+ case DEFAULT_ARG: return sizeof (struct tree_default_arg);
+ case OVERLOAD: return sizeof (struct tree_overload);
+ case WRAPPER: return sizeof (struct tree_wrapper);
+ default:
+ abort ();
+ }
+ /* NOTREACHED */
+}
+
/* Returns true if T is a variably modified type, in the sense of C99.
This routine needs only check cases that cannot be handled by the
language-independent logic in tree-inline.c. */