This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Patch for PR c++/39754

+	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));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]