static void pp_cxx_new_expression (cxx_pretty_printer *pp, tree t) { enum tree_code code = TREE_CODE (t); switch (code) { case NEW_EXPR: case VEC_NEW_EXPR: if (NEW_EXPR_USE_GLOBAL (t)) pp_cxx_colon_colon (pp); pp_cxx_identifier (pp, "new"); if (TREE_OPERAND (t, 0)) { pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0)); pp_space (pp); } /* FIXME: array-types are built with one more element. */ pp_cxx_type_id (pp, TREE_OPERAND (t, 1)); if (TREE_OPERAND (t, 2)) { pp_left_paren (pp); t = TREE_OPERAND (t, 2); if (TREE_CODE (t) == TREE_LIST) pp_c_expression_list (pp_c_base (pp), t); else if (t == void_zero_node) ; /* OK, empty initializer list. */ else pp_cxx_expression (pp, t); pp_right_paren (pp); } break; default: pp_unsupported_tree (pp, t); } }
static void pp_c_initializer_list (c_pretty_printer *pp, tree e) { tree type = TREE_TYPE (e); const enum tree_code code = TREE_CODE (type); switch (code) { case RECORD_TYPE: case UNION_TYPE: case ARRAY_TYPE: { tree init = TREE_OPERAND (e, 0); for (; init != NULL_TREE; init = TREE_CHAIN (init)) { if (code == RECORD_TYPE || code == UNION_TYPE) { pp_c_dot (pp); pp_c_primary_expression (pp, TREE_PURPOSE (init)); } else { pp_c_left_bracket (pp); if (TREE_PURPOSE (init)) pp_c_constant (pp, TREE_PURPOSE (init)); pp_c_right_bracket (pp); } pp_c_whitespace (pp); pp_equal (pp); pp_c_whitespace (pp); pp_initializer (pp, TREE_VALUE (init)); if (TREE_CHAIN (init)) pp_separate_with (pp, ','); } } return; case VECTOR_TYPE: if (TREE_CODE (e) == VECTOR_CST) pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e)); else if (TREE_CODE (e) == CONSTRUCTOR) pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); else break; return; case COMPLEX_TYPE: if (TREE_CODE (e) == CONSTRUCTOR) pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) { const bool cst = TREE_CODE (e) == COMPLEX_CST; pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0)); pp_separate_with (pp, ','); pp_expression (pp, cst ? TREE_IMAGPART (e) : TREE_OPERAND (e, 1)); } else break; return; default: break; } pp_unsupported_tree (pp, type); }