Commit d48b9bbe by Nathan Sidwell Committed by Nathan Sidwell

cp-tree.h (cp_free_lang_data): Add extern.

	* cp-tree.h (cp_free_lang_data): Add extern.
	(ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
	ATTRIBUTE_PURE.
	(type_unknown_p): Return bool, make inline, lose TREE_LIST check.
	* typeck.c (type_unknown_p): Delete.
	* tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
	overload management.
	(dependent_name): Likewise.
	(decl_anon_ns_mem_p): Simplify.

From-SVN: r248433
parent d4a760d8
2017-05-24 Nathan Sidwell <nathan@acm.org>
* cp-tree.h (cp_free_lang_data): Add extern.
(ovl_skip_hidden, is_overloaded_fn, really_overloaded_fn): Add
ATTRIBUTE_PURE.
(type_unknown_p): Return bool, make inline, lose TREE_LIST check.
* typeck.c (type_unknown_p): Delete.
* tree.c (is_overloaded_fn): Use MAYBE_BASELINE_FUNCTIONS, adjust
overload management.
(dependent_name): Likewise.
(decl_anon_ns_mem_p): Simplify.
2017-05-24 Jonathan Wakely <jwakely@redhat.com> 2017-05-24 Jonathan Wakely <jwakely@redhat.com>
PR c++/80544 PR c++/80544
......
...@@ -6789,7 +6789,7 @@ extern tree finish_builtin_launder (location_t, tree, ...@@ -6789,7 +6789,7 @@ extern tree finish_builtin_launder (location_t, tree,
/* in tree.c */ /* in tree.c */
extern int cp_tree_operand_length (const_tree); extern int cp_tree_operand_length (const_tree);
extern int cp_tree_code_length (enum tree_code); extern int cp_tree_code_length (enum tree_code);
void cp_free_lang_data (tree t); extern void cp_free_lang_data (tree t);
extern tree force_target_expr (tree, tree, tsubst_flags_t); extern tree force_target_expr (tree, tree, tsubst_flags_t);
extern tree build_target_expr_with_type (tree, tree, tsubst_flags_t); extern tree build_target_expr_with_type (tree, tree, tsubst_flags_t);
extern void lang_check_failed (const char *, int, extern void lang_check_failed (const char *, int,
...@@ -6811,7 +6811,8 @@ extern bool type_has_nontrivial_copy_init (const_tree); ...@@ -6811,7 +6811,8 @@ extern bool type_has_nontrivial_copy_init (const_tree);
extern void maybe_warn_parm_abi (tree, location_t); extern void maybe_warn_parm_abi (tree, location_t);
extern bool class_tmpl_impl_spec_p (const_tree); extern bool class_tmpl_impl_spec_p (const_tree);
extern int zero_init_p (const_tree); extern int zero_init_p (const_tree);
extern bool check_abi_tag_redeclaration (const_tree, const_tree, const_tree); extern bool check_abi_tag_redeclaration (const_tree, const_tree,
const_tree);
extern bool check_abi_tag_args (tree, tree); extern bool check_abi_tag_args (tree, tree);
extern tree strip_typedefs (tree, bool * = NULL); extern tree strip_typedefs (tree, bool * = NULL);
extern tree strip_typedefs_expr (tree, bool * = NULL); extern tree strip_typedefs_expr (tree, bool * = NULL);
...@@ -6852,10 +6853,11 @@ extern tree ovl_make (tree fn, ...@@ -6852,10 +6853,11 @@ extern tree ovl_make (tree fn,
tree next = NULL_TREE); tree next = NULL_TREE);
extern tree ovl_insert (tree fn, tree maybe_ovl, extern tree ovl_insert (tree fn, tree maybe_ovl,
bool using_p = false); bool using_p = false);
extern tree ovl_skip_hidden (tree); extern tree ovl_skip_hidden (tree) ATTRIBUTE_PURE;
extern tree lookup_add (tree fns, tree lookup); extern tree lookup_add (tree fns, tree lookup);
extern void lookup_keep (tree lookup, bool keep); extern void lookup_keep (tree lookup, bool keep);
extern int is_overloaded_fn (tree); extern int is_overloaded_fn (tree) ATTRIBUTE_PURE;
extern bool really_overloaded_fn (tree) ATTRIBUTE_PURE;
extern tree dependent_name (tree); extern tree dependent_name (tree);
extern tree get_fns (tree) ATTRIBUTE_PURE; extern tree get_fns (tree) ATTRIBUTE_PURE;
extern tree get_first_fn (tree) ATTRIBUTE_PURE; extern tree get_first_fn (tree) ATTRIBUTE_PURE;
...@@ -6876,7 +6878,6 @@ extern bool decl_anon_ns_mem_p (const_tree); ...@@ -6876,7 +6878,6 @@ extern bool decl_anon_ns_mem_p (const_tree);
extern tree lvalue_type (tree); extern tree lvalue_type (tree);
extern tree error_type (tree); extern tree error_type (tree);
extern int varargs_function_p (const_tree); extern int varargs_function_p (const_tree);
extern bool really_overloaded_fn (tree);
extern bool cp_tree_equal (tree, tree); extern bool cp_tree_equal (tree, tree);
extern tree no_linkage_check (tree, bool); extern tree no_linkage_check (tree, bool);
extern void debug_binfo (tree); extern void debug_binfo (tree);
...@@ -6933,7 +6934,7 @@ extern tree require_complete_type_sfinae (tree, tsubst_flags_t); ...@@ -6933,7 +6934,7 @@ extern tree require_complete_type_sfinae (tree, tsubst_flags_t);
extern tree complete_type (tree); extern tree complete_type (tree);
extern tree complete_type_or_else (tree, tree); extern tree complete_type_or_else (tree, tree);
extern tree complete_type_or_maybe_complain (tree, tree, tsubst_flags_t); extern tree complete_type_or_maybe_complain (tree, tree, tsubst_flags_t);
extern int type_unknown_p (const_tree); inline bool type_unknown_p (const_tree);
enum { ce_derived, ce_type, ce_normal, ce_exact }; enum { ce_derived, ce_type, ce_normal, ce_exact };
extern bool comp_except_specs (const_tree, const_tree, int); extern bool comp_except_specs (const_tree, const_tree, int);
extern bool comptypes (tree, tree, int); extern bool comptypes (tree, tree, int);
...@@ -7311,6 +7312,12 @@ ovl_first (tree node) ...@@ -7311,6 +7312,12 @@ ovl_first (tree node)
return node; return node;
} }
inline bool
type_unknown_p (const_tree expr)
{
return TREE_TYPE (expr) == unknown_type_node;
}
/* -- end of C++ */ /* -- end of C++ */
#endif /* ! GCC_CP_TREE_H */ #endif /* ! GCC_CP_TREE_H */
...@@ -2337,15 +2337,16 @@ is_overloaded_fn (tree x) ...@@ -2337,15 +2337,16 @@ is_overloaded_fn (tree x)
if (TREE_CODE (x) == OFFSET_REF if (TREE_CODE (x) == OFFSET_REF
|| TREE_CODE (x) == COMPONENT_REF) || TREE_CODE (x) == COMPONENT_REF)
x = TREE_OPERAND (x, 1); x = TREE_OPERAND (x, 1);
if (BASELINK_P (x)) x = MAYBE_BASELINK_FUNCTIONS (x);
x = BASELINK_FUNCTIONS (x);
if (TREE_CODE (x) == TEMPLATE_ID_EXPR) if (TREE_CODE (x) == TEMPLATE_ID_EXPR)
x = TREE_OPERAND (x, 0); x = TREE_OPERAND (x, 0);
if (DECL_FUNCTION_TEMPLATE_P (OVL_CURRENT (x))
|| (TREE_CODE (x) == OVERLOAD && OVL_CHAIN (x))) if (DECL_FUNCTION_TEMPLATE_P (OVL_FIRST (x))
|| (TREE_CODE (x) == OVERLOAD && !OVL_SINGLE_P (x)))
return 2; return 2;
return (TREE_CODE (x) == FUNCTION_DECL
|| TREE_CODE (x) == OVERLOAD); return (TREE_CODE (x) == FUNCTION_DECL
|| TREE_CODE (x) == OVERLOAD);
} }
/* X is the CALL_EXPR_FN of a CALL_EXPR. If X represents a dependent name /* X is the CALL_EXPR_FN of a CALL_EXPR. If X represents a dependent name
...@@ -2357,11 +2358,10 @@ dependent_name (tree x) ...@@ -2357,11 +2358,10 @@ dependent_name (tree x)
{ {
if (identifier_p (x)) if (identifier_p (x))
return x; return x;
if (TREE_CODE (x) != COMPONENT_REF if (TREE_CODE (x) == TEMPLATE_ID_EXPR)
&& TREE_CODE (x) != OFFSET_REF x = TREE_OPERAND (x, 0);
&& TREE_CODE (x) != BASELINK if (TREE_CODE (x) == OVERLOAD || TREE_CODE (x) == FUNCTION_DECL)
&& is_overloaded_fn (x)) return OVL_NAME (x);
return DECL_NAME (get_first_fn (x));
return NULL_TREE; return NULL_TREE;
} }
...@@ -3319,22 +3319,15 @@ decl_namespace_context (tree decl) ...@@ -3319,22 +3319,15 @@ decl_namespace_context (tree decl)
bool bool
decl_anon_ns_mem_p (const_tree decl) decl_anon_ns_mem_p (const_tree decl)
{ {
while (1) while (TREE_CODE (decl) != NAMESPACE_DECL)
{ {
if (decl == NULL_TREE || decl == error_mark_node) /* Classes inside anonymous namespaces have TREE_PUBLIC == 0. */
return false; if (TYPE_P (decl))
if (TREE_CODE (decl) == NAMESPACE_DECL return !TREE_PUBLIC (TYPE_MAIN_DECL (decl));
&& DECL_NAME (decl) == NULL_TREE)
return true; decl = CP_DECL_CONTEXT (decl);
/* Classes and namespaces inside anonymous namespaces have
TREE_PUBLIC == 0, so we can shortcut the search. */
else if (TYPE_P (decl))
return (TREE_PUBLIC (TYPE_MAIN_DECL (decl)) == 0);
else if (TREE_CODE (decl) == NAMESPACE_DECL)
return (TREE_PUBLIC (decl) == 0);
else
decl = DECL_CONTEXT (decl);
} }
return !TREE_PUBLIC (decl);
} }
/* Subroutine of cp_tree_equal: t1 and t2 are the CALL_EXPR_FNs of two /* Subroutine of cp_tree_equal: t1 and t2 are the CALL_EXPR_FNs of two
......
...@@ -162,15 +162,6 @@ complete_type_or_else (tree type, tree value) ...@@ -162,15 +162,6 @@ complete_type_or_else (tree type, tree value)
return complete_type_or_maybe_complain (type, value, tf_warning_or_error); return complete_type_or_maybe_complain (type, value, tf_warning_or_error);
} }
/* Return truthvalue of whether type of EXP is instantiated. */
int
type_unknown_p (const_tree exp)
{
return (TREE_CODE (exp) == TREE_LIST
|| TREE_TYPE (exp) == unknown_type_node);
}
/* Return the common type of two parameter lists. /* Return the common type of two parameter lists.
We assume that comptypes has already been done and returned 1; We assume that comptypes has already been done and returned 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment