aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-04-28 15:01:13 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-04-28 15:01:13 -0400
commitbabaa9df0279b16243acc58c9a5d7731f4882af4 (patch)
treeb72de2324ca719d4d3a1fc4ddc1c350892ee00d7 /gcc/cp/cvt.c
parentceaaa9fe93fd5c33028b74eff376aff8321ecfa5 (diff)
downloadgcc-babaa9df0279b16243acc58c9a5d7731f4882af4.zip
gcc-babaa9df0279b16243acc58c9a5d7731f4882af4.tar.gz
gcc-babaa9df0279b16243acc58c9a5d7731f4882af4.tar.bz2
cvt.c (cp_get_callee): New.
* cvt.c (cp_get_callee): New. * constexpr.c (get_function_named_in_call): Use it. * cxx-pretty-print.c (postfix_expression): Use it. * except.c (check_noexcept_r): Use it. * method.c (check_nontriv): Use it. * tree.c (build_aggr_init_expr): Use it. * cp-tree.h: Declare it. From-SVN: r235596
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 0d1048c..8c9d78b 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -904,6 +904,20 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
return error_mark_node;
}
+/* If CALL is a call, return the callee; otherwise null. */
+
+tree
+cp_get_callee (tree call)
+{
+ if (call == NULL_TREE)
+ return call;
+ else if (TREE_CODE (call) == CALL_EXPR)
+ return CALL_EXPR_FN (call);
+ else if (TREE_CODE (call) == AGGR_INIT_EXPR)
+ return AGGR_INIT_EXPR_FN (call);
+ return NULL_TREE;
+}
+
/* When an expression is used in a void context, its value is discarded and
no lvalue-rvalue and similar conversions happen [expr.static.cast/4,
stmt.expr/1, expr.comma/1]. This permits dereferencing an incomplete type