This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Code cleanup in pt.c (instantiate_class_template)
- From: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Nov 2005 13:52:43 +0100 (CET)
- Subject: [patch] Code cleanup in pt.c (instantiate_class_template)
The following patch cleans up instantiate_class_template from pt.c
a little: It removes the superfluous temporary "tag" and moves
the definition of the tree "name" into the branch of the if-statement
where it is actually used.
Bootstrapped and regtested on i686-pc-linux-gnu.
Ok for mainline?
Regards,
Volker
2005-08-25 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* pt.c (instantiate_class_template): Clean-up.
===================================================================
--- gcc/gcc/cp/pt.c 23 Aug 2005 12:35:26 -0000 1.1025
+++ gcc/gcc/cp/pt.c 25 Aug 2005 15:38:56 -0000
@@ -5615,14 +5615,12 @@ instantiate_class_template (tree type)
{
/* Build new CLASSTYPE_NESTED_UTDS. */
- tree tag = t;
- tree name = TYPE_IDENTIFIER (tag);
tree newtag;
bool class_template_p;
- class_template_p = (TREE_CODE (tag) != ENUMERAL_TYPE
- && TYPE_LANG_SPECIFIC (tag)
- && CLASSTYPE_IS_TEMPLATE (tag));
+ class_template_p = (TREE_CODE (t) != ENUMERAL_TYPE
+ && TYPE_LANG_SPECIFIC (t)
+ && CLASSTYPE_IS_TEMPLATE (t));
/* If the member is a class template, then -- even after
substitution -- there may be dependent types in the
template argument list for the class. We increment
@@ -5631,7 +5629,7 @@ instantiate_class_template (tree type)
when outside of a template. */
if (class_template_p)
++processing_template_decl;
- newtag = tsubst (tag, args, tf_error, NULL_TREE);
+ newtag = tsubst (t, args, tf_error, NULL_TREE);
if (class_template_p)
--processing_template_decl;
if (newtag == error_mark_node)
@@ -5639,6 +5637,8 @@ instantiate_class_template (tree type)
if (TREE_CODE (newtag) != ENUMERAL_TYPE)
{
+ tree name = TYPE_IDENTIFIER (t);
+
if (class_template_p)
/* Unfortunately, lookup_template_class sets
CLASSTYPE_IMPLICIT_INSTANTIATION for a partial
===================================================================