From 776ff3efa9de7fce8b117b9f6388f317d447cb92 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 17 Aug 2017 15:56:49 +0000 Subject: [PATCH] lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs don't need lang_type. * 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. * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on TYPE_LANG_SPECIFIC. From-SVN: r251154 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/lex.c | 11 ++++------- gcc/cp/mangle.c | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2ab058dfe01..46be937f6fa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2017-08-17 Nathan Sidwell + * 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. + * mangle.c (CLASSTYPE_TEMPLATE_ID_P): Don't rely on + TYPE_LANG_SPECIFIC. + * cp-tree.h (struct lang_type): Remove template_info field. (CLASSTYPE_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 097fbb547d2..b22d28742bb 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -809,8 +809,7 @@ copy_type (tree type MEM_STAT_DECL) static bool maybe_add_lang_type_raw (tree t) { - if (!(RECORD_OR_UNION_CODE_P (TREE_CODE (t)) - || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)) + if (!RECORD_OR_UNION_CODE_P (TREE_CODE (t))) return false; TYPE_LANG_SPECIFIC (t) @@ -831,12 +830,10 @@ cxx_make_type (enum tree_code code) { tree t = make_node (code); - maybe_add_lang_type_raw (t); - - /* Set up some flags that give proper default behavior. */ - if (RECORD_OR_UNION_CODE_P (code)) + if (maybe_add_lang_type_raw (t)) { - struct c_fileinfo *finfo = \ + /* Set up some flags that give proper default behavior. */ + struct c_fileinfo *finfo = get_fileinfo (LOCATION_FILE (input_location)); SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown); CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only; diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 8bb26a9902b..a87f97fdf9f 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -81,10 +81,10 @@ along with GCC; see the file COPYING3. If not see instantiated outside of the template, and A is the type used without parameters inside the template. */ #define CLASSTYPE_TEMPLATE_ID_P(NODE) \ - (TYPE_LANG_SPECIFIC (NODE) != NULL \ - && (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ - || (CLASSTYPE_TEMPLATE_INFO (NODE) != NULL \ - && (PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))))) + (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ + || (CLASS_TYPE_P (NODE) \ + && CLASSTYPE_TEMPLATE_INFO (NODE) != NULL \ + && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))) /* For deciding whether to set G.need_abi_warning, we need to consider both warn_abi_version and flag_abi_compat_version. */ -- 2.30.2