c-common.h (enum rid): Add RID_IS_TRIVIALLY_COPYABLE.
authorJason Merrill <jason@redhat.com>
Tue, 30 Sep 2014 17:12:49 +0000 (13:12 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 30 Sep 2014 17:12:49 +0000 (13:12 -0400)
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

gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/cxx-pretty-print.c
gcc/cp/parser.c
gcc/cp/semantics.c

index 262b2d4de2faca3752f7e417c11c27322814397c..8c44b18a85984ad4ebdcb67d1a78596191d1c4d7 100644 (file)
@@ -1,5 +1,8 @@
 2014-09-30  Jason Merrill  <jason@redhat.com>
 
+       * c-common.h (enum rid): Add RID_IS_TRIVIALLY_COPYABLE.
+       * c-common.c (c_common_reswords): Add __is_trivially_copyable.
+
        * c-common.h (enum rid): Remove RID_IS_CONVERTIBLE_TO.
        * c-common.c (c_common_reswords): Remove __is_convertible_to.
 
index 0324a0aaa30355071586047a32102ab73be9b9d3..482dd44961161206e90c13983a79dc5bae40f41e 100644 (file)
@@ -480,6 +480,7 @@ const struct c_common_resword c_common_reswords[] =
   { "__is_polymorphic",        RID_IS_POLYMORPHIC, D_CXXONLY },
   { "__is_standard_layout", RID_IS_STD_LAYOUT, D_CXXONLY },
   { "__is_trivial",     RID_IS_TRIVIAL, D_CXXONLY },
+  { "__is_trivially_copyable", RID_IS_TRIVIALLY_COPYABLE, D_CXXONLY },
   { "__is_union",      RID_IS_UNION,   D_CXXONLY },
   { "__label__",       RID_LABEL,      0 },
   { "__null",          RID_NULL,       0 },
index 5ba7859cb9dcfe54da4e49c2f5fc1115acb7e786..b7e3385ab7a47e61b29b2b0e68815c55e20caf82 100644 (file)
@@ -143,6 +143,7 @@ enum rid
   RID_IS_FINAL,                RID_IS_LITERAL_TYPE,
   RID_IS_POD,                  RID_IS_POLYMORPHIC,
   RID_IS_STD_LAYOUT,           RID_IS_TRIVIAL,
+  RID_IS_TRIVIALLY_COPYABLE,
   RID_IS_UNION,                RID_UNDERLYING_TYPE,
 
   /* C++11 */
index 2cc37928c399ae16aacdbccb12c293bd4b040dd7..d44d67a387576840b3372e583f8161cbda665fa6 100644 (file)
@@ -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.
index 789ef1afb446da481cee30f68c6111a8e8900149..8e5c3b7909fb3689fc4b72ac586815d8d4d2e47f 100644 (file)
@@ -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;
index f0734ec2f4fc3e6c708009d0f3c21a6ec44f2c7b..7b2d7fd205b3de3bcc0d7f9c7690ca374dcd7e5c 100644 (file)
@@ -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;
index 63cc0d3dd716583a403af504f66bd097ab026e02..b1feef52b93ad89c86b8525e8c467c088c17e7b1 100644 (file)
@@ -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;
index 3fbbb17dc3d2009a689896a3e1712f9ec7ccb9f5..9bcc6d73c78a1cda76f60de8e9991f9c3a952cfc 100644 (file)
@@ -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;