1 /* Implementation of subroutines for the GNU C++ pretty-printer.
2 Copyright (C) 2003, 2004 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_template_parameter (cxx_pretty_printer
*, tree
);
48 pp_cxx_nonconsecutive_character (cxx_pretty_printer
*pp
, int c
)
50 const char *p
= pp_last_position_in_text (pp
);
52 if (p
!= NULL
&& *p
== c
)
53 pp_cxx_whitespace (pp
);
55 pp_base (pp
)->padding
= pp_none
;
58 #define pp_cxx_storage_class_specifier(PP, T) \
59 pp_c_storage_class_specifier (pp_c_base (PP), T)
60 #define pp_cxx_expression_list(PP, T) \
61 pp_c_expression_list (pp_c_base (PP), T)
62 #define pp_cxx_space_for_pointer_operator(PP, T) \
63 pp_c_space_for_pointer_operator (pp_c_base (PP), T)
64 #define pp_cxx_init_declarator(PP, T) \
65 pp_c_init_declarator (pp_c_base (PP), T)
66 #define pp_cxx_call_argument_list(PP, T) \
67 pp_c_call_argument_list (pp_c_base (PP), T)
70 pp_cxx_colon_colon (cxx_pretty_printer
*pp
)
73 pp_base (pp
)->padding
= pp_none
;
77 pp_cxx_begin_template_argument_list (cxx_pretty_printer
*pp
)
79 pp_cxx_nonconsecutive_character (pp
, '<');
83 pp_cxx_end_template_argument_list (cxx_pretty_printer
*pp
)
85 pp_cxx_nonconsecutive_character (pp
, '>');
89 pp_cxx_separate_with (cxx_pretty_printer
*pp
, int c
)
91 pp_separate_with (pp
, c
);
92 pp_base (pp
)->padding
= pp_none
;
98 is_destructor_name (tree name
)
100 return name
== complete_dtor_identifier
101 || name
== base_dtor_identifier
102 || name
== deleting_dtor_identifier
;
105 /* conversion-function-id:
106 operator conversion-type-id
109 type-specifier-seq conversion-declarator(opt)
111 conversion-declarator:
112 ptr-operator conversion-declarator(opt) */
115 pp_cxx_conversion_function_id (cxx_pretty_printer
*pp
, tree t
)
117 pp_cxx_identifier (pp
, "operator");
118 pp_cxx_type_specifier_seq (pp
, TREE_TYPE (t
));
122 pp_cxx_template_id (cxx_pretty_printer
*pp
, tree t
)
124 pp_cxx_unqualified_id (pp
, TREE_OPERAND (t
, 0));
125 pp_cxx_begin_template_argument_list (pp
);
126 pp_cxx_template_argument_list (pp
, TREE_OPERAND (t
, 1));
127 pp_cxx_end_template_argument_list (pp
);
133 conversion-function-id
138 pp_cxx_unqualified_id (cxx_pretty_printer
*pp
, tree t
)
140 enum tree_code code
= TREE_CODE (t
);
144 pp_cxx_identifier (pp
, "<return-value>");
161 case IDENTIFIER_NODE
:
163 pp_cxx_identifier (pp
, "<unnamed>");
164 else if (IDENTIFIER_TYPENAME_P (t
))
165 pp_cxx_conversion_function_id (pp
, t
);
168 if (is_destructor_name (t
))
171 /* FIXME: Why is this necessary? */
173 t
= constructor_name (TREE_TYPE (t
));
175 pp_cxx_tree_identifier (pp
, t
);
179 case TEMPLATE_ID_EXPR
:
180 pp_cxx_template_id (pp
, t
);
184 pp_cxx_unqualified_id (pp
, BASELINK_FUNCTIONS (t
));
190 pp_cxx_unqualified_id (pp
, TYPE_NAME (t
));
193 case TEMPLATE_TYPE_PARM
:
194 case TEMPLATE_TEMPLATE_PARM
:
195 if (TYPE_IDENTIFIER (t
))
196 pp_cxx_unqualified_id (pp
, TYPE_IDENTIFIER (t
));
198 pp_cxx_canonical_template_parameter (pp
, t
);
201 case TEMPLATE_PARM_INDEX
:
202 pp_cxx_unqualified_id (pp
, TEMPLATE_PARM_DECL (t
));
206 pp_unsupported_tree (pp
, t
);
211 /* Pretty-print out the token sequence ":: template" in template codes
212 where it is needed to "inline declare" the (following) member as
213 a template. This situation arises when SCOPE of T is dependent
214 on template parameters. */
217 pp_cxx_template_keyword_if_needed (cxx_pretty_printer
*pp
, tree scope
, tree t
)
219 if (TREE_CODE (t
) == TEMPLATE_ID_EXPR
220 && TYPE_P (scope
) && dependent_type_p (scope
))
221 pp_cxx_identifier (pp
, "template");
224 /* nested-name-specifier:
225 class-or-namespace-name :: nested-name-specifier(opt)
226 class-or-namespace-name :: template nested-name-specifier */
229 pp_cxx_nested_name_specifier (cxx_pretty_printer
*pp
, tree t
)
231 if (t
!= NULL
&& t
!= pp
->enclosing_scope
)
233 tree scope
= TYPE_P (t
) ? TYPE_CONTEXT (t
) : DECL_CONTEXT (t
);
234 pp_cxx_nested_name_specifier (pp
, scope
);
235 pp_cxx_template_keyword_if_needed (pp
, scope
, t
);
236 pp_cxx_unqualified_id (pp
, t
);
237 pp_cxx_colon_colon (pp
);
242 nested-name-specifier template(opt) unqualified-id */
245 pp_cxx_qualified_id (cxx_pretty_printer
*pp
, tree t
)
247 switch (TREE_CODE (t
))
249 /* A pointer-to-member is always qualified. */
251 pp_cxx_nested_name_specifier (pp
, PTRMEM_CST_CLASS (t
));
252 pp_cxx_unqualified_id (pp
, PTRMEM_CST_MEMBER (t
));
255 /* In Standard C++, functions cannot possibly be used as
256 nested-name-specifiers. However, there are situations where
257 is "makes sense" to output the surrounding function name for the
258 purpose of emphasizing on the scope kind. Just printing the
259 function name might not be sufficient as it may be overloaded; so,
260 we decorate the function with its signature too.
261 FIXME: This is probably the wrong pretty-printing for conversion
262 functions and some function templates. */
266 if (DECL_FUNCTION_MEMBER_P (t
))
267 pp_cxx_nested_name_specifier (pp
, DECL_CONTEXT (t
));
268 pp_cxx_unqualified_id
269 (pp
, DECL_CONSTRUCTOR_P (t
) ? DECL_CONTEXT (t
) : t
);
270 pp_cxx_parameter_declaration_clause (pp
, TREE_TYPE (t
));
275 pp_cxx_nested_name_specifier (pp
, TREE_OPERAND (t
, 0));
276 pp_cxx_unqualified_id (pp
, TREE_OPERAND (t
, 1));
281 tree scope
= TYPE_P (t
) ? TYPE_CONTEXT (t
) : DECL_CONTEXT (t
);
282 if (scope
!= pp
->enclosing_scope
)
284 pp_cxx_nested_name_specifier (pp
, scope
);
285 pp_cxx_template_keyword_if_needed (pp
, scope
, t
);
287 pp_cxx_unqualified_id (pp
, t
);
298 pp_cxx_id_expression (cxx_pretty_printer
*pp
, tree t
)
300 if (TREE_CODE (t
) == OVERLOAD
)
302 if (DECL_P (t
) && DECL_CONTEXT (t
))
303 pp_cxx_qualified_id (pp
, t
);
305 pp_cxx_unqualified_id (pp
, t
);
308 /* primary-expression:
312 :: operator-function-id
318 pp_cxx_primary_expression (cxx_pretty_printer
*pp
, tree t
)
320 switch (TREE_CODE (t
))
325 pp_c_constant (pp_c_base (pp
), t
);
329 t
= BASELINK_FUNCTIONS (t
);
337 pp_cxx_id_expression (pp
, t
);
341 case TEMPLATE_TYPE_PARM
:
342 case TEMPLATE_TEMPLATE_PARM
:
343 case TEMPLATE_PARM_INDEX
:
344 pp_cxx_unqualified_id (pp
, t
);
348 pp_c_primary_expression (pp_c_base (pp
), t
);
353 /* postfix-expression:
355 postfix-expression [ expression ]
356 postfix-expression ( expression-list(opt) )
357 simple-type-specifier ( expression-list(opt) )
358 typename ::(opt) nested-name-specifier identifier ( expression-list(opt) )
359 typename ::(opt) nested-name-specifier template(opt)
360 template-id ( expression-list(opt) )
361 postfix-expression . template(opt) ::(opt) id-expression
362 postfix-expression -> template(opt) ::(opt) id-expression
363 postfix-expression . pseudo-destructor-name
364 postfix-expression -> pseudo-destructor-name
365 postfix-expression ++
366 postfix-expression --
367 dynamic_cast < type-id > ( expression )
368 static_cast < type-id > ( expression )
369 reinterpret_cast < type-id > ( expression )
370 const_cast < type-id > ( expression )
371 typeid ( expression )
372 typeif ( type-id ) */
375 pp_cxx_postfix_expression (cxx_pretty_printer
*pp
, tree t
)
377 enum tree_code code
= TREE_CODE (t
);
384 tree fun
= TREE_OPERAND (t
, 0);
385 tree args
= TREE_OPERAND (t
, 1);
386 tree saved_scope
= pp
->enclosing_scope
;
388 if (TREE_CODE (fun
) == ADDR_EXPR
)
389 fun
= TREE_OPERAND (fun
, 0);
391 /* In templates, where there is no way to tell whether a given
392 call uses an actual member function. So the parser builds
393 FUN as a COMPONENT_REF or a plain IDENTIFIER_NODE until
394 instantiation time. */
395 if (TREE_CODE (fun
) != FUNCTION_DECL
)
397 else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun
))
399 tree object
= code
== AGGR_INIT_EXPR
&& AGGR_INIT_VIA_CTOR_P (t
)
400 ? TREE_OPERAND (t
, 2)
403 while (TREE_CODE (object
) == NOP_EXPR
)
404 object
= TREE_OPERAND (object
, 0);
406 if (TREE_CODE (object
) == ADDR_EXPR
)
407 object
= TREE_OPERAND (object
, 0);
409 if (TREE_CODE (TREE_TYPE (object
)) != POINTER_TYPE
)
411 pp_cxx_postfix_expression (pp
, object
);
416 pp_cxx_postfix_expression (pp
, object
);
419 args
= TREE_CHAIN (args
);
420 pp
->enclosing_scope
= strip_pointer_operator (TREE_TYPE (object
));
423 pp_cxx_postfix_expression (pp
, fun
);
424 pp
->enclosing_scope
= saved_scope
;
425 pp_cxx_call_argument_list (pp
, args
);
427 if (code
== AGGR_INIT_EXPR
&& AGGR_INIT_VIA_CTOR_P (t
))
429 pp_cxx_separate_with (pp
, ',');
430 pp_cxx_postfix_expression (pp
, TREE_OPERAND (t
, 2));
443 pp_cxx_primary_expression (pp
, t
);
446 case DYNAMIC_CAST_EXPR
:
447 case STATIC_CAST_EXPR
:
448 case REINTERPRET_CAST_EXPR
:
449 case CONST_CAST_EXPR
:
450 if (code
== DYNAMIC_CAST_EXPR
)
451 pp_cxx_identifier (pp
, "dynamic_cast");
452 else if (code
== STATIC_CAST_EXPR
)
453 pp_cxx_identifier (pp
, "static_cast");
454 else if (code
== REINTERPRET_CAST_EXPR
)
455 pp_cxx_identifier (pp
, "reinterpret_cast");
457 pp_cxx_identifier (pp
, "const_cast");
458 pp_cxx_begin_template_argument_list (pp
);
459 pp_cxx_type_id (pp
, TREE_TYPE (t
));
460 pp_cxx_end_template_argument_list (pp
);
462 pp_cxx_expression (pp
, TREE_OPERAND (t
, 0));
466 case EMPTY_CLASS_EXPR
:
467 pp_cxx_type_id (pp
, TREE_TYPE (t
));
473 t
= TREE_OPERAND (t
, 0);
474 pp_cxx_identifier (pp
, "typeid");
477 pp_cxx_type_id (pp
, t
);
479 pp_cxx_expression (pp
, t
);
483 case PSEUDO_DTOR_EXPR
:
484 pp_cxx_postfix_expression (pp
, TREE_OPERAND (t
, 0));
486 pp_cxx_qualified_id (pp
, TREE_OPERAND (t
, 1));
487 pp_cxx_colon_colon (pp
);
489 pp_cxx_unqualified_id (pp
, TREE_OPERAND (t
, 2));
493 pp_c_postfix_expression (pp_c_base (pp
), t
);
499 ::(opt) new new-placement(opt) new-type-id new-initializer(opt)
500 ::(opt) new new-placement(opt) ( type-id ) new-initializer(opt)
506 type-specifier-seq new-declarator(opt)
509 ptr-operator new-declarator(opt)
510 direct-new-declarator
512 direct-new-declarator
514 direct-new-declarator [ constant-expression ]
517 ( expression-list(opt) ) */
520 pp_cxx_new_expression (cxx_pretty_printer
*pp
, tree t
)
522 enum tree_code code
= TREE_CODE (t
);
527 if (NEW_EXPR_USE_GLOBAL (t
))
528 pp_cxx_colon_colon (pp
);
529 pp_cxx_identifier (pp
, "new");
530 if (TREE_OPERAND (t
, 0))
532 pp_cxx_call_argument_list (pp
, TREE_OPERAND (t
, 0));
535 /* FIXME: array-types are built with one more element. */
536 pp_cxx_type_id (pp
, TREE_OPERAND (t
, 1));
537 if (TREE_OPERAND (t
, 2))
540 t
= TREE_OPERAND (t
, 2);
541 if (TREE_CODE (t
) == TREE_LIST
)
542 pp_c_expression_list (pp_c_base (pp
), t
);
543 else if (t
== void_zero_node
)
544 ; /* OK, empty initializer list. */
546 pp_cxx_expression (pp
, t
);
552 pp_unsupported_tree (pp
, t
);
556 /* delete-expression:
557 ::(opt) delete cast-expression
558 ::(opt) delete [ ] cast-expression */
561 pp_cxx_delete_expression (cxx_pretty_printer
*pp
, tree t
)
563 enum tree_code code
= TREE_CODE (t
);
567 case VEC_DELETE_EXPR
:
568 if (DELETE_EXPR_USE_GLOBAL (t
))
569 pp_cxx_colon_colon (pp
);
570 pp_cxx_identifier (pp
, "delete");
571 if (code
== VEC_DELETE_EXPR
)
573 pp_left_bracket (pp
);
574 pp_right_bracket (pp
);
576 pp_c_cast_expression (pp_c_base (pp
), TREE_OPERAND (t
, 0));
580 pp_unsupported_tree (pp
, t
);
588 unary-operator cast-expression
589 sizeof unary-expression
594 unary-operator: one of
598 __alignof__ unary-expression
599 __alignof__ ( type-id ) */
602 pp_cxx_unary_expression (cxx_pretty_printer
*pp
, tree t
)
604 enum tree_code code
= TREE_CODE (t
);
609 pp_cxx_new_expression (pp
, t
);
613 case VEC_DELETE_EXPR
:
614 pp_cxx_delete_expression (pp
, t
);
618 pp_c_unary_expression (pp_c_base (pp
), t
);
625 ( type-id ) cast-expression */
628 pp_cxx_cast_expression (cxx_pretty_printer
*pp
, tree t
)
630 switch (TREE_CODE (t
))
633 pp_cxx_type_id (pp
, TREE_TYPE (t
));
634 pp_cxx_call_argument_list (pp
, TREE_OPERAND (t
, 0));
638 pp_c_cast_expression (pp_c_base (pp
), t
);
645 pm-expression .* cast-expression
646 pm-expression ->* cast-expression */
649 pp_cxx_pm_expression (cxx_pretty_printer
*pp
, tree t
)
651 switch (TREE_CODE (t
))
653 /* Handle unfortunate OFFESET_REF overloading here. */
655 if (TYPE_P (TREE_OPERAND (t
, 0)))
657 pp_cxx_qualified_id (pp
, t
);
660 /* Else fall through. */
663 pp_cxx_pm_expression (pp
, TREE_OPERAND (t
, 0));
666 pp_cxx_cast_expression (pp
, TREE_OPERAND (t
, 1));
671 pp_cxx_cast_expression (pp
, t
);
676 /* multiplicative-expression:
678 multiplicative-expression * pm-expression
679 multiplicative-expression / pm-expression
680 multiplicative-expression % pm-expression */
683 pp_cxx_multiplicative_expression (cxx_pretty_printer
*pp
, tree e
)
685 enum tree_code code
= TREE_CODE (e
);
691 pp_cxx_multiplicative_expression (pp
, TREE_OPERAND (e
, 0));
693 if (code
== MULT_EXPR
)
695 else if (code
== TRUNC_DIV_EXPR
)
700 pp_cxx_pm_expression (pp
, TREE_OPERAND (e
, 1));
704 pp_cxx_pm_expression (pp
, e
);
709 /* conditional-expression:
710 logical-or-expression
711 logical-or-expression ? expression : assignment-expression */
714 pp_cxx_conditional_expression (cxx_pretty_printer
*pp
, tree e
)
716 if (TREE_CODE (e
) == COND_EXPR
)
718 pp_c_logical_or_expression (pp_c_base (pp
), TREE_OPERAND (e
, 0));
722 pp_cxx_expression (pp
, TREE_OPERAND (e
, 1));
724 pp_cxx_assignment_expression (pp
, TREE_OPERAND (e
, 2));
727 pp_c_logical_or_expression (pp_c_base (pp
), e
);
730 /* Pretty-print a compound assignment operator token as indicated by T. */
733 pp_cxx_assignment_operator (cxx_pretty_printer
*pp
, tree t
)
737 switch (TREE_CODE (t
))
760 op
= tree_code_name
[TREE_CODE (t
)];
764 pp_cxx_identifier (pp
, op
);
768 /* assignment-expression:
769 conditional-expression
770 logical-or-expression assignment-operator assignment-expression
774 throw assignment-expression(opt)
776 assignment-operator: one of
777 = *= /= %= += -= >>= <<= &= ^= |= */
780 pp_cxx_assignment_expression (cxx_pretty_printer
*pp
, tree e
)
782 switch (TREE_CODE (e
))
786 pp_c_logical_or_expression (pp_c_base (pp
), TREE_OPERAND (e
, 0));
790 pp_cxx_assignment_expression (pp
, TREE_OPERAND (e
, 1));
794 pp_cxx_identifier (pp
, "throw");
795 if (TREE_OPERAND (e
, 0))
796 pp_cxx_assignment_expression (pp
, TREE_OPERAND (e
, 0));
800 pp_c_logical_or_expression (pp_c_base (pp
), TREE_OPERAND (e
, 0));
801 pp_cxx_assignment_operator (pp
, TREE_OPERAND (e
, 1));
802 pp_cxx_assignment_expression (pp
, TREE_OPERAND (e
, 2));
806 pp_cxx_conditional_expression (pp
, e
);
812 pp_cxx_expression (cxx_pretty_printer
*pp
, tree t
)
814 switch (TREE_CODE (t
))
819 pp_c_constant (pp_c_base (pp
), t
);
823 pp_cxx_unqualified_id (pp
, t
);
831 pp_cxx_qualified_id (pp
, t
);
843 case TEMPLATE_TYPE_PARM
:
844 case TEMPLATE_PARM_INDEX
:
845 case TEMPLATE_TEMPLATE_PARM
:
846 pp_cxx_primary_expression (pp
, t
);
850 case DYNAMIC_CAST_EXPR
:
851 case STATIC_CAST_EXPR
:
852 case REINTERPRET_CAST_EXPR
:
853 case CONST_CAST_EXPR
:
857 case EMPTY_CLASS_EXPR
:
859 case PSEUDO_DTOR_EXPR
:
861 pp_cxx_postfix_expression (pp
, t
);
866 pp_cxx_new_expression (pp
, t
);
870 case VEC_DELETE_EXPR
:
871 pp_cxx_delete_expression (pp
, t
);
875 pp_cxx_cast_expression (pp
, t
);
881 pp_cxx_pm_expression (pp
, t
);
887 pp_cxx_multiplicative_expression (pp
, t
);
891 pp_cxx_conditional_expression (pp
, t
);
898 pp_cxx_assignment_expression (pp
, t
);
901 case NON_DEPENDENT_EXPR
:
902 case MUST_NOT_THROW_EXPR
:
903 pp_cxx_expression (pp
, t
);
907 pp_c_expression (pp_c_base (pp
), t
);
915 /* function-specifier:
921 pp_cxx_function_specifier (cxx_pretty_printer
*pp
, tree t
)
923 switch (TREE_CODE (t
))
926 if (DECL_VIRTUAL_P (t
))
927 pp_cxx_identifier (pp
, "virtual");
928 else if (DECL_CONSTRUCTOR_P (t
) && DECL_NONCONVERTING_P (t
))
929 pp_cxx_identifier (pp
, "explicit");
931 pp_c_function_specifier (pp_c_base (pp
), t
);
938 /* decl-specifier-seq:
939 decl-specifier-seq(opt) decl-specifier
942 storage-class-specifier
949 pp_cxx_decl_specifier_seq (cxx_pretty_printer
*pp
, tree t
)
951 switch (TREE_CODE (t
))
957 pp_cxx_storage_class_specifier (pp
, t
);
958 pp_cxx_decl_specifier_seq (pp
, TREE_TYPE (t
));
962 pp_cxx_identifier (pp
, "typedef");
963 pp_cxx_decl_specifier_seq (pp
, TREE_TYPE (t
));
967 if (TYPE_PTRMEMFUNC_P (t
))
969 tree pfm
= TYPE_PTRMEMFUNC_FN_TYPE (t
);
970 pp_cxx_decl_specifier_seq (pp
, TREE_TYPE (TREE_TYPE (pfm
)));
971 pp_cxx_whitespace (pp
);
972 pp_cxx_ptr_operator (pp
, t
);
977 /* Constructors don't have return types. And conversion functions
978 do not have a type-specifier in their return types. */
979 if (DECL_CONSTRUCTOR_P (t
) || DECL_CONV_FN_P (t
))
980 pp_cxx_function_specifier (pp
, t
);
981 else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t
))
982 pp_cxx_decl_specifier_seq (pp
, TREE_TYPE (TREE_TYPE (t
)));
985 pp_c_declaration_specifiers (pp_c_base (pp
), t
);
990 /* simple-type-specifier:
991 ::(opt) nested-name-specifier(opt) type-name
992 ::(opt) nested-name-specifier(opt) template(opt) template-id
1006 pp_cxx_simple_type_specifier (cxx_pretty_printer
*pp
, tree t
)
1008 switch (TREE_CODE (t
))
1013 pp_cxx_qualified_id (pp
, t
);
1016 case TEMPLATE_TYPE_PARM
:
1017 case TEMPLATE_TEMPLATE_PARM
:
1018 case TEMPLATE_PARM_INDEX
:
1019 pp_cxx_unqualified_id (pp
, t
);
1023 pp_cxx_identifier (pp
, "typename");
1024 pp_cxx_nested_name_specifier (pp
, TYPE_CONTEXT (t
));
1025 pp_cxx_unqualified_id (pp
, TYPE_NAME (t
));
1029 pp_c_type_specifier (pp_c_base (pp
), t
);
1034 /* type-specifier-seq:
1035 type-specifier type-specifier-seq(opt)
1038 simple-type-specifier
1041 elaborated-type-specifier
1045 pp_cxx_type_specifier_seq (cxx_pretty_printer
*pp
, tree t
)
1047 switch (TREE_CODE (t
))
1050 case TEMPLATE_TYPE_PARM
:
1051 case TEMPLATE_TEMPLATE_PARM
:
1053 case BOUND_TEMPLATE_TEMPLATE_PARM
:
1054 pp_cxx_cv_qualifier_seq (pp
, t
);
1055 pp_cxx_simple_type_specifier (pp
, t
);
1059 pp_cxx_type_specifier_seq (pp
, TREE_TYPE (t
));
1060 pp_cxx_space_for_pointer_operator (pp
, TREE_TYPE (t
));
1061 pp_cxx_nested_name_specifier (pp
, TYPE_METHOD_BASETYPE (t
));
1065 if (!(TREE_CODE (t
) == FUNCTION_DECL
&& DECL_CONSTRUCTOR_P (t
)))
1066 pp_c_specifier_qualifier_list (pp_c_base (pp
), t
);
1071 * cv-qualifier-seq(opt)
1073 ::(opt) nested-name-specifier * cv-qualifier-seq(opt) */
1076 pp_cxx_ptr_operator (cxx_pretty_printer
*pp
, tree t
)
1078 if (!TYPE_P (t
) && TREE_CODE (t
) != TYPE_DECL
)
1080 switch (TREE_CODE (t
))
1082 case REFERENCE_TYPE
:
1084 if (TREE_CODE (TREE_TYPE (t
)) == POINTER_TYPE
1085 || TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t
)))
1086 pp_cxx_ptr_operator (pp
, TREE_TYPE (t
));
1087 if (TREE_CODE (t
) == POINTER_TYPE
)
1090 pp_cxx_cv_qualifier_seq (pp
, t
);
1097 if (TYPE_PTRMEMFUNC_P (t
))
1099 pp_cxx_left_paren (pp
);
1100 pp_cxx_nested_name_specifier (pp
, TYPE_PTRMEMFUNC_OBJECT_TYPE (t
));
1105 if (TYPE_PTR_TO_MEMBER_P (t
))
1107 if (TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
1108 pp_cxx_left_paren (pp
);
1109 pp_cxx_nested_name_specifier (pp
, TYPE_PTRMEM_CLASS_TYPE (t
));
1111 pp_cxx_cv_qualifier_seq (pp
, t
);
1114 /* else fall through. */
1117 pp_unsupported_tree (pp
, t
);
1123 pp_cxx_implicit_parameter_type (tree mf
)
1125 return TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (mf
))));
1129 parameter-declaration:
1130 decl-specifier-seq declarator
1131 decl-specifier-seq declarator = assignment-expression
1132 decl-specifier-seq abstract-declarator(opt)
1133 decl-specifier-seq abstract-declarator(opt) assignment-expression */
1136 pp_cxx_parameter_declaration (cxx_pretty_printer
*pp
, tree t
)
1138 pp_cxx_decl_specifier_seq (pp
, t
);
1140 pp_cxx_abstract_declarator (pp
, t
);
1142 pp_cxx_declarator (pp
, t
);
1145 /* parameter-declaration-clause:
1146 parameter-declaration-list(opt) ...(opt)
1147 parameter-declaration-list , ...
1149 parameter-declaration-list:
1150 parameter-declaration
1151 parameter-declaration-list , parameter-declaration */
1154 pp_cxx_parameter_declaration_clause (cxx_pretty_printer
*pp
, tree t
)
1156 tree args
= TYPE_P (t
) ? NULL
: FUNCTION_FIRST_USER_PARM (t
);
1158 TYPE_P (t
) ? TYPE_ARG_TYPES (t
) : FUNCTION_FIRST_USER_PARMTYPE (t
);
1159 const bool abstract
= args
== NULL
1160 || pp_c_base (pp
)->flags
& pp_c_flag_abstract
;
1163 /* Skip artificial parameter for nonstatic member functions. */
1164 if (TREE_CODE (t
) == METHOD_TYPE
)
1165 types
= TREE_CHAIN (types
);
1167 pp_cxx_left_paren (pp
);
1168 for (; args
; args
= TREE_CHAIN (args
), types
= TREE_CHAIN (types
))
1171 pp_cxx_separate_with (pp
, ',');
1173 pp_cxx_parameter_declaration (pp
, abstract
? TREE_VALUE (types
) : args
);
1174 if (!abstract
&& pp_c_base (pp
)->flags
& pp_cxx_flag_default_argument
)
1176 pp_cxx_whitespace (pp
);
1178 pp_cxx_whitespace (pp
);
1179 pp_cxx_assignment_expression (pp
, TREE_PURPOSE (types
));
1182 pp_cxx_right_paren (pp
);
1185 /* exception-specification:
1186 throw ( type-id-list(opt) )
1190 type-id-list , type-id */
1193 pp_cxx_exception_specification (cxx_pretty_printer
*pp
, tree t
)
1195 tree ex_spec
= TYPE_RAISES_EXCEPTIONS (t
);
1197 if (!TYPE_NOTHROW_P (t
) && ex_spec
== NULL
)
1199 pp_cxx_identifier (pp
, "throw");
1200 pp_cxx_left_paren (pp
);
1201 for (; ex_spec
&& TREE_VALUE (ex_spec
); ex_spec
= TREE_CHAIN (ex_spec
))
1203 pp_cxx_type_id (pp
, TREE_VALUE (ex_spec
));
1204 if (TREE_CHAIN (ex_spec
))
1205 pp_cxx_separate_with (pp
, ',');
1207 pp_cxx_right_paren (pp
);
1210 /* direct-declarator:
1212 direct-declarator ( parameter-declaration-clause ) cv-qualifier-seq(opt)
1213 exception-specification(opt)
1214 direct-declaration [ constant-expression(opt) ]
1218 pp_cxx_direct_declarator (cxx_pretty_printer
*pp
, tree t
)
1220 switch (TREE_CODE (t
))
1228 pp_cxx_space_for_pointer_operator (pp
, TREE_TYPE (t
));
1229 pp_cxx_id_expression (pp
, DECL_NAME (t
));
1231 pp_cxx_abstract_declarator (pp
, TREE_TYPE (t
));
1235 pp_cxx_space_for_pointer_operator (pp
, TREE_TYPE (TREE_TYPE (t
)));
1236 pp_cxx_id_expression (pp
, t
);
1237 pp_cxx_parameter_declaration_clause (pp
, t
);
1239 if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t
))
1241 pp_base (pp
)->padding
= pp_before
;
1242 pp_cxx_cv_qualifier_seq (pp
, pp_cxx_implicit_parameter_type (t
));
1245 pp_cxx_exception_specification (pp
, TREE_TYPE (t
));
1250 case TEMPLATE_TYPE_PARM
:
1251 case TEMPLATE_PARM_INDEX
:
1252 case TEMPLATE_TEMPLATE_PARM
:
1256 pp_c_direct_declarator (pp_c_base (pp
), t
);
1263 ptr-operator declarator */
1266 pp_cxx_declarator (cxx_pretty_printer
*pp
, tree t
)
1268 pp_cxx_direct_declarator (pp
, t
);
1271 /* ctor-initializer:
1272 : mem-initializer-list
1274 mem-initializer-list:
1276 mem-initializer , mem-initializer-list
1279 mem-initializer-id ( expression-list(opt) )
1282 ::(opt) nested-name-specifier(opt) class-name
1286 pp_cxx_ctor_initializer (cxx_pretty_printer
*pp
, tree t
)
1288 t
= TREE_OPERAND (t
, 0);
1289 pp_cxx_whitespace (pp
);
1291 pp_cxx_whitespace (pp
);
1292 for (; t
; t
= TREE_CHAIN (t
))
1294 pp_cxx_primary_expression (pp
, TREE_PURPOSE (t
));
1295 pp_cxx_call_argument_list (pp
, TREE_VALUE (t
));
1297 pp_cxx_separate_with (pp
, ',');
1301 /* function-definition:
1302 decl-specifier-seq(opt) declarator ctor-initializer(opt) function-body
1303 decl-specifier-seq(opt) declarator function-try-block */
1306 pp_cxx_function_definition (cxx_pretty_printer
*pp
, tree t
)
1308 tree saved_scope
= pp
->enclosing_scope
;
1309 pp_cxx_decl_specifier_seq (pp
, t
);
1310 pp_cxx_declarator (pp
, t
);
1311 pp_needs_newline (pp
) = true;
1312 pp
->enclosing_scope
= DECL_CONTEXT (t
);
1313 if (DECL_SAVED_TREE (t
))
1314 pp_cxx_statement (pp
, DECL_SAVED_TREE (t
));
1317 pp_cxx_semicolon (pp
);
1318 pp_needs_newline (pp
) = true;
1321 pp
->enclosing_scope
= saved_scope
;
1324 /* abstract-declarator:
1325 ptr-operator abstract-declarator(opt)
1326 direct-abstract-declarator */
1329 pp_cxx_abstract_declarator (cxx_pretty_printer
*pp
, tree t
)
1331 if (TYPE_PTRMEM_P (t
) || TYPE_PTRMEMFUNC_P (t
))
1332 pp_cxx_right_paren (pp
);
1333 else if (POINTER_TYPE_P (t
))
1335 if (TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
1336 || TREE_CODE (TREE_TYPE (t
)) == FUNCTION_TYPE
)
1337 pp_cxx_right_paren (pp
);
1340 pp_cxx_direct_abstract_declarator (pp
, t
);
1343 /* direct-abstract-declarator:
1344 direct-abstract-declarator(opt) ( parameter-declaration-clause )
1345 cv-qualifier-seq(opt) exception-specification(opt)
1346 direct-abstract-declarator(opt) [ constant-expression(opt) ]
1347 ( abstract-declarator ) */
1350 pp_cxx_direct_abstract_declarator (cxx_pretty_printer
*pp
, tree t
)
1352 switch (TREE_CODE (t
))
1354 case REFERENCE_TYPE
:
1355 pp_cxx_abstract_declarator (pp
, t
);
1359 if (TYPE_PTRMEMFUNC_P (t
))
1360 pp_cxx_direct_abstract_declarator (pp
, TYPE_PTRMEMFUNC_FN_TYPE (t
));
1365 pp_cxx_parameter_declaration_clause (pp
, t
);
1366 pp_cxx_direct_abstract_declarator (pp
, TREE_TYPE (t
));
1367 if (TREE_CODE (t
) == METHOD_TYPE
)
1369 pp_base (pp
)->padding
= pp_before
;
1370 pp_cxx_cv_qualifier_seq
1371 (pp
, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t
))));
1373 pp_cxx_exception_specification (pp
, t
);
1377 case TEMPLATE_TYPE_PARM
:
1378 case TEMPLATE_TEMPLATE_PARM
:
1379 case BOUND_TEMPLATE_TEMPLATE_PARM
:
1380 case UNBOUND_CLASS_TEMPLATE
:
1384 pp_c_direct_abstract_declarator (pp_c_base (pp
), t
);
1390 type-specifier-seq abstract-declarator(opt) */
1393 pp_cxx_type_id (cxx_pretty_printer
*pp
, tree t
)
1395 pp_flags saved_flags
= pp_c_base (pp
)->flags
;
1396 pp_c_base (pp
)->flags
|= pp_c_flag_abstract
;
1398 switch (TREE_CODE (t
))
1405 case BOUND_TEMPLATE_TEMPLATE_PARM
:
1406 case UNBOUND_CLASS_TEMPLATE
:
1407 case TEMPLATE_TEMPLATE_PARM
:
1408 case TEMPLATE_TYPE_PARM
:
1409 case TEMPLATE_PARM_INDEX
:
1412 case TEMPLATE_ID_EXPR
:
1413 pp_cxx_type_specifier_seq (pp
, t
);
1417 pp_c_type_id (pp_c_base (pp
), t
);
1421 pp_c_base (pp
)->flags
= saved_flags
;
1424 /* template-argument-list:
1426 template-argument-list, template-argument
1429 assignment-expression
1434 pp_cxx_template_argument_list (cxx_pretty_printer
*pp
, tree t
)
1439 for (i
= 0; i
< TREE_VEC_LENGTH (t
); ++i
)
1441 tree arg
= TREE_VEC_ELT (t
, i
);
1443 pp_cxx_separate_with (pp
, ',');
1444 if (TYPE_P (arg
) || (TREE_CODE (arg
) == TEMPLATE_DECL
1445 && TYPE_P (DECL_TEMPLATE_RESULT (arg
))))
1446 pp_cxx_type_id (pp
, arg
);
1448 pp_cxx_expression (pp
, arg
);
1454 pp_cxx_exception_declaration (cxx_pretty_printer
*pp
, tree t
)
1456 t
= DECL_EXPR_DECL (t
);
1457 pp_cxx_type_specifier_seq (pp
, t
);
1459 pp_cxx_abstract_declarator (pp
, t
);
1461 pp_cxx_declarator (pp
, t
);
1467 pp_cxx_statement (cxx_pretty_printer
*pp
, tree t
)
1469 switch (TREE_CODE (t
))
1471 case CTOR_INITIALIZER
:
1472 pp_cxx_ctor_initializer (pp
, t
);
1476 pp_cxx_identifier (pp
, "using");
1477 pp_cxx_identifier (pp
, "namespace");
1478 pp_cxx_qualified_id (pp
, USING_STMT_NAMESPACE (t
));
1482 pp_cxx_identifier (pp
, "using");
1483 pp_cxx_nested_name_specifier (pp
, DECL_INITIAL (t
));
1484 pp_cxx_unqualified_id (pp
, DECL_NAME (t
));
1491 try compound-statement handler-seq */
1493 pp_maybe_newline_and_indent (pp
, 0);
1494 pp_cxx_identifier (pp
, "try");
1495 pp_newline_and_indent (pp
, 3);
1496 pp_cxx_statement (pp
, TRY_STMTS (t
));
1497 pp_newline_and_indent (pp
, -3);
1501 pp_cxx_statement (pp
, TRY_HANDLERS (t
));
1506 handler handler-seq(opt)
1509 catch ( exception-declaration ) compound-statement
1511 exception-declaration:
1512 type-specifier-seq declarator
1513 type-specifier-seq abstract-declarator
1516 pp_cxx_identifier (pp
, "catch");
1517 pp_cxx_left_paren (pp
);
1518 pp_cxx_exception_declaration (pp
, HANDLER_PARMS (t
));
1519 pp_cxx_right_paren (pp
);
1520 pp_indentation (pp
) += 3;
1521 pp_needs_newline (pp
) = true;
1522 pp_cxx_statement (pp
, HANDLER_BODY (t
));
1523 pp_indentation (pp
) -= 3;
1524 pp_needs_newline (pp
) = true;
1527 /* selection-statement:
1528 if ( expression ) statement
1529 if ( expression ) statement else statement */
1531 pp_cxx_identifier (pp
, "if");
1532 pp_cxx_whitespace (pp
);
1533 pp_cxx_left_paren (pp
);
1534 pp_cxx_expression (pp
, IF_COND (t
));
1535 pp_cxx_right_paren (pp
);
1536 pp_newline_and_indent (pp
, 2);
1537 pp_cxx_statement (pp
, THEN_CLAUSE (t
));
1538 pp_newline_and_indent (pp
, -2);
1539 if (ELSE_CLAUSE (t
))
1541 tree else_clause
= ELSE_CLAUSE (t
);
1542 pp_cxx_identifier (pp
, "else");
1543 if (TREE_CODE (else_clause
) == IF_STMT
)
1544 pp_cxx_whitespace (pp
);
1546 pp_newline_and_indent (pp
, 2);
1547 pp_cxx_statement (pp
, else_clause
);
1548 if (TREE_CODE (else_clause
) != IF_STMT
)
1549 pp_newline_and_indent (pp
, -2);
1554 pp_cxx_identifier (pp
, "try");
1555 pp_newline_and_indent (pp
, 2);
1556 pp_cxx_statement (pp
, CLEANUP_BODY (t
));
1557 pp_newline_and_indent (pp
, -2);
1558 pp_cxx_identifier (pp
, CLEANUP_EH_ONLY (t
) ? "catch" : "finally");
1559 pp_newline_and_indent (pp
, 2);
1560 pp_cxx_statement (pp
, CLEANUP_EXPR (t
));
1561 pp_newline_and_indent (pp
, -2);
1565 pp_c_statement (pp_c_base (pp
), t
);
1570 /* original-namespace-definition:
1571 namespace identifier { namespace-body }
1573 As an edge case, we also handle unnamed namespace definition here. */
1576 pp_cxx_original_namespace_definition (cxx_pretty_printer
*pp
, tree t
)
1578 pp_cxx_identifier (pp
, "namespace");
1580 pp_cxx_unqualified_id (pp
, t
);
1581 pp_cxx_whitespace (pp
);
1582 pp_cxx_left_brace (pp
);
1583 /* We do not print the namespace-body. */
1584 pp_cxx_whitespace (pp
);
1585 pp_cxx_right_brace (pp
);
1591 namespace-alias-definition:
1592 namespace identifier = qualified-namespace-specifier ;
1594 qualified-namespace-specifier:
1595 ::(opt) nested-name-specifier(opt) namespace-name */
1598 pp_cxx_namespace_alias_definition (cxx_pretty_printer
*pp
, tree t
)
1600 pp_cxx_identifier (pp
, "namespace");
1601 pp_cxx_unqualified_id (pp
, t
);
1602 pp_cxx_whitespace (pp
);
1604 pp_cxx_whitespace (pp
);
1605 pp_cxx_qualified_id (pp
, DECL_NAMESPACE_ALIAS (t
));
1606 pp_cxx_semicolon (pp
);
1609 /* simple-declaration:
1610 decl-specifier-seq(opt) init-declarator-list(opt) */
1613 pp_cxx_simple_declaration (cxx_pretty_printer
*pp
, tree t
)
1615 pp_cxx_decl_specifier_seq (pp
, t
);
1616 pp_cxx_init_declarator (pp
, t
);
1617 pp_cxx_semicolon (pp
);
1618 pp_needs_newline (pp
) = true;
1622 template-parameter-list:
1624 template-parameter-list , template-parameter */
1627 pp_cxx_template_parameter_list (cxx_pretty_printer
*pp
, tree t
)
1629 const int n
= TREE_VEC_LENGTH (t
);
1631 for (i
= 0; i
< n
; ++i
)
1634 pp_cxx_separate_with (pp
, ',');
1635 pp_cxx_template_parameter (pp
, TREE_VEC_ELT (t
, i
));
1639 /* template-parameter:
1641 parameter-declaration
1644 class identifier(opt)
1645 class identifier(op) = type-id
1646 typename identifier(opt)
1647 typename identifier(opt) = type-id
1648 template < template-parameter-list > class identifier(opt)
1649 template < template-parameter-list > class identifier(opt) = template-name
1653 pp_cxx_template_parameter (cxx_pretty_printer
*pp
, tree t
)
1655 tree parameter
= TREE_VALUE (t
);
1656 switch (TREE_CODE (parameter
))
1659 pp_cxx_identifier (pp
, "class");
1660 if (DECL_NAME (parameter
))
1661 pp_cxx_tree_identifier (pp
, DECL_NAME (parameter
));
1662 /* FIXME: Chech if we should print also default argument. */
1666 pp_cxx_parameter_declaration (pp
, parameter
);
1673 pp_unsupported_tree (pp
, t
);
1678 /* Pretty-print a template parameter in the canonical form
1679 "template-parameter-<level>-<position in parameter list>". */
1682 pp_cxx_canonical_template_parameter (cxx_pretty_printer
*pp
, tree parm
)
1684 const enum tree_code code
= TREE_CODE (parm
);
1686 /* Brings type template parameters to the canonical forms. */
1687 if (code
== TEMPLATE_TYPE_PARM
|| code
== TEMPLATE_TEMPLATE_PARM
1688 || code
== BOUND_TEMPLATE_TEMPLATE_PARM
)
1689 parm
= TEMPLATE_TYPE_PARM_INDEX (parm
);
1691 pp_cxx_begin_template_argument_list (pp
);
1692 pp_cxx_identifier (pp
, "template-parameter-");
1693 pp_wide_integer (pp
, TEMPLATE_PARM_LEVEL (parm
));
1695 pp_wide_integer (pp
, TEMPLATE_PARM_IDX (parm
) + 1);
1696 pp_cxx_end_template_argument_list (pp
);
1700 template-declaration:
1701 export(opt) template < template-parameter-list > declaration */
1704 pp_cxx_template_declaration (cxx_pretty_printer
*pp
, tree t
)
1706 tree tmpl
= most_general_template (t
);
1710 pp_maybe_newline_and_indent (pp
, 0);
1711 for (level
= DECL_TEMPLATE_PARMS (tmpl
); level
; level
= TREE_CHAIN (level
))
1713 pp_cxx_identifier (pp
, "template");
1714 pp_cxx_begin_template_argument_list (pp
);
1715 pp_cxx_template_parameter_list (pp
, TREE_VALUE (level
));
1716 pp_cxx_end_template_argument_list (pp
);
1717 pp_newline_and_indent (pp
, 3);
1720 if (TREE_CODE (t
) == FUNCTION_DECL
&& DECL_SAVED_TREE (t
))
1721 pp_cxx_function_definition (pp
, t
);
1723 pp_cxx_simple_declaration (pp
, t
);
1727 pp_cxx_explicit_specialization (cxx_pretty_printer
*pp
, tree t
)
1729 pp_unsupported_tree (pp
, t
);
1733 pp_cxx_explicit_instantiation (cxx_pretty_printer
*pp
, tree t
)
1735 pp_unsupported_tree (pp
, t
);
1742 template-declaration
1743 explicit-instantiation
1744 explicit-specialization
1745 linkage-specification
1746 namespace-definition
1751 namespace-alias-definition
1755 pp_cxx_declaration (cxx_pretty_printer
*pp
, tree t
)
1757 if (!DECL_LANG_SPECIFIC (t
))
1758 pp_cxx_simple_declaration (pp
, t
);
1759 else if (DECL_USE_TEMPLATE (t
))
1760 switch (DECL_USE_TEMPLATE (t
))
1763 pp_cxx_template_declaration (pp
, t
);
1767 pp_cxx_explicit_specialization (pp
, t
);
1771 pp_cxx_explicit_instantiation (pp
, t
);
1777 else switch (TREE_CODE (t
))
1781 pp_cxx_simple_declaration (pp
, t
);
1785 if (DECL_SAVED_TREE (t
))
1786 pp_cxx_function_definition (pp
, t
);
1788 pp_cxx_simple_declaration (pp
, t
);
1791 case NAMESPACE_DECL
:
1792 if (DECL_NAMESPACE_ALIAS (t
))
1793 pp_cxx_namespace_alias_definition (pp
, t
);
1795 pp_cxx_original_namespace_definition (pp
, t
);
1799 pp_unsupported_tree (pp
, t
);
1805 typedef c_pretty_print_fn pp_fun
;
1807 /* Initialization of a C++ pretty-printer object. */
1810 pp_cxx_pretty_printer_init (cxx_pretty_printer
*pp
)
1812 pp_c_pretty_printer_init (pp_c_base (pp
));
1813 pp_set_line_maximum_length (pp
, 0);
1815 pp
->c_base
.declaration
= (pp_fun
) pp_cxx_declaration
;
1816 pp
->c_base
.declaration_specifiers
= (pp_fun
) pp_cxx_decl_specifier_seq
;
1817 pp
->c_base
.function_specifier
= (pp_fun
) pp_cxx_function_specifier
;
1818 pp
->c_base
.type_specifier_seq
= (pp_fun
) pp_cxx_type_specifier_seq
;
1819 pp
->c_base
.declarator
= (pp_fun
) pp_cxx_declarator
;
1820 pp
->c_base
.direct_declarator
= (pp_fun
) pp_cxx_direct_declarator
;
1821 pp
->c_base
.parameter_list
= (pp_fun
) pp_cxx_parameter_declaration_clause
;
1822 pp
->c_base
.type_id
= (pp_fun
) pp_cxx_type_id
;
1823 pp
->c_base
.abstract_declarator
= (pp_fun
) pp_cxx_abstract_declarator
;
1824 pp
->c_base
.direct_abstract_declarator
=
1825 (pp_fun
) pp_cxx_direct_abstract_declarator
;
1826 pp
->c_base
.simple_type_specifier
= (pp_fun
)pp_cxx_simple_type_specifier
;
1828 /* pp->c_base.statement = (pp_fun) pp_cxx_statement; */
1830 pp
->c_base
.id_expression
= (pp_fun
) pp_cxx_id_expression
;
1831 pp
->c_base
.primary_expression
= (pp_fun
) pp_cxx_primary_expression
;
1832 pp
->c_base
.postfix_expression
= (pp_fun
) pp_cxx_postfix_expression
;
1833 pp
->c_base
.unary_expression
= (pp_fun
) pp_cxx_unary_expression
;
1834 pp
->c_base
.multiplicative_expression
= (pp_fun
) pp_cxx_multiplicative_expression
;
1835 pp
->c_base
.conditional_expression
= (pp_fun
) pp_cxx_conditional_expression
;
1836 pp
->c_base
.assignment_expression
= (pp_fun
) pp_cxx_assignment_expression
;
1837 pp
->c_base
.expression
= (pp_fun
) pp_cxx_expression
;
1838 pp
->enclosing_scope
= global_namespace
;