diff mbox

[C++] remove unnecessary hidden pruning

Message ID 0f558d8b-6884-e3c6-749f-fc1235db43ea@acm.org
State New
Headers show

Commit Message

Nathan Sidwell May 10, 2017, 8:42 p.m. UTC
Name lookup as it currently is already removes hidden names for regular 
lookup (sometimes more than once!).   It also strips anticipated builtins.

So there's no need to do it again when building a function call.

Applied to trunk.

nathan
diff mbox

Patch

2017-05-10  Nathan Sidwell  <nathan@acm.org>

	* cp-tree.h (build_new_function_call): Lose koenig_p arg.  Fix
	line breaking.
	* call.c (build_new_function_call): Lose koenig_p arg.  Remove
	koenig_p handling here.
	* pt.c (push_template_decl_real): Unconditionally retrofit_lang_decl.
	(tsubst_omp_clauses): Likewise.
	(do_class_deduction): Adjust buld_new_function_call calls.
	* semantics.c (finish_call_expr): Likewise.

Index: call.c
===================================================================
--- call.c	(revision 247851)
+++ call.c	(working copy)
@@ -4192,7 +4192,7 @@  print_error_for_call_failure (tree fn, v
    ARGS.  */
 
 tree
-build_new_function_call (tree fn, vec<tree, va_gc> **args, bool koenig_p, 
+build_new_function_call (tree fn, vec<tree, va_gc> **args,
 			 tsubst_flags_t complain)
 {
   struct z_candidate *candidates, *cand;
@@ -4210,22 +4210,6 @@  build_new_function_call (tree fn, vec<tr
   if (flag_tm)
     tm_malloc_replacement (fn);
 
-  /* If this function was found without using argument dependent
-     lookup, then we want to ignore any undeclared friend
-     functions.  */
-  if (!koenig_p)
-    {
-      tree orig_fn = fn;
-
-      fn = remove_hidden_names (fn);
-      if (!fn)
-	{
-	  if (complain & tf_error)
-	    print_error_for_call_failure (orig_fn, *args, NULL);
-	  return error_mark_node;
-	}
-    }
-
   /* Get the high-water mark for the CONVERSION_OBSTACK.  */
   p = conversion_obstack_alloc (0);
 
Index: cp-tree.h
===================================================================
--- cp-tree.h	(revision 247851)
+++ cp-tree.h	(working copy)
@@ -5649,15 +5649,16 @@  extern tree type_decays_to			(tree);
 extern tree extract_call_expr			(tree);
 extern tree build_user_type_conversion		(tree, tree, int,
 						 tsubst_flags_t);
-extern tree build_new_function_call		(tree, vec<tree, va_gc> **, bool, 
+extern tree build_new_function_call		(tree, vec<tree, va_gc> **,
 						 tsubst_flags_t);
-extern tree build_operator_new_call		(tree, vec<tree, va_gc> **, tree *,
-						 tree *, tree, tree, tree *,
-						 tsubst_flags_t);
-extern tree build_new_method_call		(tree, tree, vec<tree, va_gc> **,
-						 tree, int, tree *,
-						 tsubst_flags_t);
-extern tree build_special_member_call		(tree, tree, vec<tree, va_gc> **,
+extern tree build_operator_new_call		(tree, vec<tree, va_gc> **,
+						 tree *, tree *, tree, tree,
+						 tree *, tsubst_flags_t);
+extern tree build_new_method_call		(tree, tree,
+						 vec<tree, va_gc> **, tree,
+						 int, tree *, tsubst_flags_t);
+extern tree build_special_member_call		(tree, tree,
+						 vec<tree, va_gc> **,
 						 tree, int, tsubst_flags_t);
 extern tree build_new_op			(location_t, enum tree_code,
 						 int, tree, tree, tree, tree *,
@@ -5665,7 +5666,7 @@  extern tree build_new_op			(location_t,
 extern tree build_op_call			(tree, vec<tree, va_gc> **,
 						 tsubst_flags_t);
 extern bool aligned_allocation_fn_p		(tree);
-extern bool usual_deallocation_fn_p	(tree);
+extern bool usual_deallocation_fn_p		(tree);
 extern tree build_op_delete_call		(enum tree_code, tree, tree,
 						 bool, tree, tree,
 						 tsubst_flags_t);
Index: pt.c
===================================================================
--- pt.c	(revision 247851)
+++ pt.c	(working copy)
@@ -5570,7 +5570,7 @@  template arguments to %qD do not match o
     SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
   else
     {
-      if (is_primary && !DECL_LANG_SPECIFIC (decl))
+      if (is_primary)
 	retrofit_lang_decl (decl);
       if (DECL_LANG_SPECIFIC (decl))
 	DECL_TEMPLATE_INFO (decl) = info;
@@ -15250,8 +15250,7 @@  tsubst_omp_clauses (tree clauses, enum c
 		tree decl = OMP_CLAUSE_DECL (nc);
 		if (VAR_P (decl))
 		  {
-		    if (!DECL_LANG_SPECIFIC (decl))
-		      retrofit_lang_decl (decl);
+		    retrofit_lang_decl (decl);
 		    DECL_OMP_PRIVATIZED_MEMBER (decl) = 1;
 		  }
 	      }
@@ -25238,14 +25237,12 @@  do_class_deduction (tree ptype, tree tmp
     }
 
   ++cp_unevaluated_operand;
-  tree t = build_new_function_call (cands, &args, /*koenig*/false,
-				    tf_decltype);
+  tree t = build_new_function_call (cands, &args, tf_decltype);
 
   if (t == error_mark_node && (complain & tf_warning_or_error))
     {
       error ("class template argument deduction failed:");
-      t = build_new_function_call (cands, &args, /*koenig*/false,
-				   complain | tf_decltype);
+      t = build_new_function_call (cands, &args, complain | tf_decltype);
       if (old_cands != cands)
 	inform (input_location, "explicit deduction guides not considered "
 		"for copy-initialization");
Index: semantics.c
===================================================================
--- semantics.c	(revision 247851)
+++ semantics.c	(working copy)
@@ -2438,7 +2438,7 @@  finish_call_expr (tree fn, vec<tree, va_
 	    }
 
 	  /* A call to a namespace-scope function.  */
-	  result = build_new_function_call (fn, args, koenig_p, complain);
+	  result = build_new_function_call (fn, args, complain);
 	}
     }
   else if (TREE_CODE (fn) == PSEUDO_DTOR_EXPR)