From 1f81b32145ae52bda71b76a2fd9f6827e0b7ffea Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 17 Aug 2017 18:57:03 +0000 Subject: [PATCH] cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment. * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment. * cp-tree.h (ENUM_TEMPLATE_INFO): Delete. (TYPE_TEMPLATE_INFO): Simplify. (SET_TYPE_TEMPLATE_INFO): Simplify. From-SVN: r251159 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/cp-tree.def | 3 +-- gcc/cp/cp-tree.h | 33 +++++++++++---------------------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 46be937f6fa..3b261d926c7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2017-08-17 Nathan Sidwell + * cp-tree.def (TEMPLATE_TEMPLATE_PARM): Remove stale comment. + * cp-tree.h (ENUM_TEMPLATE_INFO): Delete. + (TYPE_TEMPLATE_INFO): Simplify. + (SET_TYPE_TEMPLATE_INFO): Simplify. + * lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs don't need lang_type. (cxx_make_type): Use maybe_add_lang_type_raw return value. diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index 356d0305a7f..a46f9c33cb4 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -163,8 +163,7 @@ DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", tcc_exceptional, 0) TEMPLATE_PARM_INDEX. It is used without template arguments like TT in C, - TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO is NULL_TREE - and TYPE_NAME is a TEMPLATE_DECL. */ + TYPE_NAME is a TEMPLATE_DECL. */ DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", tcc_type, 0) /* The ordering of the following codes is optimized for the checking diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f6b0b9214a6..4dd9fc6628f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -473,10 +473,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; TYPE_LANG_SLOT_1 For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS. For a POINTER_TYPE (to a METHOD_TYPE), this is TYPE_PTRMEMFUNC_TYPE. - For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. - For a RECORD_TYPE or UNION_TYPE this is CLASSTYPE_TEMPLATE_INFO, - For a BOUND_TEMPLATE_TEMPLATE_PARM_TYPE this is also - TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. + For an ENUMERAL_TYPE, BOUND_TEMPLATE_TEMPLATE_PARM_TYPE, + RECORD_TYPE or UNION_TYPE this is TYPE_TEMPLATE_INFO, BINFO_VIRTUALS For a binfo, this is a TREE_LIST. There is an entry for each @@ -3280,28 +3278,20 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define CLASSTYPE_TEMPLATE_INFO(NODE) \ (TYPE_LANG_SLOT_1 (RECORD_OR_UNION_CHECK (NODE))) -/* Template information for an ENUMERAL_TYPE. Although an enumeration may - not be a primary template, it may be declared within the scope of a - primary template and the enumeration constants may depend on - non-type template parameters. */ -#define ENUM_TEMPLATE_INFO(NODE) \ - (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE))) - /* Template information for a template template parameter. */ #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \ (TYPE_LANG_SLOT_1 (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE))) /* Template information for an ENUMERAL_, RECORD_, UNION_TYPE, or BOUND_TEMPLATE_TEMPLATE_PARM type. This ignores any alias - templateness of NODE. */ + templateness of NODE. It'd be nice if this could unconditionally + access the slot, rather than return NULL if given a + non-templatable type. */ #define TYPE_TEMPLATE_INFO(NODE) \ (TREE_CODE (NODE) == ENUMERAL_TYPE \ - ? ENUM_TEMPLATE_INFO (NODE) \ - : (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ - ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \ - : (CLASS_TYPE_P (NODE) \ - ? CLASSTYPE_TEMPLATE_INFO (NODE) \ - : NULL_TREE))) + || TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ + || RECORD_OR_UNION_TYPE_P (NODE) \ + ? TYPE_LANG_SLOT_1 (NODE) : NULL_TREE) /* Template information (if any) for an alias type. */ #define TYPE_ALIAS_TEMPLATE_INFO(NODE) \ @@ -3321,10 +3311,9 @@ extern void decl_shadowed_for_var_insert (tree, tree); UNION_TYPE to VAL. */ #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \ (TREE_CODE (NODE) == ENUMERAL_TYPE \ - ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \ - : ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \ - ? (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)) \ - : (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL)))) + || (CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \ + ? (TYPE_LANG_SLOT_1 (NODE) = (VAL)) \ + : (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL))) #define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE)) #define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE)) -- 2.30.2