diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-07 21:37:46 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-07 21:37:46 +0200 |
commit | be845b04a8e13e91e7ecd76b60254c7d0acfda2e (patch) | |
tree | 7b14e19adcc90c0ed591c2745b010b6ffcf52ade /gcc/cp/cxx-pretty-print.c | |
parent | 082139830afb428628657a7520659a01ae00b852 (diff) | |
download | gcc-be845b04a8e13e91e7ecd76b60254c7d0acfda2e.zip gcc-be845b04a8e13e91e7ecd76b60254c7d0acfda2e.tar.gz gcc-be845b04a8e13e91e7ecd76b60254c7d0acfda2e.tar.bz2 |
Implement LWG2296 helper intrinsic c-family/
Implement LWG2296 helper intrinsic
c-family/
* c-common.h (enum rid): Add RID_ADDRESSOF.
* c-common.c (c_common_reswords): Add __builtin_addressof.
cp/
* parser.c (cp_parser_postfix_expression): Handle RID_ADDRESSOF.
* cp-objcp-common.c (cp_common_init_ts): Handle ADDRESSOF_EXPR.
* constexpr.c (potential_constant_expression_1): Likewise.
* error.c (dump_expr): Likewise.
* typeck.c (cp_build_addressof): New function.
* cp-tree.h (cp_build_addressof): Declare.
* cxx-pretty-print.h (pp_cxx_addressof_expression): Declare.
* cp-tree.def (ADDRESSOF_EXPR): New tree code.
* cxx-pretty-print.c (cxx_pretty_printer::primary_expression): Handle
ADDRESSOF_EXPR. Add __builtin_addressof and
__has_unique_object_representations into syntax in function comment.
(pp_cxx_addressof_expression): New function.
* pt.c (tsubst_copy_and_build): Handle ADDRESSOF_EXPR.
testsuite/
* g++.dg/cpp0x/addressof1.C: New test.
* g++.dg/cpp0x/addressof2.C: New test.
From-SVN: r240873
Diffstat (limited to 'gcc/cp/cxx-pretty-print.c')
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 68dcf58..5157fab 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -380,6 +380,7 @@ pp_cxx_userdef_literal (cxx_pretty_printer *pp, tree t) GNU Extensions: __builtin_va_arg ( assignment-expression , type-id ) __builtin_offsetof ( type-id, offsetof-expression ) + __builtin_addressof ( expression ) __has_nothrow_assign ( type-id ) __has_nothrow_constructor ( type-id ) @@ -387,6 +388,7 @@ pp_cxx_userdef_literal (cxx_pretty_printer *pp, tree t) __has_trivial_assign ( type-id ) __has_trivial_constructor ( type-id ) __has_trivial_copy ( type-id ) + __has_unique_object_representations ( type-id ) __has_trivial_destructor ( type-id ) __has_virtual_destructor ( type-id ) __is_abstract ( type-id ) @@ -456,6 +458,10 @@ cxx_pretty_printer::primary_expression (tree t) pp_cxx_offsetof_expression (this, t); break; + case ADDRESSOF_EXPR: + pp_cxx_addressof_expression (this, t); + break; + case REQUIRES_EXPR: pp_cxx_requires_expr (this, t); break; @@ -2437,6 +2443,15 @@ pp_cxx_offsetof_expression (cxx_pretty_printer *pp, tree t) pp_cxx_right_paren (pp); } +void +pp_cxx_addressof_expression (cxx_pretty_printer *pp, tree t) +{ + pp_cxx_ws_string (pp, "__builtin_addressof"); + pp_cxx_left_paren (pp); + pp->expression (TREE_OPERAND (t, 0)); + pp_cxx_right_paren (pp); +} + static char const* get_fold_operator (tree t) { |