1 /* Implementation of subroutines for the GNU C++ pretty-printer.
2 Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #include "coretypes.h"
27 #include "cxx-pretty-print.h"
31 static void pp_cxx_unqualified_id (cxx_pretty_printer *, tree);
32 static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree);
33 static void pp_cxx_qualified_id (cxx_pretty_printer *, tree);
34 static void pp_cxx_assignment_expression (cxx_pretty_printer *, tree);
35 static void pp_cxx_expression (cxx_pretty_printer *, tree);
36 static void pp_cxx_template_argument_list (cxx_pretty_printer *, tree);
37 static void pp_cxx_type_specifier_seq (cxx_pretty_printer *, tree);
38 static void pp_cxx_ptr_operator (cxx_pretty_printer *, tree);
39 static void pp_cxx_type_id (cxx_pretty_printer *, tree);
40 static void pp_cxx_direct_abstract_declarator (cxx_pretty_printer *, tree);
41 static void pp_cxx_declarator (cxx_pretty_printer *, tree);
42 static void pp_cxx_parameter_declaration_clause (cxx_pretty_printer *, tree);
43 static void pp_cxx_abstract_declarator (cxx_pretty_printer *, tree);
44 static void pp_cxx_statement (cxx_pretty_printer *, tree);
45 static void pp_cxx_template_parameter (cxx_pretty_printer *, tree);
49 pp_cxx_nonconsecutive_character (cxx_pretty_printer *pp, int c)
51 const char *p = pp_last_position_in_text (pp);
53 if (p != NULL && *p == c)
54 pp_cxx_whitespace (pp);
56 pp_base (pp)->padding = pp_none;
59 #define pp_cxx_storage_class_specifier(PP, T) \
60 pp_c_storage_class_specifier (pp_c_base (PP), T)
61 #define pp_cxx_expression_list(PP, T) \
62 pp_c_expression_list (pp_c_base (PP), T)
63 #define pp_cxx_space_for_pointer_operator(PP, T) \
64 pp_c_space_for_pointer_operator (pp_c_base (PP), T)
65 #define pp_cxx_init_declarator(PP, T) \
66 pp_c_init_declarator (pp_c_base (PP), T)
67 #define pp_cxx_call_argument_list(PP, T) \
68 pp_c_call_argument_list (pp_c_base (PP), T)
71 pp_cxx_colon_colon (cxx_pretty_printer *pp)
74 pp_base (pp)->padding = pp_none;
78 pp_cxx_begin_template_argument_list (cxx_pretty_printer *pp)
80 pp_cxx_nonconsecutive_character (pp, '<');
84 pp_cxx_end_template_argument_list (cxx_pretty_printer *pp)
86 pp_cxx_nonconsecutive_character (pp, '>');
90 pp_cxx_separate_with (cxx_pretty_printer *pp, int c)
92 pp_separate_with (pp, c);
93 pp_base (pp)->padding = pp_none;
99 is_destructor_name (tree name)
101 return name == complete_dtor_identifier
102 || name == base_dtor_identifier
103 || name == deleting_dtor_identifier;
106 /* conversion-function-id:
107 operator conversion-type-id
110 type-specifier-seq conversion-declarator(opt)
112 conversion-declarator:
113 ptr-operator conversion-declarator(opt) */
116 pp_cxx_conversion_function_id (cxx_pretty_printer *pp, tree t)
118 pp_cxx_identifier (pp, "operator");
119 pp_cxx_type_specifier_seq (pp, TREE_TYPE (t));
123 pp_cxx_template_id (cxx_pretty_printer *pp, tree t)
125 pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 0));
126 pp_cxx_begin_template_argument_list (pp);
127 pp_cxx_template_argument_list (pp, TREE_OPERAND (t, 1));
128 pp_cxx_end_template_argument_list (pp);
134 conversion-function-id
139 pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
141 enum tree_code code = TREE_CODE (t);
145 pp_cxx_identifier (pp, "<return-value>");
162 case IDENTIFIER_NODE:
164 pp_cxx_identifier (pp, "<unnamed>");
165 else if (IDENTIFIER_TYPENAME_P (t))
166 pp_cxx_conversion_function_id (pp, t);
169 if (is_destructor_name (t))
172 /* FIXME: Why is this necessary? */
174 t = constructor_name (TREE_TYPE (t));
176 pp_cxx_tree_identifier (pp, t);
180 case TEMPLATE_ID_EXPR:
181 pp_cxx_template_id (pp, t);
185 pp_cxx_unqualified_id (pp, BASELINK_FUNCTIONS (t));
191 pp_cxx_unqualified_id (pp, TYPE_NAME (t));
194 case TEMPLATE_TYPE_PARM:
195 case TEMPLATE_TEMPLATE_PARM:
196 if (TYPE_IDENTIFIER (t))
197 pp_cxx_unqualified_id (pp, TYPE_IDENTIFIER (t));
199 pp_cxx_canonical_template_parameter (pp, t);
202 case TEMPLATE_PARM_INDEX:
203 pp_cxx_unqualified_id (pp, TEMPLATE_PARM_DECL (t));
207 pp_unsupported_tree (pp, t);
212 /* Pretty-print out the token sequence ":: template" in template codes
213 where it is needed to "inline declare" the (following) member as
214 a template. This situation arises when SCOPE of T is dependent
215 on template parameters. */
218 pp_cxx_template_keyword_if_needed (cxx_pretty_printer *pp, tree scope, tree t)
220 if (TREE_CODE (t) == TEMPLATE_ID_EXPR
221 && TYPE_P (scope) && dependent_type_p (scope))
222 pp_cxx_identifier (pp, "template");
225 /* nested-name-specifier:
226 class-or-namespace-name :: nested-name-specifier(opt)
227 class-or-namespace-name :: template nested-name-specifier */
230 pp_cxx_nested_name_specifier (cxx_pretty_printer *pp, tree t)
232 if (t != NULL && t != pp->enclosing_scope)
234 tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
235 pp_cxx_nested_name_specifier (pp, scope);
236 pp_cxx_template_keyword_if_needed (pp, scope, t);
237 pp_cxx_unqualified_id (pp, t);
238 pp_cxx_colon_colon (pp);
243 nested-name-specifier template(opt) unqualified-id */
246 pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
248 switch (TREE_CODE (t))
250 /* A pointer-to-member is always qualified. */
252 pp_cxx_nested_name_specifier (pp, PTRMEM_CST_CLASS (t));
253 pp_cxx_unqualified_id (pp, PTRMEM_CST_MEMBER (t));
256 /* In Standard C++, functions cannot possibly be used as
257 nested-name-specifiers. However, there are situations where
258 is "makes sense" to output the surrounding function name for the
259 purpose of emphasizing on the scope kind. Just printing the
260 function name might not be sufficient as it may be overloaded; so,
261 we decorate the function with its signature too.
262 FIXME: This is probably the wrong pretty-printing for conversion
263 functions and some function templates. */
267 if (DECL_FUNCTION_MEMBER_P (t))
268 pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
269 pp_cxx_unqualified_id
270 (pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t);
271 pp_cxx_parameter_declaration_clause (pp, TREE_TYPE (t));
276 pp_cxx_nested_name_specifier (pp, TREE_OPERAND (t, 0));
277 pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 1));
282 tree scope = TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t);
283 if (scope != pp->enclosing_scope)
285 pp_cxx_nested_name_specifier (pp, scope);
286 pp_cxx_template_keyword_if_needed (pp, scope, t);
288 pp_cxx_unqualified_id (pp, t);
299 pp_cxx_id_expression (cxx_pretty_printer *pp, tree t)
301 if (TREE_CODE (t) == OVERLOAD)
303 if (DECL_P (t) && DECL_CONTEXT (t))
304 pp_cxx_qualified_id (pp, t);
306 pp_cxx_unqualified_id (pp, t);
309 /* primary-expression:
313 :: operator-function-id
319 pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
321 switch (TREE_CODE (t))
326 pp_c_constant (pp_c_base (pp), t);
330 t = BASELINK_FUNCTIONS (t);
338 pp_cxx_id_expression (pp, t);
342 case TEMPLATE_TYPE_PARM:
343 case TEMPLATE_TEMPLATE_PARM:
344 case TEMPLATE_PARM_INDEX:
345 pp_cxx_unqualified_id (pp, t);
349 pp_c_primary_expression (pp_c_base (pp), t);
354 /* postfix-expression:
356 postfix-expression [ expression ]
357 postfix-expression ( expression-list(opt) )
358 simple-type-specifier ( expression-list(opt) )
359 typename ::(opt) nested-name-specifier identifier ( expression-list(opt) )
360 typename ::(opt) nested-name-specifier template(opt)
361 template-id ( expression-list(opt) )
362 postfix-expression . template(opt) ::(opt) id-expression
363 postfix-expression -> template(opt) ::(opt) id-expression
364 postfix-expression . pseudo-destructor-name
365 postfix-expression -> pseudo-destructor-name
366 postfix-expression ++
367 postfix-expression --
368 dynamic_cast < type-id > ( expression )
369 static_cast < type-id > ( expression )
370 reinterpret_cast < type-id > ( expression )
371 const_cast < type-id > ( expression )
372 typeid ( expression )
373 typeif ( type-id ) */
376 pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
378 enum tree_code code = TREE_CODE (t);
385 tree fun = TREE_OPERAND (t, 0);
386 tree args = TREE_OPERAND (t, 1);
387 tree saved_scope = pp->enclosing_scope;
389 if (TREE_CODE (fun) == ADDR_EXPR)
390 fun = TREE_OPERAND (fun, 0);
392 /* In templates, where there is no way to tell whether a given
393 call uses an actual member function. So the parser builds
394 FUN as a COMPONENT_REF or a plain IDENTIFIER_NODE until
395 instantiation time. */
396 if (TREE_CODE (fun) != FUNCTION_DECL)
398 else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun))
400 tree object = code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t)
401 ? TREE_OPERAND (t, 2)
404 while (TREE_CODE (object) == NOP_EXPR)
405 object = TREE_OPERAND (object, 0);
407 if (TREE_CODE (object) == ADDR_EXPR)
408 object = TREE_OPERAND (object, 0);
410 if (TREE_CODE (TREE_TYPE (object)) != POINTER_TYPE)
412 pp_cxx_postfix_expression (pp, object);
417 pp_cxx_postfix_expression (pp, object);
420 args = TREE_CHAIN (args);
421 pp->enclosing_scope = strip_pointer_operator (TREE_TYPE (object));
424 pp_cxx_postfix_expression (pp, fun);
425 pp->enclosing_scope = saved_scope;
426 pp_cxx_call_argument_list (pp, args);
428 if (code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t))
430 pp_cxx_separate_with (pp, ',');
431 pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 2));
444 pp_cxx_primary_expression (pp, t);
447 case DYNAMIC_CAST_EXPR:
448 case STATIC_CAST_EXPR:
449 case REINTERPRET_CAST_EXPR:
450 case CONST_CAST_EXPR:
451 if (code == DYNAMIC_CAST_EXPR)
452 pp_cxx_identifier (pp, "dynamic_cast");
453 else if (code == STATIC_CAST_EXPR)
454 pp_cxx_identifier (pp, "static_cast");
455 else if (code == REINTERPRET_CAST_EXPR)
456 pp_cxx_identifier (pp, "reinterpret_cast");
458 pp_cxx_identifier (pp, "const_cast");
459 pp_cxx_begin_template_argument_list (pp);
460 pp_cxx_type_id (pp, TREE_TYPE (t));
461 pp_cxx_end_template_argument_list (pp);
463 pp_cxx_expression (pp, TREE_OPERAND (t, 0));
467 case EMPTY_CLASS_EXPR:
468 pp_cxx_type_id (pp, TREE_TYPE (t));
474 t = TREE_OPERAND (t, 0);
475 pp_cxx_identifier (pp, "typeid");
478 pp_cxx_type_id (pp, t);
480 pp_cxx_expression (pp, t);
484 case PSEUDO_DTOR_EXPR:
485 pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 0));
487 pp_cxx_qualified_id (pp, TREE_OPERAND (t, 1));
488 pp_cxx_colon_colon (pp);
490 pp_cxx_unqualified_id (pp, TREE_OPERAND (t, 2));
494 pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 0));
499 pp_c_postfix_expression (pp_c_base (pp), t);
505 ::(opt) new new-placement(opt) new-type-id new-initializer(opt)
506 ::(opt) new new-placement(opt) ( type-id ) new-initializer(opt)
512 type-specifier-seq new-declarator(opt)
515 ptr-operator new-declarator(opt)
516 direct-new-declarator
518 direct-new-declarator
520 direct-new-declarator [ constant-expression ]
523 ( expression-list(opt) ) */
526 pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
528 enum tree_code code = TREE_CODE (t);
533 if (NEW_EXPR_USE_GLOBAL (t))
534 pp_cxx_colon_colon (pp);
535 pp_cxx_identifier (pp, "new");
536 if (TREE_OPERAND (t, 0))
538 pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
541 /* FIXME: array-types are built with one more element. */
542 pp_cxx_type_id (pp, TREE_OPERAND (t, 1));
543 if (TREE_OPERAND (t, 2))
546 t = TREE_OPERAND (t, 2);
547 if (TREE_CODE (t) == TREE_LIST)
548 pp_c_expression_list (pp_c_base (pp), t);
549 else if (t == void_zero_node)
550 ; /* OK, empty initializer list. */
552 pp_cxx_expression (pp, t);
558 pp_unsupported_tree (pp, t);
562 /* delete-expression:
563 ::(opt) delete cast-expression
564 ::(opt) delete [ ] cast-expression */
567 pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
569 enum tree_code code = TREE_CODE (t);
573 case VEC_DELETE_EXPR:
574 if (DELETE_EXPR_USE_GLOBAL (t))
575 pp_cxx_colon_colon (pp);
576 pp_cxx_identifier (pp, "delete");
577 if (code == VEC_DELETE_EXPR)
579 pp_left_bracket (pp);
580 pp_right_bracket (pp);
582 pp_c_cast_expression (pp_c_base (pp), TREE_OPERAND (t, 0));
586 pp_unsupported_tree (pp, t);
594 unary-operator cast-expression
595 sizeof unary-expression
600 unary-operator: one of
604 __alignof__ unary-expression
605 __alignof__ ( type-id ) */
608 pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
610 enum tree_code code = TREE_CODE (t);
615 pp_cxx_new_expression (pp, t);
619 case VEC_DELETE_EXPR:
620 pp_cxx_delete_expression (pp, t);
625 pp_cxx_identifier (pp, code == SIZEOF_EXPR ? "sizeof" : "__alignof__");
626 pp_cxx_whitespace (pp);
627 if (TYPE_P (TREE_OPERAND (t, 0)))
629 pp_cxx_left_paren (pp);
630 pp_cxx_type_id (pp, TREE_OPERAND (t, 0));
631 pp_cxx_right_paren (pp);
634 pp_unary_expression (pp, TREE_OPERAND (t, 0));
638 pp_c_unary_expression (pp_c_base (pp), t);
645 ( type-id ) cast-expression */
648 pp_cxx_cast_expression (cxx_pretty_printer *pp, tree t)
650 switch (TREE_CODE (t))
653 pp_cxx_type_id (pp, TREE_TYPE (t));
654 pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
658 pp_c_cast_expression (pp_c_base (pp), t);
665 pm-expression .* cast-expression
666 pm-expression ->* cast-expression */
669 pp_cxx_pm_expression (cxx_pretty_printer *pp, tree t)
671 switch (TREE_CODE (t))
673 /* Handle unfortunate OFFESET_REF overloading here. */
675 if (TYPE_P (TREE_OPERAND (t, 0)))
677 pp_cxx_qualified_id (pp, t);
680 /* Else fall through. */
683 pp_cxx_pm_expression (pp, TREE_OPERAND (t, 0));
686 pp_cxx_cast_expression (pp, TREE_OPERAND (t, 1));
691 pp_cxx_cast_expression (pp, t);
696 /* multiplicative-expression:
698 multiplicative-expression * pm-expression
699 multiplicative-expression / pm-expression
700 multiplicative-expression % pm-expression */
703 pp_cxx_multiplicative_expression (cxx_pretty_printer *pp, tree e)
705 enum tree_code code = TREE_CODE (e);
711 pp_cxx_multiplicative_expression (pp, TREE_OPERAND (e, 0));
713 if (code == MULT_EXPR)
715 else if (code == TRUNC_DIV_EXPR)
720 pp_cxx_pm_expression (pp, TREE_OPERAND (e, 1));
724 pp_cxx_pm_expression (pp, e);
729 /* conditional-expression:
730 logical-or-expression
731 logical-or-expression ? expression : assignment-expression */
734 pp_cxx_conditional_expression (cxx_pretty_printer *pp, tree e)
736 if (TREE_CODE (e) == COND_EXPR)
738 pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
742 pp_cxx_expression (pp, TREE_OPERAND (e, 1));
744 pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2));
747 pp_c_logical_or_expression (pp_c_base (pp), e);
750 /* Pretty-print a compound assignment operator token as indicated by T. */
753 pp_cxx_assignment_operator (cxx_pretty_printer *pp, tree t)
757 switch (TREE_CODE (t))
780 op = tree_code_name[TREE_CODE (t)];
784 pp_cxx_identifier (pp, op);
788 /* assignment-expression:
789 conditional-expression
790 logical-or-expression assignment-operator assignment-expression
794 throw assignment-expression(opt)
796 assignment-operator: one of
797 = *= /= %= += -= >>= <<= &= ^= |= */
800 pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e)
802 switch (TREE_CODE (e))
806 pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
810 pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 1));
814 pp_cxx_identifier (pp, "throw");
815 if (TREE_OPERAND (e, 0))
816 pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0));
820 pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0));
821 pp_cxx_assignment_operator (pp, TREE_OPERAND (e, 1));
822 pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2));
826 pp_cxx_conditional_expression (pp, e);
832 pp_cxx_expression (cxx_pretty_printer *pp, tree t)
834 switch (TREE_CODE (t))
839 pp_c_constant (pp_c_base (pp), t);
843 pp_cxx_unqualified_id (pp, t);
851 pp_cxx_qualified_id (pp, t);
863 case TEMPLATE_TYPE_PARM:
864 case TEMPLATE_PARM_INDEX:
865 case TEMPLATE_TEMPLATE_PARM:
866 pp_cxx_primary_expression (pp, t);
870 case DYNAMIC_CAST_EXPR:
871 case STATIC_CAST_EXPR:
872 case REINTERPRET_CAST_EXPR:
873 case CONST_CAST_EXPR:
877 case EMPTY_CLASS_EXPR:
879 case PSEUDO_DTOR_EXPR:
882 pp_cxx_postfix_expression (pp, t);
887 pp_cxx_new_expression (pp, t);
891 case VEC_DELETE_EXPR:
892 pp_cxx_delete_expression (pp, t);
897 pp_cxx_unary_expression (pp, t);
901 pp_cxx_cast_expression (pp, t);
907 pp_cxx_pm_expression (pp, t);
913 pp_cxx_multiplicative_expression (pp, t);
917 pp_cxx_conditional_expression (pp, t);
924 pp_cxx_assignment_expression (pp, t);
927 case NON_DEPENDENT_EXPR:
928 case MUST_NOT_THROW_EXPR:
929 pp_cxx_expression (pp, t);
933 pp_c_expression (pp_c_base (pp), t);
941 /* function-specifier:
947 pp_cxx_function_specifier (cxx_pretty_printer *pp, tree t)
949 switch (TREE_CODE (t))
952 if (DECL_VIRTUAL_P (t))
953 pp_cxx_identifier (pp, "virtual");
954 else if (DECL_CONSTRUCTOR_P (t) && DECL_NONCONVERTING_P (t))
955 pp_cxx_identifier (pp, "explicit");
957 pp_c_function_specifier (pp_c_base (pp), t);
964 /* decl-specifier-seq:
965 decl-specifier-seq(opt) decl-specifier
968 storage-class-specifier
975 pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
977 switch (TREE_CODE (t))
983 pp_cxx_storage_class_specifier (pp, t);
984 pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t));
988 pp_cxx_identifier (pp, "typedef");
989 pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t));
993 if (TYPE_PTRMEMFUNC_P (t))
995 tree pfm = TYPE_PTRMEMFUNC_FN_TYPE (t);
996 pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (pfm)));
997 pp_cxx_whitespace (pp);
998 pp_cxx_ptr_operator (pp, t);
1003 /* Constructors don't have return types. And conversion functions
1004 do not have a type-specifier in their return types. */
1005 if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t))
1006 pp_cxx_function_specifier (pp, t);
1007 else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
1008 pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t)));
1011 pp_c_declaration_specifiers (pp_c_base (pp), t);
1016 /* simple-type-specifier:
1017 ::(opt) nested-name-specifier(opt) type-name
1018 ::(opt) nested-name-specifier(opt) template(opt) template-id
1032 pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t)
1034 switch (TREE_CODE (t))
1039 pp_cxx_qualified_id (pp, t);
1042 case TEMPLATE_TYPE_PARM:
1043 case TEMPLATE_TEMPLATE_PARM:
1044 case TEMPLATE_PARM_INDEX:
1045 pp_cxx_unqualified_id (pp, t);
1049 pp_cxx_identifier (pp, "typename");
1050 pp_cxx_nested_name_specifier (pp, TYPE_CONTEXT (t));
1051 pp_cxx_unqualified_id (pp, TYPE_NAME (t));
1055 pp_c_type_specifier (pp_c_base (pp), t);
1060 /* type-specifier-seq:
1061 type-specifier type-specifier-seq(opt)
1064 simple-type-specifier
1067 elaborated-type-specifier
1071 pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t)
1073 switch (TREE_CODE (t))
1076 case TEMPLATE_TYPE_PARM:
1077 case TEMPLATE_TEMPLATE_PARM:
1079 case BOUND_TEMPLATE_TEMPLATE_PARM:
1080 pp_cxx_cv_qualifier_seq (pp, t);
1081 pp_cxx_simple_type_specifier (pp, t);
1085 pp_cxx_type_specifier_seq (pp, TREE_TYPE (t));
1086 pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (t));
1087 pp_cxx_nested_name_specifier (pp, TYPE_METHOD_BASETYPE (t));
1091 if (!(TREE_CODE (t) == FUNCTION_DECL && DECL_CONSTRUCTOR_P (t)))
1092 pp_c_specifier_qualifier_list (pp_c_base (pp), t);
1097 * cv-qualifier-seq(opt)
1099 ::(opt) nested-name-specifier * cv-qualifier-seq(opt) */
1102 pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t)
1104 if (!TYPE_P (t) && TREE_CODE (t) != TYPE_DECL)
1106 switch (TREE_CODE (t))
1108 case REFERENCE_TYPE:
1110 if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
1111 || TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t)))
1112 pp_cxx_ptr_operator (pp, TREE_TYPE (t));
1113 if (TREE_CODE (t) == POINTER_TYPE)
1116 pp_cxx_cv_qualifier_seq (pp, t);
1123 if (TYPE_PTRMEMFUNC_P (t))
1125 pp_cxx_left_paren (pp);
1126 pp_cxx_nested_name_specifier (pp, TYPE_PTRMEMFUNC_OBJECT_TYPE (t));
1131 if (TYPE_PTR_TO_MEMBER_P (t))
1133 if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
1134 pp_cxx_left_paren (pp);
1135 pp_cxx_nested_name_specifier (pp, TYPE_PTRMEM_CLASS_TYPE (t));
1137 pp_cxx_cv_qualifier_seq (pp, t);
1140 /* else fall through. */
1143 pp_unsupported_tree (pp, t);
1149 pp_cxx_implicit_parameter_type (tree mf)
1151 return TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (mf))));
1155 parameter-declaration:
1156 decl-specifier-seq declarator
1157 decl-specifier-seq declarator = assignment-expression
1158 decl-specifier-seq abstract-declarator(opt)
1159 decl-specifier-seq abstract-declarator(opt) assignment-expression */
1162 pp_cxx_parameter_declaration (cxx_pretty_printer *pp, tree t)
1164 pp_cxx_decl_specifier_seq (pp, t);
1166 pp_cxx_abstract_declarator (pp, t);
1168 pp_cxx_declarator (pp, t);
1171 /* parameter-declaration-clause:
1172 parameter-declaration-list(opt) ...(opt)
1173 parameter-declaration-list , ...
1175 parameter-declaration-list:
1176 parameter-declaration
1177 parameter-declaration-list , parameter-declaration */
1180 pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t)
1182 tree args = TYPE_P (t) ? NULL : FUNCTION_FIRST_USER_PARM (t);
1184 TYPE_P (t) ? TYPE_ARG_TYPES (t) : FUNCTION_FIRST_USER_PARMTYPE (t);
1185 const bool abstract = args == NULL
1186 || pp_c_base (pp)->flags & pp_c_flag_abstract;
1189 /* Skip artificial parameter for nonstatic member functions. */
1190 if (TREE_CODE (t) == METHOD_TYPE)
1191 types = TREE_CHAIN (types);
1193 pp_cxx_left_paren (pp);
1194 for (; args; args = TREE_CHAIN (args), types = TREE_CHAIN (types))
1197 pp_cxx_separate_with (pp, ',');
1199 pp_cxx_parameter_declaration (pp, abstract ? TREE_VALUE (types) : args);
1200 if (!abstract && pp_c_base (pp)->flags & pp_cxx_flag_default_argument)
1202 pp_cxx_whitespace (pp);
1204 pp_cxx_whitespace (pp);
1205 pp_cxx_assignment_expression (pp, TREE_PURPOSE (types));
1208 pp_cxx_right_paren (pp);
1211 /* exception-specification:
1212 throw ( type-id-list(opt) )
1216 type-id-list , type-id */
1219 pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
1221 tree ex_spec = TYPE_RAISES_EXCEPTIONS (t);
1223 if (!TYPE_NOTHROW_P (t) && ex_spec == NULL)
1225 pp_cxx_identifier (pp, "throw");
1226 pp_cxx_left_paren (pp);
1227 for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec))
1229 pp_cxx_type_id (pp, TREE_VALUE (ex_spec));
1230 if (TREE_CHAIN (ex_spec))
1231 pp_cxx_separate_with (pp, ',');
1233 pp_cxx_right_paren (pp);
1236 /* direct-declarator:
1238 direct-declarator ( parameter-declaration-clause ) cv-qualifier-seq(opt)
1239 exception-specification(opt)
1240 direct-declaration [ constant-expression(opt) ]
1244 pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
1246 switch (TREE_CODE (t))
1254 pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (t));
1255 pp_cxx_id_expression (pp, DECL_NAME (t));
1257 pp_cxx_abstract_declarator (pp, TREE_TYPE (t));
1261 pp_cxx_space_for_pointer_operator (pp, TREE_TYPE (TREE_TYPE (t)));
1262 pp_cxx_id_expression (pp, t);
1263 pp_cxx_parameter_declaration_clause (pp, t);
1265 if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
1267 pp_base (pp)->padding = pp_before;
1268 pp_cxx_cv_qualifier_seq (pp, pp_cxx_implicit_parameter_type (t));
1271 pp_cxx_exception_specification (pp, TREE_TYPE (t));
1276 case TEMPLATE_TYPE_PARM:
1277 case TEMPLATE_PARM_INDEX:
1278 case TEMPLATE_TEMPLATE_PARM:
1282 pp_c_direct_declarator (pp_c_base (pp), t);
1289 ptr-operator declarator */
1292 pp_cxx_declarator (cxx_pretty_printer *pp, tree t)
1294 pp_cxx_direct_declarator (pp, t);
1297 /* ctor-initializer:
1298 : mem-initializer-list
1300 mem-initializer-list:
1302 mem-initializer , mem-initializer-list
1305 mem-initializer-id ( expression-list(opt) )
1308 ::(opt) nested-name-specifier(opt) class-name
1312 pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
1314 t = TREE_OPERAND (t, 0);
1315 pp_cxx_whitespace (pp);
1317 pp_cxx_whitespace (pp);
1318 for (; t; t = TREE_CHAIN (t))
1320 pp_cxx_primary_expression (pp, TREE_PURPOSE (t));
1321 pp_cxx_call_argument_list (pp, TREE_VALUE (t));
1323 pp_cxx_separate_with (pp, ',');
1327 /* function-definition:
1328 decl-specifier-seq(opt) declarator ctor-initializer(opt) function-body
1329 decl-specifier-seq(opt) declarator function-try-block */
1332 pp_cxx_function_definition (cxx_pretty_printer *pp, tree t)
1334 tree saved_scope = pp->enclosing_scope;
1335 pp_cxx_decl_specifier_seq (pp, t);
1336 pp_cxx_declarator (pp, t);
1337 pp_needs_newline (pp) = true;
1338 pp->enclosing_scope = DECL_CONTEXT (t);
1339 if (DECL_SAVED_TREE (t))
1340 pp_cxx_statement (pp, DECL_SAVED_TREE (t));
1343 pp_cxx_semicolon (pp);
1344 pp_needs_newline (pp) = true;
1347 pp->enclosing_scope = saved_scope;
1350 /* abstract-declarator:
1351 ptr-operator abstract-declarator(opt)
1352 direct-abstract-declarator */
1355 pp_cxx_abstract_declarator (cxx_pretty_printer *pp, tree t)
1357 if (TYPE_PTRMEM_P (t) || TYPE_PTRMEMFUNC_P (t))
1358 pp_cxx_right_paren (pp);
1359 else if (POINTER_TYPE_P (t))
1361 if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
1362 || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
1363 pp_cxx_right_paren (pp);
1366 pp_cxx_direct_abstract_declarator (pp, t);
1369 /* direct-abstract-declarator:
1370 direct-abstract-declarator(opt) ( parameter-declaration-clause )
1371 cv-qualifier-seq(opt) exception-specification(opt)
1372 direct-abstract-declarator(opt) [ constant-expression(opt) ]
1373 ( abstract-declarator ) */
1376 pp_cxx_direct_abstract_declarator (cxx_pretty_printer *pp, tree t)
1378 switch (TREE_CODE (t))
1380 case REFERENCE_TYPE:
1381 pp_cxx_abstract_declarator (pp, t);
1385 if (TYPE_PTRMEMFUNC_P (t))
1386 pp_cxx_direct_abstract_declarator (pp, TYPE_PTRMEMFUNC_FN_TYPE (t));
1391 pp_cxx_parameter_declaration_clause (pp, t);
1392 pp_cxx_direct_abstract_declarator (pp, TREE_TYPE (t));
1393 if (TREE_CODE (t) == METHOD_TYPE)
1395 pp_base (pp)->padding = pp_before;
1396 pp_cxx_cv_qualifier_seq
1397 (pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
1399 pp_cxx_exception_specification (pp, t);
1403 case TEMPLATE_TYPE_PARM:
1404 case TEMPLATE_TEMPLATE_PARM:
1405 case BOUND_TEMPLATE_TEMPLATE_PARM:
1406 case UNBOUND_CLASS_TEMPLATE:
1410 pp_c_direct_abstract_declarator (pp_c_base (pp), t);
1416 type-specifier-seq abstract-declarator(opt) */
1419 pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
1421 pp_flags saved_flags = pp_c_base (pp)->flags;
1422 pp_c_base (pp)->flags |= pp_c_flag_abstract;
1424 switch (TREE_CODE (t))
1431 case BOUND_TEMPLATE_TEMPLATE_PARM:
1432 case UNBOUND_CLASS_TEMPLATE:
1433 case TEMPLATE_TEMPLATE_PARM:
1434 case TEMPLATE_TYPE_PARM:
1435 case TEMPLATE_PARM_INDEX:
1438 case TEMPLATE_ID_EXPR:
1439 pp_cxx_type_specifier_seq (pp, t);
1443 pp_c_type_id (pp_c_base (pp), t);
1447 pp_c_base (pp)->flags = saved_flags;
1450 /* template-argument-list:
1452 template-argument-list, template-argument
1455 assignment-expression
1460 pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t)
1465 for (i = 0; i < TREE_VEC_LENGTH (t); ++i)
1467 tree arg = TREE_VEC_ELT (t, i);
1469 pp_cxx_separate_with (pp, ',');
1470 if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL
1471 && TYPE_P (DECL_TEMPLATE_RESULT (arg))))
1472 pp_cxx_type_id (pp, arg);
1474 pp_cxx_expression (pp, arg);
1480 pp_cxx_exception_declaration (cxx_pretty_printer *pp, tree t)
1482 t = DECL_EXPR_DECL (t);
1483 pp_cxx_type_specifier_seq (pp, t);
1485 pp_cxx_abstract_declarator (pp, t);
1487 pp_cxx_declarator (pp, t);
1493 pp_cxx_statement (cxx_pretty_printer *pp, tree t)
1495 switch (TREE_CODE (t))
1497 case CTOR_INITIALIZER:
1498 pp_cxx_ctor_initializer (pp, t);
1502 pp_cxx_identifier (pp, "using");
1503 pp_cxx_identifier (pp, "namespace");
1504 pp_cxx_qualified_id (pp, USING_STMT_NAMESPACE (t));
1508 pp_cxx_identifier (pp, "using");
1509 pp_cxx_nested_name_specifier (pp, DECL_INITIAL (t));
1510 pp_cxx_unqualified_id (pp, DECL_NAME (t));
1517 try compound-statement handler-seq */
1519 pp_maybe_newline_and_indent (pp, 0);
1520 pp_cxx_identifier (pp, "try");
1521 pp_newline_and_indent (pp, 3);
1522 pp_cxx_statement (pp, TRY_STMTS (t));
1523 pp_newline_and_indent (pp, -3);
1527 pp_cxx_statement (pp, TRY_HANDLERS (t));
1532 handler handler-seq(opt)
1535 catch ( exception-declaration ) compound-statement
1537 exception-declaration:
1538 type-specifier-seq declarator
1539 type-specifier-seq abstract-declarator
1542 pp_cxx_identifier (pp, "catch");
1543 pp_cxx_left_paren (pp);
1544 pp_cxx_exception_declaration (pp, HANDLER_PARMS (t));
1545 pp_cxx_right_paren (pp);
1546 pp_indentation (pp) += 3;
1547 pp_needs_newline (pp) = true;
1548 pp_cxx_statement (pp, HANDLER_BODY (t));
1549 pp_indentation (pp) -= 3;
1550 pp_needs_newline (pp) = true;
1553 /* selection-statement:
1554 if ( expression ) statement
1555 if ( expression ) statement else statement */
1557 pp_cxx_identifier (pp, "if");
1558 pp_cxx_whitespace (pp);
1559 pp_cxx_left_paren (pp);
1560 pp_cxx_expression (pp, IF_COND (t));
1561 pp_cxx_right_paren (pp);
1562 pp_newline_and_indent (pp, 2);
1563 pp_cxx_statement (pp, THEN_CLAUSE (t));
1564 pp_newline_and_indent (pp, -2);
1565 if (ELSE_CLAUSE (t))
1567 tree else_clause = ELSE_CLAUSE (t);
1568 pp_cxx_identifier (pp, "else");
1569 if (TREE_CODE (else_clause) == IF_STMT)
1570 pp_cxx_whitespace (pp);
1572 pp_newline_and_indent (pp, 2);
1573 pp_cxx_statement (pp, else_clause);
1574 if (TREE_CODE (else_clause) != IF_STMT)
1575 pp_newline_and_indent (pp, -2);
1580 pp_cxx_identifier (pp, "switch");
1582 pp_cxx_left_paren (pp);
1583 pp_expression (pp, SWITCH_STMT_COND (t));
1584 pp_cxx_right_paren (pp);
1585 pp_indentation (pp) += 3;
1586 pp_needs_newline (pp) = true;
1587 pp_statement (pp, SWITCH_STMT_BODY (t));
1588 pp_newline_and_indent (pp, -3);
1591 /* iteration-statement:
1592 while ( expression ) statement
1593 do statement while ( expression ) ;
1594 for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
1595 for ( declaration expression(opt) ; expression(opt) ) statement */
1597 pp_cxx_identifier (pp, "while");
1599 pp_cxx_left_paren (pp);
1600 pp_expression (pp, WHILE_COND (t));
1601 pp_cxx_right_paren (pp);
1602 pp_newline_and_indent (pp, 3);
1603 pp_statement (pp, WHILE_BODY (t));
1604 pp_indentation (pp) -= 3;
1605 pp_needs_newline (pp) = true;
1609 pp_cxx_identifier (pp, "do");
1610 pp_newline_and_indent (pp, 3);
1611 pp_statement (pp, DO_BODY (t));
1612 pp_newline_and_indent (pp, -3);
1613 pp_cxx_identifier (pp, "while");
1615 pp_cxx_left_paren (pp);
1616 pp_expression (pp, DO_COND (t));
1617 pp_cxx_right_paren (pp);
1618 pp_cxx_semicolon (pp);
1619 pp_needs_newline (pp) = true;
1623 pp_cxx_identifier (pp, "for");
1625 pp_cxx_left_paren (pp);
1626 if (FOR_INIT_STMT (t))
1627 pp_statement (pp, FOR_INIT_STMT (t));
1629 pp_cxx_semicolon (pp);
1630 pp_needs_newline (pp) = false;
1631 pp_cxx_whitespace (pp);
1633 pp_expression (pp, FOR_COND (t));
1634 pp_cxx_semicolon (pp);
1635 pp_needs_newline (pp) = false;
1636 pp_cxx_whitespace (pp);
1638 pp_expression (pp, FOR_EXPR (t));
1639 pp_cxx_right_paren (pp);
1640 pp_newline_and_indent (pp, 3);
1641 pp_statement (pp, FOR_BODY (t));
1642 pp_indentation (pp) -= 3;
1643 pp_needs_newline (pp) = true;
1649 return expression(opt) ; */
1652 pp_identifier (pp, TREE_CODE (t) == BREAK_STMT ? "break" : "continue");
1653 pp_cxx_semicolon (pp);
1654 pp_needs_newline (pp) = true;
1658 pp_cxx_identifier (pp, "try");
1659 pp_newline_and_indent (pp, 2);
1660 pp_cxx_statement (pp, CLEANUP_BODY (t));
1661 pp_newline_and_indent (pp, -2);
1662 pp_cxx_identifier (pp, CLEANUP_EH_ONLY (t) ? "catch" : "finally");
1663 pp_newline_and_indent (pp, 2);
1664 pp_cxx_statement (pp, CLEANUP_EXPR (t));
1665 pp_newline_and_indent (pp, -2);
1669 pp_c_statement (pp_c_base (pp), t);
1674 /* original-namespace-definition:
1675 namespace identifier { namespace-body }
1677 As an edge case, we also handle unnamed namespace definition here. */
1680 pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
1682 pp_cxx_identifier (pp, "namespace");
1684 pp_cxx_unqualified_id (pp, t);
1685 pp_cxx_whitespace (pp);
1686 pp_cxx_left_brace (pp);
1687 /* We do not print the namespace-body. */
1688 pp_cxx_whitespace (pp);
1689 pp_cxx_right_brace (pp);
1695 namespace-alias-definition:
1696 namespace identifier = qualified-namespace-specifier ;
1698 qualified-namespace-specifier:
1699 ::(opt) nested-name-specifier(opt) namespace-name */
1702 pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t)
1704 pp_cxx_identifier (pp, "namespace");
1705 pp_cxx_unqualified_id (pp, t);
1706 pp_cxx_whitespace (pp);
1708 pp_cxx_whitespace (pp);
1709 pp_cxx_qualified_id (pp, DECL_NAMESPACE_ALIAS (t));
1710 pp_cxx_semicolon (pp);
1713 /* simple-declaration:
1714 decl-specifier-seq(opt) init-declarator-list(opt) */
1717 pp_cxx_simple_declaration (cxx_pretty_printer *pp, tree t)
1719 pp_cxx_decl_specifier_seq (pp, t);
1720 pp_cxx_init_declarator (pp, t);
1721 pp_cxx_semicolon (pp);
1722 pp_needs_newline (pp) = true;
1726 template-parameter-list:
1728 template-parameter-list , template-parameter */
1731 pp_cxx_template_parameter_list (cxx_pretty_printer *pp, tree t)
1733 const int n = TREE_VEC_LENGTH (t);
1735 for (i = 0; i < n; ++i)
1738 pp_cxx_separate_with (pp, ',');
1739 pp_cxx_template_parameter (pp, TREE_VEC_ELT (t, i));
1743 /* template-parameter:
1745 parameter-declaration
1748 class identifier(opt)
1749 class identifier(op) = type-id
1750 typename identifier(opt)
1751 typename identifier(opt) = type-id
1752 template < template-parameter-list > class identifier(opt)
1753 template < template-parameter-list > class identifier(opt) = template-name
1757 pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
1759 tree parameter = TREE_VALUE (t);
1760 switch (TREE_CODE (parameter))
1763 pp_cxx_identifier (pp, "class");
1764 if (DECL_NAME (parameter))
1765 pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
1766 /* FIXME: Chech if we should print also default argument. */
1770 pp_cxx_parameter_declaration (pp, parameter);
1777 pp_unsupported_tree (pp, t);
1782 /* Pretty-print a template parameter in the canonical form
1783 "template-parameter-<level>-<position in parameter list>". */
1786 pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm)
1788 const enum tree_code code = TREE_CODE (parm);
1790 /* Brings type template parameters to the canonical forms. */
1791 if (code == TEMPLATE_TYPE_PARM || code == TEMPLATE_TEMPLATE_PARM
1792 || code == BOUND_TEMPLATE_TEMPLATE_PARM)
1793 parm = TEMPLATE_TYPE_PARM_INDEX (parm);
1795 pp_cxx_begin_template_argument_list (pp);
1796 pp_cxx_identifier (pp, "template-parameter-");
1797 pp_wide_integer (pp, TEMPLATE_PARM_LEVEL (parm));
1799 pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1);
1800 pp_cxx_end_template_argument_list (pp);
1804 template-declaration:
1805 export(opt) template < template-parameter-list > declaration */
1808 pp_cxx_template_declaration (cxx_pretty_printer *pp, tree t)
1810 tree tmpl = most_general_template (t);
1814 pp_maybe_newline_and_indent (pp, 0);
1815 for (level = DECL_TEMPLATE_PARMS (tmpl); level; level = TREE_CHAIN (level))
1817 pp_cxx_identifier (pp, "template");
1818 pp_cxx_begin_template_argument_list (pp);
1819 pp_cxx_template_parameter_list (pp, TREE_VALUE (level));
1820 pp_cxx_end_template_argument_list (pp);
1821 pp_newline_and_indent (pp, 3);
1824 if (TREE_CODE (t) == FUNCTION_DECL && DECL_SAVED_TREE (t))
1825 pp_cxx_function_definition (pp, t);
1827 pp_cxx_simple_declaration (pp, t);
1831 pp_cxx_explicit_specialization (cxx_pretty_printer *pp, tree t)
1833 pp_unsupported_tree (pp, t);
1837 pp_cxx_explicit_instantiation (cxx_pretty_printer *pp, tree t)
1839 pp_unsupported_tree (pp, t);
1846 template-declaration
1847 explicit-instantiation
1848 explicit-specialization
1849 linkage-specification
1850 namespace-definition
1855 namespace-alias-definition
1859 pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
1861 if (!DECL_LANG_SPECIFIC (t))
1862 pp_cxx_simple_declaration (pp, t);
1863 else if (DECL_USE_TEMPLATE (t))
1864 switch (DECL_USE_TEMPLATE (t))
1867 pp_cxx_template_declaration (pp, t);
1871 pp_cxx_explicit_specialization (pp, t);
1875 pp_cxx_explicit_instantiation (pp, t);
1881 else switch (TREE_CODE (t))
1885 pp_cxx_simple_declaration (pp, t);
1889 if (DECL_SAVED_TREE (t))
1890 pp_cxx_function_definition (pp, t);
1892 pp_cxx_simple_declaration (pp, t);
1895 case NAMESPACE_DECL:
1896 if (DECL_NAMESPACE_ALIAS (t))
1897 pp_cxx_namespace_alias_definition (pp, t);
1899 pp_cxx_original_namespace_definition (pp, t);
1903 pp_unsupported_tree (pp, t);
1909 typedef c_pretty_print_fn pp_fun;
1911 /* Initialization of a C++ pretty-printer object. */
1914 pp_cxx_pretty_printer_init (cxx_pretty_printer *pp)
1916 pp_c_pretty_printer_init (pp_c_base (pp));
1917 pp_set_line_maximum_length (pp, 0);
1919 pp->c_base.declaration = (pp_fun) pp_cxx_declaration;
1920 pp->c_base.declaration_specifiers = (pp_fun) pp_cxx_decl_specifier_seq;
1921 pp->c_base.function_specifier = (pp_fun) pp_cxx_function_specifier;
1922 pp->c_base.type_specifier_seq = (pp_fun) pp_cxx_type_specifier_seq;
1923 pp->c_base.declarator = (pp_fun) pp_cxx_declarator;
1924 pp->c_base.direct_declarator = (pp_fun) pp_cxx_direct_declarator;
1925 pp->c_base.parameter_list = (pp_fun) pp_cxx_parameter_declaration_clause;
1926 pp->c_base.type_id = (pp_fun) pp_cxx_type_id;
1927 pp->c_base.abstract_declarator = (pp_fun) pp_cxx_abstract_declarator;
1928 pp->c_base.direct_abstract_declarator =
1929 (pp_fun) pp_cxx_direct_abstract_declarator;
1930 pp->c_base.simple_type_specifier = (pp_fun)pp_cxx_simple_type_specifier;
1932 /* pp->c_base.statement = (pp_fun) pp_cxx_statement; */
1934 pp->c_base.id_expression = (pp_fun) pp_cxx_id_expression;
1935 pp->c_base.primary_expression = (pp_fun) pp_cxx_primary_expression;
1936 pp->c_base.postfix_expression = (pp_fun) pp_cxx_postfix_expression;
1937 pp->c_base.unary_expression = (pp_fun) pp_cxx_unary_expression;
1938 pp->c_base.multiplicative_expression = (pp_fun) pp_cxx_multiplicative_expression;
1939 pp->c_base.conditional_expression = (pp_fun) pp_cxx_conditional_expression;
1940 pp->c_base.assignment_expression = (pp_fun) pp_cxx_assignment_expression;
1941 pp->c_base.expression = (pp_fun) pp_cxx_expression;
1942 pp->enclosing_scope = global_namespace;