diff options
author | Ian Lance Taylor <ian@airs.com> | 2005-04-20 19:59:16 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2005-04-20 19:59:16 +0000 |
commit | c3e5898be3e730343aa0803f62c1c432f9b1949e (patch) | |
tree | 515ce80a388b72849e08cc877925e5d16b15e4e3 /gcc/cp | |
parent | 02d98c0d639a8b003ce35aade9efb89da4a156b5 (diff) | |
download | gcc-c3e5898be3e730343aa0803f62c1c432f9b1949e.zip gcc-c3e5898be3e730343aa0803f62c1c432f9b1949e.tar.gz gcc-c3e5898be3e730343aa0803f62c1c432f9b1949e.tar.bz2 |
c-common.def: Remove STMT_EXPR (moved to cp/cp-tree.def).
./ * c-common.def: Remove STMT_EXPR (moved to cp/cp-tree.def).
* c-common.h (STMT_EXPR_STMT): Don't define.
(STMT_EXPR_NO_SCOPE): Don't define.
* c-dump.c (c_dump_tree): Don't handle STMT_EXPR.
* c-pretty-print.c (pp_c_primary_expression): Likewise.
(pp_c_expression): Likewise.
cp/
* cp-tree.def: Add STMT_EXPR.
* cp-tree.h (STMT_EXPR_NO_SCOPE): Define.
(STMT_EXPR_STMT): Define.
* cxx-pretty-print.c (pp_cxx_primary_expression): Handle
STMT_EXPR.
(pp_cxx_expression): Likewise.
(pp_cxx_statement): Call pp_cxx_statement, not pp_statement.
* dump.c (cp_dump_tree): Handle STMT_EXPR.
From-SVN: r98469
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/cp/cp-tree.def | 5 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 8 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 17 | ||||
-rw-r--r-- | gcc/cp/dump.c | 4 |
5 files changed, 40 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b053298..d8e77cc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2005-04-20 Ian Lance Taylor <ian@airs.com> + + * cp-tree.def: Add STMT_EXPR. + * cp-tree.h (STMT_EXPR_NO_SCOPE): Define. + (STMT_EXPR_STMT): Define. + * cxx-pretty-print.c (pp_cxx_primary_expression): Handle + STMT_EXPR. + (pp_cxx_expression): Likewise. + (pp_cxx_statement): Call pp_cxx_statement, not pp_statement. + * dump.c (cp_dump_tree): Handle STMT_EXPR. + 2005-04-18 Kazu Hirata <kazu@cs.umass.edu> * decl.c (expand_static_init): Call build2 and build3 instead diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index ffcc9a5..e50bf3c 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -331,6 +331,11 @@ DEFTREECODE (ARROW_EXPR, "arrow_expr", tcc_expression, 1) expansion. */ DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", tcc_unary, 1) +/* A STMT_EXPR represents a statement-expression during template + expansion. This is the GCC extension { ( ... ) }. The + STMT_EXPR_STMT is the statement given by the expression. */ +DEFTREECODE (STMT_EXPR, "stmt_expr", tcc_expression, 1) + /* Local variables: mode:c diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3765a4b..a27ee19 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -47,6 +47,7 @@ struct diagnostic_context; KOENIG_LOOKUP_P (in CALL_EXPR) STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST). EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT) + STMT_EXPR_NO_SCOPE (in STMT_EXPR) BIND_EXPR_TRY_BLOCK (in BIND_EXPR) TYPENAME_IS_ENUM_P (in TYPENAME_TYPE) REFERENCE_REF_P (in INDIRECT_EXPR) @@ -262,6 +263,10 @@ typedef struct ptrmem_cst * ptrmem_cst_t; #define EXPR_STMT_STMT_EXPR_RESULT(NODE) \ TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE)) +/* Nonzero if this statement-expression does not have an associated scope. */ +#define STMT_EXPR_NO_SCOPE(NODE) \ + TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE)) + /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual sense of `same'. */ #define same_type_p(TYPE1, TYPE2) \ @@ -2940,6 +2945,9 @@ struct lang_decl GTY(()) #define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1) #define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2) +/* STMT_EXPR accessor. */ +#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0) + /* An enumeration of the kind of tags that C++ accepts. */ enum tag_types { none_type = 0, /* Not a tag type. */ diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 854efec..2bffb73 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -345,6 +345,12 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t) pp_cxx_unqualified_id (pp, t); break; + case STMT_EXPR: + pp_cxx_left_paren (pp); + pp_cxx_statement (pp, STMT_EXPR_STMT (t)); + pp_cxx_right_paren (pp); + break; + default: pp_c_primary_expression (pp_c_base (pp), t); break; @@ -863,6 +869,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t) case TEMPLATE_TYPE_PARM: case TEMPLATE_PARM_INDEX: case TEMPLATE_TEMPLATE_PARM: + case STMT_EXPR: pp_cxx_primary_expression (pp, t); break; @@ -1584,7 +1591,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) pp_cxx_right_paren (pp); pp_indentation (pp) += 3; pp_needs_newline (pp) = true; - pp_statement (pp, SWITCH_STMT_BODY (t)); + pp_cxx_statement (pp, SWITCH_STMT_BODY (t)); pp_newline_and_indent (pp, -3); break; @@ -1600,7 +1607,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) pp_expression (pp, WHILE_COND (t)); pp_cxx_right_paren (pp); pp_newline_and_indent (pp, 3); - pp_statement (pp, WHILE_BODY (t)); + pp_cxx_statement (pp, WHILE_BODY (t)); pp_indentation (pp) -= 3; pp_needs_newline (pp) = true; break; @@ -1608,7 +1615,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) case DO_STMT: pp_cxx_identifier (pp, "do"); pp_newline_and_indent (pp, 3); - pp_statement (pp, DO_BODY (t)); + pp_cxx_statement (pp, DO_BODY (t)); pp_newline_and_indent (pp, -3); pp_cxx_identifier (pp, "while"); pp_space (pp); @@ -1624,7 +1631,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) pp_space (pp); pp_cxx_left_paren (pp); if (FOR_INIT_STMT (t)) - pp_statement (pp, FOR_INIT_STMT (t)); + pp_cxx_statement (pp, FOR_INIT_STMT (t)); else pp_cxx_semicolon (pp); pp_needs_newline (pp) = false; @@ -1638,7 +1645,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) pp_expression (pp, FOR_EXPR (t)); pp_cxx_right_paren (pp); pp_newline_and_indent (pp, 3); - pp_statement (pp, FOR_BODY (t)); + pp_cxx_statement (pp, FOR_BODY (t)); pp_indentation (pp) -= 3; pp_needs_newline (pp) = true; break; diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index f653d3a..20c7ace 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -455,6 +455,10 @@ cp_dump_tree (void* dump_info, tree t) dump_child ("body", WHILE_BODY (t)); break; + case STMT_EXPR: + dump_child ("stmt", STMT_EXPR_STMT (t)); + break; + default: break; } |