diff options
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index fb812e2..7476aa0 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -456,6 +456,22 @@ build_cplus_new (tree type, tree init) return rval; } +/* Return a TARGET_EXPR which expresses the direct-initialization of one + array from another. */ + +tree +build_array_copy (tree init) +{ + tree type = TREE_TYPE (init); + tree slot = build_local_temp (type); + init = build2 (VEC_INIT_EXPR, type, slot, init); + SET_EXPR_LOCATION (init, input_location); + init = build_target_expr (slot, init); + TARGET_EXPR_IMPLICIT_P (init) = 1; + + return init; +} + /* Build a TARGET_EXPR using INIT to initialize a new temporary of the indicated TYPE. */ @@ -726,6 +742,17 @@ cp_build_reference_type (tree to_type, bool rval) } +/* Returns EXPR cast to rvalue reference type, like std::move. */ + +tree +move (tree expr) +{ + tree type = TREE_TYPE (expr); + gcc_assert (TREE_CODE (type) != REFERENCE_TYPE); + type = cp_build_reference_type (type, /*rval*/true); + return build_static_cast (type, expr, tf_warning_or_error); +} + /* Used by the C++ front end to build qualified array types. However, the C version of this function does not properly maintain canonical types (which are not used in C). */ @@ -1558,6 +1585,8 @@ no_linkage_check (tree t, bool relaxed_p) namespace scope. This doesn't have a core issue number yet. */ if (TYPE_ANONYMOUS_P (t) && TYPE_NAMESPACE_SCOPE_P (t)) return t; + if (no_linkage_lambda_type_p (t)) + return t; r = CP_TYPE_CONTEXT (t); if (TYPE_P (r)) @@ -2759,6 +2788,8 @@ special_function_p (const_tree decl) DECL_LANG_SPECIFIC. */ if (DECL_COPY_CONSTRUCTOR_P (decl)) return sfk_copy_constructor; + if (DECL_MOVE_CONSTRUCTOR_P (decl)) + return sfk_move_constructor; if (DECL_CONSTRUCTOR_P (decl)) return sfk_constructor; if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR) |