aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-05-24 23:08:17 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-05-24 23:08:17 +0000
commitd48b9bbeb35903b7b8a7e56dc2868ea8d00b566a (patch)
treef8753d02aafe0e861cd2c741be9d246d90e9457e /gcc
parentd4a760d8c43fa10aa5b450b66f2f4bf67f898a8c (diff)
downloadgcc-d48b9bbeb35903b7b8a7e56dc2868ea8d00b566a.zip
gcc-d48b9bbeb35903b7b8a7e56dc2868ea8d00b566a.tar.gz
gcc-d48b9bbeb35903b7b8a7e56dc2868ea8d00b566a.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/cp-tree.h19
-rw-r--r--gcc/cp/tree.c43
-rw-r--r--gcc/cp/typeck.c9
4 files changed, 43 insertions, 40 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2982ca7..0f105e8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d52a784..8ea4edf 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6789,7 +6789,7 @@ extern tree finish_builtin_launder (location_t, tree,
/* 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,
@@ -6811,7 +6811,8 @@ extern bool type_has_nontrivial_copy_init (const_tree);
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);
@@ -6852,10 +6853,11 @@ extern tree ovl_make (tree fn,
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;
@@ -6876,7 +6878,6 @@ extern bool decl_anon_ns_mem_p (const_tree);
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);
@@ -6933,7 +6934,7 @@ extern tree require_complete_type_sfinae (tree, tsubst_flags_t);
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);
@@ -7311,6 +7312,12 @@ ovl_first (tree node)
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 */
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 29e3256c..f11c0ae 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2337,15 +2337,16 @@ is_overloaded_fn (tree x)
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
@@ -2357,11 +2358,10 @@ dependent_name (tree x)
{
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;
}
@@ -3319,22 +3319,15 @@ decl_namespace_context (tree decl)
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
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b81d6c8..6bf57bb 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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 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.
We assume that comptypes has already been done and returned 1;