lex.c (maybe_add_lang_type_raw): BOUND_TEMPLATE_TEMPLATE_PARMs don't need lang_type.
authorNathan Sidwell <nathan@acm.org>
Thu, 17 Aug 2017 15:56:49 +0000 (15:56 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 17 Aug 2017 15:56:49 +0000 (15:56 +0000)
* 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
gcc/cp/lex.c
gcc/cp/mangle.c

index 2ab058d..46be937 100644 (file)
@@ -1,5 +1,11 @@
 2017-08-17  Nathan Sidwell  <nathan@acm.org>
 
+       * 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.
index 097fbb5..b22d287 100644 (file)
@@ -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;
index 8bb26a9..a87f97f 100644 (file)
@@ -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.  */