aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-09-30 13:12:49 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-09-30 13:12:49 -0400
commitb752325e946487109cd3301f81b0301d0bad346d (patch)
tree1ba084fb5f2a0a2907bfb37114205574ba4c6473 /gcc/cp
parent32f3d0325439d650fef9a2675fbdcb53fa6ee893 (diff)
downloadgcc-b752325e946487109cd3301f81b0301d0bad346d.zip
gcc-b752325e946487109cd3301f81b0301d0bad346d.tar.gz
gcc-b752325e946487109cd3301f81b0301d0bad346d.tar.bz2
c-common.h (enum rid): Add RID_IS_TRIVIALLY_COPYABLE.
c-family/ * c-common.h (enum rid): Add RID_IS_TRIVIALLY_COPYABLE. * c-common.c (c_common_reswords): Add __is_trivially_copyable. cp/ * cp-tree.h (cp_trait_kind): Add CPTK_IS_TRIVIALLY_COPYABLE. * cxx-pretty-print.c (pp_cxx_trait_expression): Likewise. * parser.c (cp_parser_primary_expression): Likewise. (cp_parser_trait_expr): Likewise. * semantics.c (trait_expr_value): Likewise. (finish_trait_expr): Likewise. From-SVN: r215737
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/cxx-pretty-print.c3
-rw-r--r--gcc/cp/parser.c4
-rw-r--r--gcc/cp/semantics.c4
5 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2cc3792..d44d67a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,12 @@
2014-09-30 Jason Merrill <jason@redhat.com>
+ * cp-tree.h (cp_trait_kind): Add CPTK_IS_TRIVIALLY_COPYABLE.
+ * cxx-pretty-print.c (pp_cxx_trait_expression): Likewise.
+ * parser.c (cp_parser_primary_expression): Likewise.
+ (cp_parser_trait_expr): Likewise.
+ * semantics.c (trait_expr_value): Likewise.
+ (finish_trait_expr): Likewise.
+
* method.c (build_stub_object): Use CONVERT_EXPR.
* tree.c (build_dummy_object): Likewise.
(is_dummy_object): Adjust.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 789ef1a..8e5c3b7 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -653,6 +653,7 @@ typedef enum cp_trait_kind
CPTK_IS_POLYMORPHIC,
CPTK_IS_STD_LAYOUT,
CPTK_IS_TRIVIAL,
+ CPTK_IS_TRIVIALLY_COPYABLE,
CPTK_IS_UNION,
CPTK_UNDERLYING_TYPE
} cp_trait_kind;
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index f0734ec..7b2d7fd 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -2393,6 +2393,9 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t)
case CPTK_IS_TRIVIAL:
pp_cxx_ws_string (pp, "__is_trivial");
break;
+ case CPTK_IS_TRIVIALLY_COPYABLE:
+ pp_cxx_ws_string (pp, "__is_trivially_copyable");
+ break;
case CPTK_IS_UNION:
pp_cxx_ws_string (pp, "__is_union");
break;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 63cc0d3..b1feef5 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4490,6 +4490,7 @@ cp_parser_primary_expression (cp_parser *parser,
case RID_IS_POLYMORPHIC:
case RID_IS_STD_LAYOUT:
case RID_IS_TRIVIAL:
+ case RID_IS_TRIVIALLY_COPYABLE:
case RID_IS_UNION:
return cp_parser_trait_expr (parser, token->keyword);
@@ -8724,6 +8725,9 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword)
case RID_IS_TRIVIAL:
kind = CPTK_IS_TRIVIAL;
break;
+ case RID_IS_TRIVIALLY_COPYABLE:
+ kind = CPTK_IS_TRIVIALLY_COPYABLE;
+ break;
case RID_IS_UNION:
kind = CPTK_IS_UNION;
break;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 3fbbb17..9bcc6d7 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7379,6 +7379,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
case CPTK_IS_TRIVIAL:
return (trivial_type_p (type1));
+ case CPTK_IS_TRIVIALLY_COPYABLE:
+ return (trivially_copyable_p (type1));
+
case CPTK_IS_UNION:
return (type_code1 == UNION_TYPE);
@@ -7442,6 +7445,7 @@ finish_trait_expr (cp_trait_kind kind, tree type1, tree type2)
case CPTK_IS_POLYMORPHIC:
case CPTK_IS_STD_LAYOUT:
case CPTK_IS_TRIVIAL:
+ case CPTK_IS_TRIVIALLY_COPYABLE:
if (!check_trait_type (type1))
return error_mark_node;
break;