diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2019-05-15 13:46:29 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2019-05-15 13:46:29 +0000 |
commit | d509bb8cbe97b7ac5219eecebf62f27657da3d6a (patch) | |
tree | 6975921c524cf588fe37a23689801d1c1ac46206 /gcc | |
parent | 86e3947eea1619c83ac45c77ba4b3156d729c81f (diff) | |
download | gcc-d509bb8cbe97b7ac5219eecebf62f27657da3d6a.zip gcc-d509bb8cbe97b7ac5219eecebf62f27657da3d6a.tar.gz gcc-d509bb8cbe97b7ac5219eecebf62f27657da3d6a.tar.bz2 |
call.c (perform_overload_resolution, [...]): Use OVL_P; remove redundant TEMPLATE_DECL checks.
2019-05-15 Paolo Carlini <paolo.carlini@oracle.com>
* call.c (perform_overload_resolution, build_new_method_call_1):
Use OVL_P; remove redundant TEMPLATE_DECL checks.
* decl.c (grokfndecl): Likewise.
* mangle.c (write_expression): Likewise.
* parser.c (cp_parser_template_id): Likewise.
* pt.c (resolve_overloaded_unification, type_dependent_expression_p):
Likewise.
* search.c (build_baselink): Likewise.
* tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise.
From-SVN: r271211
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/call.c | 9 | ||||
-rw-r--r-- | gcc/cp/decl.c | 4 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 | ||||
-rw-r--r-- | gcc/cp/search.c | 5 | ||||
-rw-r--r-- | gcc/cp/tree.c | 8 |
8 files changed, 23 insertions, 29 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d896e5d..5888ce6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2019-05-15 Paolo Carlini <paolo.carlini@oracle.com> + + * call.c (perform_overload_resolution, build_new_method_call_1): + Use OVL_P; remove redundant TEMPLATE_DECL checks. + * decl.c (grokfndecl): Likewise. + * mangle.c (write_expression): Likewise. + * parser.c (cp_parser_template_id): Likewise. + * pt.c (resolve_overloaded_unification, type_dependent_expression_p): + Likewise. + * search.c (build_baselink): Likewise. + * tree.c (is_overloaded_fn, dependent_name, maybe_get_fns): Likewise. + 2019-05-14 Paolo Carlini <paolo.carlini@oracle.com> PR preprocessor/90382 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 00cb399..0a5147a 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4383,10 +4383,7 @@ perform_overload_resolution (tree fn, *any_viable_p = true; /* Check FN. */ - gcc_assert (TREE_CODE (fn) == FUNCTION_DECL - || TREE_CODE (fn) == TEMPLATE_DECL - || TREE_CODE (fn) == OVERLOAD - || TREE_CODE (fn) == TEMPLATE_ID_EXPR); + gcc_assert (OVL_P (fn) || TREE_CODE (fn) == TEMPLATE_ID_EXPR); if (TREE_CODE (fn) == TEMPLATE_ID_EXPR) { @@ -9605,9 +9602,7 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args, fns = TREE_OPERAND (fns, 0); template_only = 1; } - gcc_assert (TREE_CODE (fns) == FUNCTION_DECL - || TREE_CODE (fns) == TEMPLATE_DECL - || TREE_CODE (fns) == OVERLOAD); + gcc_assert (OVL_P (fns)); fn = OVL_FIRST (fns); name = DECL_NAME (fn); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 66dc4c4..6918c3b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8918,9 +8918,7 @@ grokfndecl (tree ctype, the information in the TEMPLATE_ID_EXPR. */ SET_DECL_IMPLICIT_INSTANTIATION (decl); - gcc_assert (identifier_p (fns) - || TREE_CODE (fns) == OVERLOAD - || TREE_CODE (fns) == FUNCTION_DECL); + gcc_assert (identifier_p (fns) || OVL_P (fns)); DECL_TEMPLATE_INFO (decl) = build_template_info (fns, args); for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t; t = TREE_CHAIN (t)) diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index c13dacb..acb81d1 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3278,8 +3278,7 @@ write_expression (tree expr) /* Mangle a dependent name as the name, not whatever happens to be the first function in the overload set. */ - if ((TREE_CODE (fn) == FUNCTION_DECL - || TREE_CODE (fn) == OVERLOAD) + if (OVL_P (fn) && type_dependent_expression_p_push (expr)) fn = OVL_NAME (fn); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c90782e..ab3e672 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -16479,10 +16479,7 @@ cp_parser_template_id (cp_parser *parser, { /* If it's not a class-template or a template-template, it should be a function-template. */ - gcc_assert ((DECL_FUNCTION_TEMPLATE_P (templ) - || TREE_CODE (templ) == OVERLOAD - || TREE_CODE (templ) == FUNCTION_DECL - || BASELINK_P (templ))); + gcc_assert (OVL_P (templ) || BASELINK_P (templ)); template_id = lookup_template_function (templ, arguments); if (TREE_CODE (template_id) == TEMPLATE_ID_EXPR) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 42d1287..edb0701 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21193,8 +21193,7 @@ resolve_overloaded_unification (tree tparms, if (good != 1) good = ok; } - else if (TREE_CODE (arg) != OVERLOAD - && TREE_CODE (arg) != FUNCTION_DECL) + else if (!OVL_P (arg)) /* If ARG is, for example, "(0, &f)" then its type will be unknown -- but the deduction does not succeed because the expression is not just the function on its own. */ @@ -25950,8 +25949,7 @@ type_dependent_expression_p (tree expression) return true; } - gcc_assert (TREE_CODE (expression) == OVERLOAD - || TREE_CODE (expression) == FUNCTION_DECL); + gcc_assert (OVL_P (expression)); for (lkp_iterator iter (expression); iter; ++iter) if (type_dependent_expression_p (*iter)) diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 4c3fffd..dac08d4 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1058,10 +1058,7 @@ build_baselink (tree binfo, tree access_binfo, tree functions, tree optype) { tree baselink; - gcc_assert (TREE_CODE (functions) == FUNCTION_DECL - || TREE_CODE (functions) == TEMPLATE_DECL - || TREE_CODE (functions) == TEMPLATE_ID_EXPR - || TREE_CODE (functions) == OVERLOAD); + gcc_assert (OVL_P (functions) || TREE_CODE (functions) == TEMPLATE_ID_EXPR); gcc_assert (!optype || TYPE_P (optype)); gcc_assert (TREE_TYPE (functions)); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 7b8889e..14d6aff 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2381,8 +2381,7 @@ is_overloaded_fn (tree x) || (TREE_CODE (x) == OVERLOAD && !OVL_SINGLE_P (x))) return 2; - return (TREE_CODE (x) == FUNCTION_DECL - || TREE_CODE (x) == OVERLOAD); + return OVL_P (x); } /* X is the CALL_EXPR_FN of a CALL_EXPR. If X represents a dependent name @@ -2396,7 +2395,7 @@ dependent_name (tree x) return x; if (TREE_CODE (x) == TEMPLATE_ID_EXPR) x = TREE_OPERAND (x, 0); - if (TREE_CODE (x) == OVERLOAD || TREE_CODE (x) == FUNCTION_DECL) + if (OVL_P (x)) return OVL_NAME (x); return NULL_TREE; } @@ -2428,8 +2427,7 @@ maybe_get_fns (tree from) if (TREE_CODE (from) == TEMPLATE_ID_EXPR) from = TREE_OPERAND (from, 0); - if (TREE_CODE (from) == OVERLOAD - || TREE_CODE (from) == FUNCTION_DECL) + if (OVL_P (from)) return from; return NULL; |