* 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
+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>
PR c++/80544
/* in tree.c */
extern int cp_tree_operand_length (const_tree);
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 build_target_expr_with_type (tree, tree, tsubst_flags_t);
extern void lang_check_failed (const char *, int,
extern void maybe_warn_parm_abi (tree, location_t);
extern bool class_tmpl_impl_spec_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 tree strip_typedefs (tree, bool * = NULL);
extern tree strip_typedefs_expr (tree, bool * = NULL);
tree next = NULL_TREE);
extern tree ovl_insert (tree fn, tree maybe_ovl,
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 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 get_fns (tree) ATTRIBUTE_PURE;
extern tree get_first_fn (tree) ATTRIBUTE_PURE;
extern tree lvalue_type (tree);
extern tree error_type (tree);
extern int varargs_function_p (const_tree);
-extern bool really_overloaded_fn (tree);
extern bool cp_tree_equal (tree, tree);
extern tree no_linkage_check (tree, bool);
extern void debug_binfo (tree);
extern tree complete_type (tree);
extern tree complete_type_or_else (tree, tree);
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 };
extern bool comp_except_specs (const_tree, const_tree, int);
extern bool comptypes (tree, tree, int);
return node;
}
+inline bool
+type_unknown_p (const_tree expr)
+{
+ return TREE_TYPE (expr) == unknown_type_node;
+}
+
/* -- end of C++ */
#endif /* ! GCC_CP_TREE_H */
if (TREE_CODE (x) == OFFSET_REF
|| TREE_CODE (x) == COMPONENT_REF)
x = TREE_OPERAND (x, 1);
- if (BASELINK_P (x))
- x = BASELINK_FUNCTIONS (x);
+ x = MAYBE_BASELINK_FUNCTIONS (x);
if (TREE_CODE (x) == TEMPLATE_ID_EXPR)
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 (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
{
if (identifier_p (x))
return x;
- if (TREE_CODE (x) != COMPONENT_REF
- && TREE_CODE (x) != OFFSET_REF
- && TREE_CODE (x) != BASELINK
- && is_overloaded_fn (x))
- return DECL_NAME (get_first_fn (x));
+ if (TREE_CODE (x) == TEMPLATE_ID_EXPR)
+ x = TREE_OPERAND (x, 0);
+ if (TREE_CODE (x) == OVERLOAD || TREE_CODE (x) == FUNCTION_DECL)
+ return OVL_NAME (x);
return NULL_TREE;
}
bool
decl_anon_ns_mem_p (const_tree decl)
{
- while (1)
+ while (TREE_CODE (decl) != NAMESPACE_DECL)
{
- if (decl == NULL_TREE || decl == error_mark_node)
- return false;
- if (TREE_CODE (decl) == NAMESPACE_DECL
- && DECL_NAME (decl) == NULL_TREE)
- return true;
- /* 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);
+ /* Classes inside anonymous namespaces have TREE_PUBLIC == 0. */
+ if (TYPE_P (decl))
+ return !TREE_PUBLIC (TYPE_MAIN_DECL (decl));
+
+ decl = CP_DECL_CONTEXT (decl);
}
+ return !TREE_PUBLIC (decl);
}
/* Subroutine of cp_tree_equal: t1 and t2 are the CALL_EXPR_FNs of two
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);
-}
-
\f
/* Return the common type of two parameter lists.
We assume that comptypes has already been done and returned 1;