public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Kill IDENTIFIER_TEMPLATE
@ 2017-06-27 15:27 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2017-06-27 15:27 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

I discovered IDENTIFIER_TEMPLATE is never assigned to, and consequently 
never non-null.

Nuked after a successful bootstrap.

nathan
-- 
Nathan Sidwell

[-- Attachment #2: id-template.diff --]
[-- Type: text/x-patch, Size: 3853 bytes --]

2017-06-27  Nathan Sidwell  <nathan@acm.org>

	Kill IDENTIFIER_TEMPLATE.
	* cp-tree.h (lang_identifier): Remove class_template_info field.
	(IDENTIFIER_TEMPLATE): Delete.
	* name-lookup.c (constructor_name_full): Subsume into ...
	(constructor_name): ... here.  Don't check IDENTIFIER_TEMPLATE.
	(constructor_name_p): Likewise.
	* mangle.c (write_source_name): Likewise.
	* ptree.c (cxx_print_identifier): Likewise.

Index: cp-tree.h
===================================================================
--- cp-tree.h	(revision 249657)
+++ cp-tree.h	(working copy)
@@ -527,7 +527,6 @@ extern GTY(()) tree cp_global_trees[CPTI
 struct GTY(()) lang_identifier {
   struct c_common_identifier c_common;
   cxx_binding *bindings;
-  tree class_template_info;
   tree label_value;
 };
 
@@ -954,9 +953,6 @@ enum GTY(()) abstract_class_use {
 
 /* Macros for access to language-specific slots in an identifier.  */
 
-#define IDENTIFIER_TEMPLATE(NODE)	\
-  (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
-
 /* The IDENTIFIER_BINDING is the innermost cxx_binding for the
     identifier.  Its PREVIOUS is the next outermost binding.  Each
     VALUE field is a DECL for the associated declaration.  Thus,
Index: mangle.c
===================================================================
--- mangle.c	(revision 249654)
+++ mangle.c	(working copy)
@@ -1460,11 +1460,6 @@ write_source_name (tree identifier)
 {
   MANGLE_TRACE_TREE ("source-name", identifier);
 
-  /* Never write the whole template-id name including the template
-     arguments; we only want the template name.  */
-  if (IDENTIFIER_TEMPLATE (identifier))
-    identifier = IDENTIFIER_TEMPLATE (identifier);
-
   write_unsigned_number (IDENTIFIER_LENGTH (identifier));
   write_identifier (IDENTIFIER_POINTER (identifier));
 }
Index: name-lookup.c
===================================================================
--- name-lookup.c	(revision 249654)
+++ name-lookup.c	(working copy)
@@ -3183,27 +3183,12 @@ set_identifier_type_value (tree id, tree
 }
 
 /* Return the name for the constructor (or destructor) for the
-   specified class TYPE.  When given a template, this routine doesn't
-   lose the specialization.  */
-
-static inline tree
-constructor_name_full (tree type)
-{
-  return TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (type));
-}
-
-/* Return the name for the constructor (or destructor) for the
-   specified class.  When given a template, return the plain
-   unspecialized name.  */
+   specified class.  */
 
 tree
 constructor_name (tree type)
 {
-  tree name;
-  name = constructor_name_full (type);
-  if (IDENTIFIER_TEMPLATE (name))
-    name = IDENTIFIER_TEMPLATE (name);
-  return name;
+  return TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (type));
 }
 
 /* Returns TRUE if NAME is the name for the constructor for TYPE,
@@ -3212,8 +3197,6 @@ constructor_name (tree type)
 bool
 constructor_name_p (tree name, tree type)
 {
-  tree ctor_name;
-
   gcc_assert (MAYBE_CLASS_TYPE_P (type));
 
   if (!name)
@@ -3227,12 +3210,10 @@ constructor_name_p (tree name, tree type
       || TREE_CODE (type) == TYPEOF_TYPE)
     return false;
 
-  ctor_name = constructor_name_full (type);
+  tree ctor_name = constructor_name (type);
   if (name == ctor_name)
     return true;
-  if (IDENTIFIER_TEMPLATE (ctor_name)
-      && name == IDENTIFIER_TEMPLATE (ctor_name))
-    return true;
+
   return false;
 }
 
Index: ptree.c
===================================================================
--- ptree.c	(revision 249654)
+++ ptree.c	(working copy)
@@ -181,7 +181,6 @@ cxx_print_identifier (FILE *file, tree n
   fprintf (file, "%s local bindings <%p>", get_identifier_kind_name (node),
 	   (void *) IDENTIFIER_BINDING (node));
   print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
-  print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);
 }
 
 void

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-27 15:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 15:27 [C++ PATCH] Kill IDENTIFIER_TEMPLATE Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).