This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA] Patch for PR c++/39754
- From: Jason Merrill <jason at redhat dot com>
- To: Dodji Seketeli <dodji at redhat dot com>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 26 May 2009 18:22:37 -0400
- Subject: Re: [RFA] Patch for PR c++/39754
- References: <20090526171846.45719704@tutu>
+ for (arg_node = TYPE_ARG_TYPES (t);
+ arg_node;
+ arg_node = TREE_CHAIN (arg_node))
+ {
+ if (arg_node == void_list_node)
+ {
+ arg_types = chainon (arg_types, arg_node);
+ break;
+ }
+ arg_type = strip_typedefs (TREE_VALUE (arg_node));
+ gcc_assert (arg_type);
+ arg_types = chainon (arg_types,
+ build_tree_list (TREE_PURPOSE (arg_node),
+ arg_type));
+ }
It's customary to build up the list and then nreverse it rather than use
chainon in the loop, which means traversing the whole list each time you
add another node.
+ if (!result)
+ result = cp_build_qualified_type (TYPE_MAIN_VARIANT (t),
+ cp_type_quals (t));
+ else if ((type_quals = cp_type_quals (t)) != TYPE_UNQUALIFIED)
+ result = cp_build_qualified_type (result, type_quals);
+
+ return result;
This logic could be simplified to
if (!result)
result = TYPE_MAIN_VARIANT (t);
return cp_build_qualified_type (result, cp_type_quals (t));
Jason