1 /* Perform the semantic phase of parsing, i.e., the process of
2 building tree structure, checking semantic consistency, and
3 building RTL. These routines are used both during actual parsing
4 and during the instantiation of template functions.
6 Copyright (C) 1998, 1999 Free Software Foundation, Inc.
7 Written by Mark Mitchell (mmitchell@usa.net) based on code found
8 formerly in parse.y and pt.c.
10 This file is part of GNU CC.
12 GNU CC is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2, or (at your option)
17 GNU CC is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with GNU CC; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
35 /* There routines provide a modular interface to perform many parsing
36 operations. They may therefore be used during actual parsing, or
37 during template instantiation, which may be regarded as a
38 degenerate form of parsing. Since the current g++ parser is
39 lacking in several respects, and will be reimplemented, we are
40 attempting to move most code that is not directly related to
41 parsing into this file; that will make implementing the new parser
42 much easier since it will be able to make use of these routines. */
44 static void expand_stmts PROTO((tree));
45 static void do_pushlevel PROTO((void));
46 static tree do_poplevel PROTO((void));
48 /* When parsing a template, LAST_TREE contains the last statement
49 parsed. These are chained together through the TREE_CHAIN field,
50 but often need to be re-organized since the parse is performed
51 bottom-up. This macro makes LAST_TREE the indicated SUBSTMT of
54 #define RECHAIN_STMTS(stmt, substmt, last) \
57 TREE_CHAIN (stmt) = NULL_TREE; \
61 #define RECHAIN_STMTS_FROM_LAST(stmt, substmt) \
62 RECHAIN_STMTS (stmt, substmt, last_tree)
64 #define RECHAIN_STMTS_FROM_CHAIN(stmt, substmt) \
65 RECHAIN_STMTS (stmt, substmt, TREE_CHAIN (stmt))
67 /* Finish an expression-statement, whose EXPRESSION is as indicated. */
70 finish_expr_stmt (expr)
73 if (expr != NULL_TREE)
75 if (building_stmt_tree ())
76 add_tree (build_min_nt (EXPR_STMT, expr));
79 emit_line_note (input_filename, lineno);
80 /* Do default conversion if safe and possibly important,
81 in case within ({...}). */
82 if (!stmts_are_full_exprs_p &&
83 ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
85 || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
86 expr = default_conversion (expr);
88 if (stmts_are_full_exprs_p)
89 expand_start_target_temps ();
91 cplus_expand_expr_stmt (expr);
93 if (stmts_are_full_exprs_p)
95 expand_end_target_temps ();
103 /* This was an expression-statement, so we save the type of the
105 last_expr_type = expr ? TREE_TYPE (expr) : NULL_TREE;
108 /* Begin an if-statement. Returns a newly created IF_STMT if
116 if (building_stmt_tree ())
118 r = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
129 /* Process the COND of an if-statement, which may be given by
133 finish_if_stmt_cond (cond, if_stmt)
137 if (building_stmt_tree ())
139 if (last_tree != if_stmt)
140 RECHAIN_STMTS_FROM_LAST (if_stmt, IF_COND (if_stmt));
142 IF_COND (if_stmt) = cond;
146 emit_line_note (input_filename, lineno);
147 expand_start_cond (condition_conversion (cond), 0);
151 /* Finish the then-clause of an if-statement, which may be given by
155 finish_then_clause (if_stmt)
158 if (building_stmt_tree ())
160 RECHAIN_STMTS_FROM_CHAIN (if_stmt,
161 THEN_CLAUSE (if_stmt));
169 /* Begin the else-clause of an if-statement. */
174 if (!building_stmt_tree ())
175 expand_start_else ();
178 /* Finish the else-clause of an if-statement, which may be given by
182 finish_else_clause (if_stmt)
185 if (building_stmt_tree ())
186 RECHAIN_STMTS_FROM_CHAIN (if_stmt, ELSE_CLAUSE (if_stmt));
189 /* Finsh an if-statement. */
194 if (!building_stmt_tree ())
201 /* Begin a while-statement. Returns a newly created WHILE_STMT if
209 if (building_stmt_tree ())
211 r = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
217 emit_line_note (input_filename, lineno);
218 expand_start_loop (1);
227 /* Process the COND of an if-statement, which may be given by
231 finish_while_stmt_cond (cond, while_stmt)
235 if (building_stmt_tree ())
237 if (last_tree != while_stmt)
238 RECHAIN_STMTS_FROM_LAST (while_stmt, WHILE_COND (while_stmt));
240 TREE_OPERAND (while_stmt, 0) = cond;
244 emit_line_note (input_filename, lineno);
245 expand_exit_loop_if_false (0, condition_conversion (cond));
248 /* If COND wasn't a declaration, clear out the
249 block we made for it and start a new one here so the
250 optimization in expand_end_loop will work. */
251 if (getdecls () == NULL_TREE)
258 /* Finish a while-statement, which may be given by WHILE_STMT. */
261 finish_while_stmt (while_stmt)
266 if (building_stmt_tree ())
267 RECHAIN_STMTS_FROM_CHAIN (while_stmt, WHILE_BODY (while_stmt));
273 /* Begin a do-statement. Returns a newly created DO_STMT if
279 if (building_stmt_tree ())
281 tree r = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
288 emit_line_note (input_filename, lineno);
289 expand_start_loop_continue_elsewhere (1);
294 /* Finish the body of a do-statement, which may be given by DO_STMT. */
297 finish_do_body (do_stmt)
300 if (building_stmt_tree ())
301 RECHAIN_STMTS_FROM_CHAIN (do_stmt, DO_BODY (do_stmt));
303 expand_loop_continue_here ();
306 /* Finish a do-statement, which may be given by DO_STMT, and whose
307 COND is as indicated. */
310 finish_do_stmt (cond, do_stmt)
314 if (building_stmt_tree ())
315 DO_COND (do_stmt) = cond;
318 emit_line_note (input_filename, lineno);
319 expand_exit_loop_if_false (0, condition_conversion (cond));
327 /* Finish a return-statement. The EXPRESSION returned, if any, is as
331 finish_return_stmt (expr)
334 if (building_stmt_tree ())
335 add_tree (build_min_nt (RETURN_STMT, expr));
338 emit_line_note (input_filename, lineno);
339 c_expand_return (expr);
345 /* Begin a for-statement. Returns a new FOR_STMT if appropriate. */
352 if (building_stmt_tree ())
354 r = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
355 NULL_TREE, NULL_TREE);
361 if (flag_new_for_scope > 0)
364 note_level_for_for ();
370 /* Finish the for-init-statement of a for-statement, which may be
371 given by FOR_STMT. */
374 finish_for_init_stmt (for_stmt)
377 if (building_stmt_tree ())
379 if (last_tree != for_stmt)
380 RECHAIN_STMTS_FROM_CHAIN (for_stmt, FOR_INIT_STMT (for_stmt));
385 emit_line_note (input_filename, lineno);
386 expand_start_loop_continue_elsewhere (1);
392 /* Finish the COND of a for-statement, which may be given by
396 finish_for_cond (cond, for_stmt)
400 if (building_stmt_tree ())
402 if (last_tree != for_stmt)
403 RECHAIN_STMTS_FROM_LAST (for_stmt, FOR_COND (for_stmt));
405 FOR_COND (for_stmt) = cond;
409 emit_line_note (input_filename, lineno);
411 expand_exit_loop_if_false (0, condition_conversion (cond));
414 /* If the cond wasn't a declaration, clear out the
415 block we made for it and start a new one here so the
416 optimization in expand_end_loop will work. */
417 if (getdecls () == NULL_TREE)
424 /* Finish the increment-EXPRESSION in a for-statement, which may be
425 given by FOR_STMT. */
428 finish_for_expr (expr, for_stmt)
432 if (building_stmt_tree ())
433 FOR_EXPR (for_stmt) = expr;
435 /* Don't let the tree nodes for EXPR be discarded
436 by clear_momentary during the parsing of the next stmt. */
440 /* Finish the body of a for-statement, which may be given by
441 FOR_STMT. The increment-EXPR for the loop must be
445 finish_for_stmt (expr, for_stmt)
449 /* Pop the scope for the body of the loop. */
452 if (building_stmt_tree ())
453 RECHAIN_STMTS_FROM_CHAIN (for_stmt, FOR_BODY (for_stmt));
456 emit_line_note (input_filename, lineno);
457 expand_loop_continue_here ();
459 finish_expr_stmt (expr);
465 if (flag_new_for_scope > 0)
471 /* Finish a break-statement. */
476 emit_line_note (input_filename, lineno);
477 if (building_stmt_tree ())
478 add_tree (build_min_nt (BREAK_STMT));
479 else if ( ! expand_exit_something ())
480 cp_error ("break statement not within loop or switch");
483 /* Finish a continue-statement. */
486 finish_continue_stmt ()
488 emit_line_note (input_filename, lineno);
489 if (building_stmt_tree ())
490 add_tree (build_min_nt (CONTINUE_STMT));
491 else if (! expand_continue_loop (0))
492 cp_error ("continue statement not within a loop");
495 /* Begin a switch-statement. */
503 /* Finish the cond of a switch-statement. Returns a new
504 SWITCH_STMT if appropriate. */
507 finish_switch_cond (cond)
512 if (building_stmt_tree ())
514 r = build_min_nt (SWITCH_STMT, cond, NULL_TREE);
517 else if (cond != error_mark_node)
519 emit_line_note (input_filename, lineno);
520 c_expand_start_case (cond);
525 /* The code is in error, but we don't want expand_end_case to
527 c_expand_start_case (boolean_false_node);
533 /* Don't let the tree nodes for COND be discarded by
534 clear_momentary during the parsing of the next stmt. */
540 /* Finish the body of a switch-statement, which may be given by
541 SWITCH_STMT. The COND to switch on is indicated. */
544 finish_switch_stmt (cond, switch_stmt)
548 if (building_stmt_tree ())
549 RECHAIN_STMTS_FROM_CHAIN (switch_stmt, SWITCH_BODY (switch_stmt));
551 expand_end_case (cond);
558 /* Finish a case-label. */
561 finish_case_label (low_value, high_value)
565 if (building_stmt_tree ())
567 add_tree (build_min_nt (CASE_LABEL, low_value, high_value));
571 do_case (low_value, high_value);
574 /* Finish a goto-statement. */
577 finish_goto_stmt (destination)
580 if (TREE_CODE (destination) == IDENTIFIER_NODE)
581 destination = lookup_label (destination);
583 if (building_stmt_tree ())
584 add_tree (build_min_nt (GOTO_STMT, destination));
587 emit_line_note (input_filename, lineno);
589 if (TREE_CODE (destination) == LABEL_DECL)
591 TREE_USED (destination) = 1;
592 expand_goto (destination);
595 expand_computed_goto (destination);
599 /* Begin a try-block. Returns a newly-created TRY_BLOCK if
605 if (building_stmt_tree ())
607 tree r = build_min_nt (TRY_BLOCK, NULL_TREE,
614 emit_line_note (input_filename, lineno);
615 expand_start_try_stmts ();
620 /* Likewise, for a function-try-block. */
623 begin_function_try_block ()
625 if (building_stmt_tree ())
627 tree r = build_min_nt (TRY_BLOCK, NULL_TREE,
634 if (! current_function_parms_stored)
636 expand_start_early_try_stmts ();
641 /* Finish a try-block, which may be given by TRY_BLOCK. */
644 finish_try_block (try_block)
647 if (building_stmt_tree ())
648 RECHAIN_STMTS_FROM_LAST (try_block, TRY_STMTS (try_block));
650 expand_start_all_catch ();
653 /* Finish an implicitly generated try-block, with a cleanup is given
657 finish_cleanup (cleanup, try_block)
661 if (building_stmt_tree ())
663 TRY_HANDLERS (try_block) = cleanup;
664 CLEANUP_P (try_block) = 1;
667 expand_eh_region_end (protect_with_terminate (cleanup));
670 /* Likewise, for a function-try-block. */
673 finish_function_try_block (try_block)
676 if (building_stmt_tree ())
677 RECHAIN_STMTS_FROM_LAST (try_block, TRY_STMTS (try_block));
680 end_protect_partials ();
681 expand_start_all_catch ();
682 in_function_try_handler = 1;
686 /* Finish a handler-sequence for a try-block, which may be given by
690 finish_handler_sequence (try_block)
693 if (building_stmt_tree ())
694 RECHAIN_STMTS_FROM_CHAIN (try_block, TRY_HANDLERS (try_block));
696 expand_end_all_catch ();
699 /* Likewise, for a function-try-block. */
702 finish_function_handler_sequence (try_block)
705 if (building_stmt_tree ())
706 RECHAIN_STMTS_FROM_CHAIN (try_block, TRY_HANDLERS (try_block));
709 in_function_try_handler = 0;
710 expand_end_all_catch ();
714 /* Begin a handler. Returns a HANDLER if appropriate. */
721 if (building_stmt_tree ())
723 r = build_min_nt (HANDLER, NULL_TREE, NULL_TREE);
734 /* Finish the handler-parameters for a handler, which may be given by
738 finish_handler_parms (handler)
741 if (building_stmt_tree ())
742 RECHAIN_STMTS_FROM_CHAIN (handler, HANDLER_PARMS (handler));
745 /* Finish a handler, which may be given by HANDLER. */
748 finish_handler (handler)
751 if (building_stmt_tree ())
752 RECHAIN_STMTS_FROM_CHAIN (handler, HANDLER_BODY (handler));
754 expand_end_catch_block ();
759 /* Begin a compound-statement. If HAS_NO_SCOPE is non-zero, the
760 compound-statement does not define a scope. Returns a new
761 COMPOUND_STMT if appropriate. */
764 begin_compound_stmt (has_no_scope)
769 if (building_stmt_tree ())
771 r = build_min_nt (COMPOUND_STMT, NULL_TREE);
774 COMPOUND_STMT_NO_SCOPE (r) = 1;
779 last_expr_type = NULL_TREE;
784 /* Normally, we try hard to keep the BLOCK for a
785 statement-expression. But, if it's a statement-expression with
786 a scopeless block, there's nothing to keep, and we don't want
787 to accidentally keep a block *inside* the scopeless block. */
794 /* Finish a compound-statement, which may be given by COMPOUND_STMT.
795 If HAS_NO_SCOPE is non-zero, the compound statement does not define
799 finish_compound_stmt (has_no_scope, compound_stmt)
811 if (building_stmt_tree ())
812 RECHAIN_STMTS_FROM_CHAIN (compound_stmt,
813 COMPOUND_BODY (compound_stmt));
815 /* When we call finish_stmt we will lost LAST_EXPR_TYPE. But, since
816 the precise purpose of that variable is store the type of the
817 last expression statement within the last compound statement, we
818 preserve the value. */
826 /* Finish an asm-statement, whose components are a CV_QUALIFIER, a
827 STRING, some OUTPUT_OPERANDS, some INPUT_OPERANDS, and some
831 finish_asm_stmt (cv_qualifier, string, output_operands,
832 input_operands, clobbers)
835 tree output_operands;
839 if (TREE_CHAIN (string))
841 if (building_stmt_tree ())
842 /* We need to build the combined string on the permanent
843 obstack so that we can use it during instantiations. */
844 push_permanent_obstack ();
846 string = combine_strings (string);
848 if (building_stmt_tree ())
852 if (cv_qualifier != NULL_TREE
853 && cv_qualifier != ridpointers[(int) RID_VOLATILE])
855 cp_warning ("%s qualifier ignored on asm",
856 IDENTIFIER_POINTER (cv_qualifier));
857 cv_qualifier = NULL_TREE;
860 if (building_stmt_tree ())
862 tree r = build_min_nt (ASM_STMT, cv_qualifier, string,
863 output_operands, input_operands,
869 emit_line_note (input_filename, lineno);
870 if (output_operands != NULL_TREE || input_operands != NULL_TREE
871 || clobbers != NULL_TREE)
875 for (t = input_operands; t; t = TREE_CHAIN (t))
876 TREE_VALUE (t) = decay_conversion (TREE_VALUE (t));
878 c_expand_asm_operands (string, output_operands,
881 cv_qualifier != NULL_TREE,
882 input_filename, lineno);
891 /* Finish a label with the indicated NAME. */
894 finish_label_stmt (name)
897 tree decl = define_label (input_filename, lineno, name);
899 if (building_stmt_tree ())
900 add_tree (build_min_nt (LABEL_STMT, decl));
905 /* Finish a series of declarations for local labels. G++ allows users
906 to declare "local" labels, i.e., labels with scope. This extension
907 is useful when writing code involving statement-expressions. */
910 finish_label_decl (name)
913 tree decl = declare_local_label (name);
914 if (building_stmt_tree ())
915 add_decl_stmt (decl);
918 /* Create a declaration statement for the declaration given by the
927 /* We need the type to last until instantiation time. */
928 decl_stmt = build_min_nt (DECL_STMT, decl);
929 add_tree (decl_stmt);
932 /* We're in a constructor, and have just constructed a a subobject of
933 *THIS. CLEANUP is code to run if an exception is thrown before the
934 end of the current function is reached. */
937 finish_subobject (cleanup)
940 if (building_stmt_tree ())
942 tree r = build_min_nt (SUBOBJECT, cleanup);
946 add_partial_entry (cleanup);
949 /* Bind a name and initialization to the return value of
950 the current function. */
953 finish_named_return_value (return_id, init)
954 tree return_id, init;
956 tree decl = DECL_RESULT (current_function_decl);
959 /* Give this error as many times as there are occurrences,
960 so that users can use Emacs compilation buffers to find
961 and fix all such places. */
962 pedwarn ("ANSI C++ does not permit named return values");
964 if (return_id != NULL_TREE)
966 if (DECL_NAME (decl) == NULL_TREE)
968 DECL_NAME (decl) = return_id;
969 DECL_ASSEMBLER_NAME (decl) = return_id;
973 cp_error ("return identifier `%D' already in place", return_id);
978 /* Can't let this happen for constructors. */
979 if (DECL_CONSTRUCTOR_P (current_function_decl))
981 error ("can't redefine default return value for constructors");
985 /* If we have a named return value, put that in our scope as well. */
986 if (DECL_NAME (decl) != NULL_TREE)
988 /* Let `cp_finish_decl' know that this initializer is ok. */
989 DECL_INITIAL (decl) = init;
992 if (building_stmt_tree ())
993 add_tree (build_min_nt (RETURN_INIT, return_id, init));
996 cp_finish_decl (decl, init, NULL_TREE, 0, 0);
997 store_return_init (decl);
1002 /* Cache the value of this class's main virtual function table pointer
1003 in a register variable. This will save one indirection if a
1004 more than one virtual function call is made this function. */
1009 if (base_init_expr == 0
1010 && DECL_CONSTRUCTOR_P (current_function_decl))
1012 if (building_stmt_tree ())
1013 add_tree (build_min_nt
1015 current_member_init_list, current_base_init_list));
1017 emit_base_init (current_class_type);
1020 /* Always keep the BLOCK node associated with the outermost pair of
1021 curley braces of a function. These are needed for correct
1022 operation of dwarfout.c. */
1023 keep_next_level (1);
1026 /* Begin a new scope. */
1031 if (!building_stmt_tree ())
1033 emit_line_note (input_filename, lineno);
1037 if (stmts_are_full_exprs_p)
1039 if (!building_stmt_tree () && stmts_are_full_exprs_p)
1040 expand_start_bindings (0);
1043 /* Finish a scope. */
1050 if (!building_stmt_tree () && stmts_are_full_exprs_p)
1051 expand_end_bindings (getdecls (), kept_level_p (), 0);
1052 if (stmts_are_full_exprs_p)
1053 t = poplevel (kept_level_p (), 1, 0);
1060 /* Finish a parenthesized expression EXPR. */
1063 finish_parenthesized_expr (expr)
1066 if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
1067 /* This inhibits warnings in truthvalue_conversion. */
1068 C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK);
1073 /* Begin a statement-expression. The value returned must be passed to
1074 finish_stmt_expr. */
1079 keep_next_level (1);
1080 /* If we're building a statement tree, then the upcoming compound
1081 statement will be chained onto the tree structure, starting at
1082 last_tree. We return last_tree so that we can later unhook the
1083 compound statement. */
1084 return building_stmt_tree () ? last_tree : expand_start_stmt_expr();
1087 /* Finish a statement-expression. RTL_EXPR should be the value
1088 returned by the previous begin_stmt_expr; EXPR is the
1089 statement-expression. Returns an expression representing the
1090 statement-expression. */
1093 finish_stmt_expr (rtl_expr, expr)
1099 if (!building_stmt_tree ())
1101 rtl_expr = expand_end_stmt_expr (rtl_expr);
1102 /* The statements have side effects, so the group does. */
1103 TREE_SIDE_EFFECTS (rtl_expr) = 1;
1106 if (building_stmt_tree ())
1108 /* If the last thing in the statement-expression was not an
1109 expression-statement, then it has type `void'. */
1110 if (!last_expr_type)
1111 last_expr_type = void_type_node;
1112 result = build_min (STMT_EXPR, last_expr_type, last_tree);
1113 TREE_SIDE_EFFECTS (result) = 1;
1115 /* Remove the compound statement from the tree structure; it is
1116 now saved in the STMT_EXPR. */
1117 last_tree = rtl_expr;
1118 TREE_CHAIN (last_tree) = NULL_TREE;
1120 else if (expr && TREE_CODE (expr) == BLOCK)
1122 result = build (BIND_EXPR, TREE_TYPE (rtl_expr),
1123 NULL_TREE, rtl_expr, expr);
1124 delete_block (expr);
1129 if (expr && TREE_CODE (expr) == BLOCK)
1130 /* Remove the block from the tree at this point. It gets put back
1131 at the proper place when the STMT_EXPR or BIND_EXPR is
1133 delete_block (expr);
1138 /* Finish a call to FN with ARGS. Returns a representation of the
1142 finish_call_expr (fn, args, koenig)
1151 if (TREE_CODE (fn) == BIT_NOT_EXPR)
1152 fn = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND (fn, 0));
1153 else if (TREE_CODE (fn) != TEMPLATE_ID_EXPR)
1154 fn = do_identifier (fn, 2, args);
1156 result = build_x_function_call (fn, args, current_class_ref);
1158 if (TREE_CODE (result) == CALL_EXPR
1159 && (! TREE_TYPE (result)
1160 || TREE_CODE (TREE_TYPE (result)) != VOID_TYPE))
1161 result = require_complete_type (result);
1166 /* Finish a call to a postfix increment or decrement or EXPR. (Which
1167 is indicated by CODE, which should be POSTINCREMENT_EXPR or
1168 POSTDECREMENT_EXPR.) */
1171 finish_increment_expr (expr, code)
1173 enum tree_code code;
1175 /* If we get an OFFSET_REF, turn it into what it really means (e.g.,
1176 a COMPONENT_REF). This way if we've got, say, a reference to a
1177 static member that's being operated on, we don't end up trying to
1178 find a member operator for the class it's in. */
1180 if (TREE_CODE (expr) == OFFSET_REF)
1181 expr = resolve_offset_ref (expr);
1182 return build_x_unary_op (code, expr);
1185 /* Finish a use of `this'. Returns an expression for `this'. */
1192 if (current_class_ptr)
1194 #ifdef WARNING_ABOUT_CCD
1195 TREE_USED (current_class_ptr) = 1;
1197 result = current_class_ptr;
1199 else if (current_function_decl
1200 && DECL_STATIC_FUNCTION_P (current_function_decl))
1202 error ("`this' is unavailable for static member functions");
1203 result = error_mark_node;
1207 if (current_function_decl)
1208 error ("invalid use of `this' in non-member function");
1210 error ("invalid use of `this' at top level");
1211 result = error_mark_node;
1217 /* Finish a member function call using OBJECT and ARGS as arguments to
1218 FN. Returns an expression for the call. */
1221 finish_object_call_expr (fn, object, args)
1227 /* This is a future direction of this code, but because
1228 build_x_function_call cannot always undo what is done in
1229 build_component_ref entirely yet, we cannot do this. */
1231 tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
1232 return finish_call_expr (real_fn, args);
1234 if (TREE_CODE (fn) == TYPE_DECL)
1236 if (processing_template_decl)
1237 /* This can happen on code like:
1240 template <class T> void f(T t) {
1244 We just grab the underlying IDENTIFIER. */
1245 fn = DECL_NAME (fn);
1248 cp_error ("calling type `%T' like a method", fn);
1249 return error_mark_node;
1253 return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
1257 /* Finish a qualified member function call using OBJECT and ARGS as
1258 arguments to FN. Returns an expressino for the call. */
1261 finish_qualified_object_call_expr (fn, object, args)
1266 return build_scoped_method_call (object, TREE_OPERAND (fn, 0),
1267 TREE_OPERAND (fn, 1), args);
1270 /* Finish a pseudo-destructor call expression of OBJECT, with SCOPE
1271 being the scope, if any, of DESTRUCTOR. Returns an expression for
1275 finish_pseudo_destructor_call_expr (object, scope, destructor)
1280 if (processing_template_decl)
1281 return build_min_nt (PSEUDO_DTOR_EXPR, object, scope, destructor);
1283 if (scope && scope != destructor)
1284 cp_error ("destructor specifier `%T::~%T()' must have matching names",
1287 if ((scope == NULL_TREE || IDENTIFIER_GLOBAL_VALUE (destructor))
1288 && (TREE_CODE (TREE_TYPE (object)) !=
1289 TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (destructor)))))
1290 cp_error ("`%E' is not of type `%T'", object, destructor);
1292 return cp_convert (void_type_node, object);
1295 /* Finish a call to a globally qualified member function FN using
1296 ARGS. Returns an expression for the call. */
1299 finish_qualified_call_expr (fn, args)
1303 if (processing_template_decl)
1304 return build_min_nt (CALL_EXPR, fn, args, NULL_TREE);
1306 return build_member_call (TREE_OPERAND (fn, 0),
1307 TREE_OPERAND (fn, 1),
1311 /* Finish an expression taking the address of LABEL. Returns an
1312 expression for the address. */
1315 finish_label_address_expr (label)
1320 label = lookup_label (label);
1321 if (label == NULL_TREE)
1322 result = null_pointer_node;
1325 TREE_USED (label) = 1;
1326 result = build1 (ADDR_EXPR, ptr_type_node, label);
1327 TREE_CONSTANT (result) = 1;
1333 /* Finish an expression of the form CODE EXPR. */
1336 finish_unary_op_expr (code, expr)
1337 enum tree_code code;
1340 tree result = build_x_unary_op (code, expr);
1341 if (code == NEGATE_EXPR && TREE_CODE (expr) == INTEGER_CST)
1342 TREE_NEGATED_INT (result) = 1;
1343 overflow_warning (result);
1347 /* Finish an id-expression. */
1350 finish_id_expr (expr)
1353 if (TREE_CODE (expr) == IDENTIFIER_NODE)
1354 expr = do_identifier (expr, 1, NULL_TREE);
1359 /* Begin a new-placement. */
1362 begin_new_placement ()
1364 /* The arguments to a placement new might be passed to a
1365 deallocation function, in the event that the allocation throws an
1366 exception. Since we don't expand exception handlers until the
1367 end of a function, we must make sure the arguments stay around
1369 return suspend_momentary ();
1372 /* Finish a new-placement. The ARGS are the placement arguments. The
1373 COOKIE is the value returned by the previous call to
1374 begin_new_placement. */
1377 finish_new_placement (args, cookie)
1381 resume_momentary (cookie);
1385 /* Begin a function defniition declared with DECL_SPECS and
1386 DECLARATOR. Returns non-zero if the function-declaration is
1390 begin_function_definition (decl_specs, declarator)
1396 split_specs_attrs (decl_specs, &specs, &attrs);
1397 if (!start_function (specs, declarator, attrs, SF_DEFAULT))
1400 reinit_parse_for_function ();
1401 /* The things we're about to see are not directly qualified by any
1402 template headers we've seen thus far. */
1403 reset_specialization ();
1408 /* Begin a constructor declarator of the form `SCOPE::NAME'. Returns
1412 begin_constructor_declarator (scope, name)
1416 tree result = build_parse_node (SCOPE_REF, scope, name);
1417 enter_scope_of (result);
1421 /* Finish an init-declarator. Returns a DECL. */
1424 finish_declarator (declarator, declspecs, attributes,
1425 prefix_attributes, initialized)
1429 tree prefix_attributes;
1432 return start_decl (declarator, declspecs, initialized, attributes,
1436 /* Finish a translation unit. */
1439 finish_translation_unit ()
1441 /* In case there were missing closebraces,
1442 get us back to the global binding level. */
1443 while (! toplevel_bindings_p ())
1445 while (current_namespace != global_namespace)
1450 /* Finish a template type parameter, specified as AGGR IDENTIFIER.
1451 Returns the parameter. */
1454 finish_template_type_parm (aggr, identifier)
1458 if (aggr != class_type_node)
1460 pedwarn ("template type parameters must use the keyword `class' or `typename'");
1461 aggr = class_type_node;
1464 return build_tree_list (aggr, identifier);
1467 /* Finish a template template parameter, specified as AGGR IDENTIFIER.
1468 Returns the parameter. */
1471 finish_template_template_parm (aggr, identifier)
1475 tree decl = build_decl (TYPE_DECL, identifier, NULL_TREE);
1476 tree tmpl = build_lang_decl (TEMPLATE_DECL, identifier, NULL_TREE);
1477 DECL_TEMPLATE_PARMS (tmpl) = current_template_parms;
1478 DECL_TEMPLATE_RESULT (tmpl) = decl;
1479 SET_DECL_ARTIFICIAL (decl);
1480 end_template_decl ();
1482 return finish_template_type_parm (aggr, tmpl);
1485 /* Finish a parameter list, indicated by PARMS. If ELLIPSIS is
1486 non-zero, the parameter list was terminated by a `...'. */
1489 finish_parmlist (parms, ellipsis)
1494 chainon (parms, void_list_node);
1495 /* We mark the PARMS as a parmlist so that declarator processing can
1496 disambiguate certain constructs. */
1497 if (parms != NULL_TREE)
1498 TREE_PARMLIST (parms) = 1;
1503 /* Begin a class definition, as indicated by T. */
1506 begin_class_definition (t)
1509 push_permanent_obstack ();
1511 if (t == error_mark_node
1512 || ! IS_AGGR_TYPE (t))
1514 t = make_lang_type (RECORD_TYPE);
1515 pushtag (make_anon_name (), t, 0);
1518 /* In a definition of a member class template, we will get here with an
1519 implicit typename, a TYPENAME_TYPE with a type. */
1520 if (TREE_CODE (t) == TYPENAME_TYPE)
1523 /* If we generated a partial instantiation of this type, but now
1524 we're seeing a real definition, we're actually looking at a
1525 partial specialization. Consider:
1527 template <class T, class U>
1533 template <class T, class U>
1536 typename X<Y<T, U> >::A a;
1539 template <class T, class U>
1544 We have to undo the effects of the previous partial
1546 if (PARTIAL_INSTANTIATION_P (t))
1550 /* Unfortunately, when we're not in pedantic mode, we
1551 attempt to actually fill in some of the fields of the
1552 partial instantiation, in order to support the implicit
1553 typename extension. Clear those fields now, in
1554 preparation for the definition here. The fields cleared
1555 here must match those set in instantiate_class_template.
1556 Look for a comment mentioning begin_class_definition
1558 TYPE_BINFO_BASETYPES (t) = NULL_TREE;
1559 TYPE_FIELDS (t) = NULL_TREE;
1560 TYPE_METHODS (t) = NULL_TREE;
1561 CLASSTYPE_TAGS (t) = NULL_TREE;
1562 TYPE_SIZE (t) = NULL_TREE;
1565 /* This isn't a partial instantiation any more. */
1566 PARTIAL_INSTANTIATION_P (t) = 0;
1568 /* If this type was already complete, and we see another definition,
1570 else if (TYPE_SIZE (t))
1571 duplicate_tag_error (t);
1573 /* Update the location of the decl. */
1574 DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
1575 DECL_SOURCE_LINE (TYPE_NAME (t)) = lineno;
1577 if (TYPE_BEING_DEFINED (t))
1579 t = make_lang_type (TREE_CODE (t));
1580 pushtag (TYPE_IDENTIFIER (t), t, 0);
1582 maybe_process_partial_specialization (t);
1584 TYPE_BEING_DEFINED (t) = 1;
1585 /* Reset the interface data, at the earliest possible
1586 moment, as it might have been set via a class foo;
1589 tree name = TYPE_IDENTIFIER (t);
1591 if (! ANON_AGGRNAME_P (name))
1593 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
1594 SET_CLASSTYPE_INTERFACE_UNKNOWN_X
1595 (t, interface_unknown);
1598 /* Only leave this bit clear if we know this
1599 class is part of an interface-only specification. */
1600 if (! CLASSTYPE_INTERFACE_KNOWN (t)
1601 || ! CLASSTYPE_INTERFACE_ONLY (t))
1602 CLASSTYPE_VTABLE_NEEDS_WRITING (t) = 1;
1605 tmp = TYPE_IDENTIFIER ($<ttype>0);
1606 if (tmp && IDENTIFIER_TEMPLATE (tmp))
1607 overload_template_name (tmp, 1);
1609 reset_specialization();
1611 /* In case this is a local class within a template
1612 function, we save the current tree structure so
1613 that we can get it back later. */
1616 /* Make a declaration for this class in its own scope. */
1617 build_self_reference ();
1622 /* Finish the member declaration given by DECL. */
1625 finish_member_declaration (decl)
1628 if (decl == error_mark_node || decl == NULL_TREE)
1631 if (decl == void_type_node)
1632 /* The COMPONENT was a friend, not a member, and so there's
1633 nothing for us to do. */
1636 /* We should see only one DECL at a time. */
1637 my_friendly_assert (TREE_CHAIN (decl) == NULL_TREE, 0);
1639 /* Set up access control for DECL. */
1641 = (current_access_specifier == access_private_node);
1642 TREE_PROTECTED (decl)
1643 = (current_access_specifier == access_protected_node);
1644 if (TREE_CODE (decl) == TEMPLATE_DECL)
1646 TREE_PRIVATE (DECL_RESULT (decl)) = TREE_PRIVATE (decl);
1647 TREE_PROTECTED (DECL_RESULT (decl)) = TREE_PROTECTED (decl);
1650 /* Mark the DECL as a member of the current class. */
1651 if (TREE_CODE (decl) == FUNCTION_DECL
1652 || DECL_FUNCTION_TEMPLATE_P (decl))
1653 /* Historically, DECL_CONTEXT was not set for a FUNCTION_DECL in
1654 finish_struct. Presumably it is already set as the function is
1655 parsed. Perhaps DECL_CLASS_CONTEXT is already set, too? */
1656 DECL_CLASS_CONTEXT (decl) = current_class_type;
1658 DECL_CONTEXT (decl) = current_class_type;
1660 /* Put functions on the TYPE_METHODS list and everything else on the
1661 TYPE_FIELDS list. Note that these are built up in reverse order.
1662 We reverse them (to obtain declaration order) in finish_struct. */
1663 if (TREE_CODE (decl) == FUNCTION_DECL
1664 || DECL_FUNCTION_TEMPLATE_P (decl))
1666 /* We also need to add this function to the
1667 CLASSTYPE_METHOD_VEC. */
1668 add_method (current_class_type, 0, decl);
1670 TREE_CHAIN (decl) = TYPE_METHODS (current_class_type);
1671 TYPE_METHODS (current_class_type) = decl;
1675 /* All TYPE_DECLs go at the end of TYPE_FIELDS. Ordinary fields
1676 go at the beginning. The reason is that lookup_field_1
1677 searches the list in order, and we want a field name to
1678 override a type name so that the "struct stat hack" will
1679 work. In particular:
1681 struct S { enum E { }; int E } s;
1684 is legal. In addition, the FIELD_DECLs must be maintained in
1685 declaration order so that class layout works as expected.
1686 However, we don't need that order until class layout, so we
1687 save a little time by putting FIELD_DECLs on in reverse order
1688 here, and then reversing them in finish_struct_1. (We could
1689 also keep a pointer to the correct insertion points in the
1692 if (TREE_CODE (decl) == TYPE_DECL)
1693 TYPE_FIELDS (current_class_type)
1694 = chainon (TYPE_FIELDS (current_class_type), decl);
1697 TREE_CHAIN (decl) = TYPE_FIELDS (current_class_type);
1698 TYPE_FIELDS (current_class_type) = decl;
1701 /* Enter the DECL into the scope of the class. */
1702 if (TREE_CODE (decl) != USING_DECL)
1703 pushdecl_class_level (decl);
1707 /* Finish a class definition T with the indicate ATTRIBUTES. If SEMI,
1708 the definition is immediately followed by a semicolon. Returns the
1712 finish_class_definition (t, attributes, semi, pop_scope_p)
1718 /* finish_struct nukes this anyway; if finish_exception does too,
1721 note_got_semicolon (t);
1723 /* If we got any attributes in class_head, xref_tag will stick them in
1724 TREE_TYPE of the type. Grab them now. */
1725 attributes = chainon (TREE_TYPE (t), attributes);
1726 TREE_TYPE (t) = NULL_TREE;
1728 if (TREE_CODE (t) == ENUMERAL_TYPE)
1732 t = finish_struct (t, attributes);
1734 note_got_semicolon (t);
1740 check_for_missing_semicolon (t);
1742 pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (t)));
1743 if (current_scope () == current_function_decl)
1744 do_pending_defargs ();
1749 /* Finish processing the default argument expressions cached during
1750 the processing of a class definition. */
1753 begin_inline_definitions ()
1756 && current_scope () == current_function_decl)
1757 do_pending_inlines ();
1760 /* Finish processing the inline function definitions cached during the
1761 processing of a class definition. */
1764 finish_inline_definitions ()
1766 if (current_class_type == NULL_TREE)
1767 clear_inline_text_obstack ();
1769 /* Undo the begin_tree in begin_class_definition. */
1773 /* Finish processing the declaration of a member class template
1774 TYPES whose template parameters are given by PARMS. */
1777 finish_member_class_template (types)
1782 /* If there are declared, but undefined, partial specializations
1783 mixed in with the typespecs they will not yet have passed through
1784 maybe_process_partial_specialization, so we do that here. */
1785 for (t = types; t != NULL_TREE; t = TREE_CHAIN (t))
1786 if (IS_AGGR_TYPE_CODE (TREE_CODE (TREE_VALUE (t))))
1787 maybe_process_partial_specialization (TREE_VALUE (t));
1789 note_list_got_semicolon (types);
1790 grok_x_components (types);
1791 if (TYPE_CONTEXT (TREE_VALUE (types)) != current_class_type)
1792 /* The component was in fact a friend declaration. We avoid
1793 finish_member_template_decl performing certain checks by
1797 finish_member_template_decl (types);
1799 /* As with other component type declarations, we do
1800 not store the new DECL on the list of
1805 /* Finish processsing a complete template declaration. The PARMS are
1806 the template parameters. */
1809 finish_template_decl (parms)
1813 end_template_decl ();
1815 end_specialization ();
1818 /* Finish processing a a template-id (which names a type) of the form
1819 NAME < ARGS >. Return the TYPE_DECL for the type named by the
1820 template-id. If ENTERING_SCOPE is non-zero we are about to enter
1821 the scope of template-id indicated. */
1824 finish_template_type (name, args, entering_scope)
1831 decl = lookup_template_class (name, args,
1832 NULL_TREE, NULL_TREE, entering_scope);
1833 if (decl != error_mark_node)
1834 decl = TYPE_STUB_DECL (decl);
1839 /* SR is a SCOPE_REF node. Enter the scope of SR, whether it is a
1840 namespace scope or a class scope. */
1846 tree scope = TREE_OPERAND (sr, 0);
1848 if (TREE_CODE (scope) == NAMESPACE_DECL)
1850 push_decl_namespace (scope);
1851 TREE_COMPLEXITY (sr) = -1;
1853 else if (scope != current_class_type)
1855 if (TREE_CODE (scope) == TYPENAME_TYPE)
1857 /* In a declarator for a template class member, the scope will
1858 get here as an implicit typename, a TYPENAME_TYPE with a type. */
1859 scope = TREE_TYPE (scope);
1860 TREE_OPERAND (sr, 0) = scope;
1862 push_nested_class (scope, 3);
1863 TREE_COMPLEXITY (sr) = current_class_depth;
1867 /* Finish processing a BASE_CLASS with the indicated ACCESS_SPECIFIER.
1868 Return a TREE_LIST containing the ACCESS_SPECIFIER and the
1869 BASE_CLASS, or NULL_TREE if an error occurred. The
1870 ACCESSS_SPECIFIER is one of
1871 access_{default,public,protected_private}[_virtual]_node.*/
1874 finish_base_specifier (access_specifier, base_class)
1875 tree access_specifier;
1881 if (base_class == NULL_TREE)
1883 error ("invalid base class");
1884 type = error_mark_node;
1887 type = TREE_TYPE (base_class);
1889 if (! is_aggr_type (type, 1))
1892 result = build_tree_list (access_specifier, type);
1897 /* Called when multiple declarators are processed. If that is not
1898 premitted in this context, an error is issued. */
1901 check_multiple_declarators ()
1905 In a template-declaration, explicit specialization, or explicit
1906 instantiation the init-declarator-list in the declaration shall
1907 contain at most one declarator.
1909 We don't just use PROCESSING_TEMPLATE_DECL for the first
1910 condition since that would disallow the perfectly legal code,
1911 like `template <class T> struct S { int i, j; };'. */
1912 tree scope = current_scope ();
1914 if (scope && TREE_CODE (scope) == FUNCTION_DECL)
1915 /* It's OK to write `template <class T> void f() { int i, j;}'. */
1918 if (PROCESSING_REAL_TEMPLATE_DECL_P ()
1919 || processing_explicit_instantiation
1920 || processing_specialization)
1921 cp_error ("multiple declarators in template declaration");
1925 finish_typeof (expr)
1928 if (processing_template_decl)
1932 push_permanent_obstack ();
1933 t = make_lang_type (TYPEOF_TYPE);
1934 TYPE_FIELDS (t) = expr;
1940 return TREE_TYPE (expr);
1943 /* Create an empty statement tree for FN. */
1946 begin_stmt_tree (fn)
1949 /* We create a trivial EXPR_STMT so that last_tree is never NULL in
1950 what follows. We remove the extraneous statement in
1951 finish_stmt_tree. */
1952 DECL_SAVED_TREE (fn) = build_nt (EXPR_STMT, void_zero_node);
1953 last_tree = DECL_SAVED_TREE (fn);
1954 last_expr_type = NULL_TREE;
1957 /* Finish the statement tree for FN. */
1960 finish_stmt_tree (fn)
1963 DECL_SAVED_TREE (fn) = TREE_CHAIN (DECL_SAVED_TREE (fn));
1966 /* Generate RTL for the chain of statements T. */
1979 /* Generate RTL for the statement T, and its substatements. */
1985 if (t == NULL_TREE || t == error_mark_node)
1988 switch (TREE_CODE (t))
1991 lineno = STMT_LINENO (t);
1992 finish_return_stmt (RETURN_EXPR (t));
1996 lineno = STMT_LINENO (t);
1997 finish_expr_stmt (EXPR_STMT_EXPR (t));
2003 int i = suspend_momentary ();
2005 lineno = STMT_LINENO (t);
2006 emit_line_note (input_filename, lineno);
2007 decl = DECL_STMT_DECL (t);
2008 if (TREE_CODE (decl) == LABEL_DECL)
2009 finish_label_decl (DECL_NAME (decl));
2012 /* We need to clear DECL_CONTEXT so that maybe_push_decl
2013 will push it into the current scope. */
2014 if (DECL_CONTEXT (decl) == current_function_decl)
2015 DECL_CONTEXT (decl) = NULL_TREE;
2016 /* If we marked this variable as dead when we processed it
2017 before, we must undo that now. The variable has been
2019 if (TREE_CODE (decl) == VAR_DECL)
2020 DECL_DEAD_FOR_LOCAL (decl) = 0;
2021 maybe_push_decl (decl);
2022 if (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl))
2024 maybe_inject_for_scope_var (decl);
2025 initialize_local_var (decl, DECL_INITIAL (decl), 0);
2028 resume_momentary (i);
2036 lineno = STMT_LINENO (t);
2038 for (tmp = FOR_INIT_STMT (t); tmp; tmp = TREE_CHAIN (tmp))
2040 finish_for_init_stmt (NULL_TREE);
2041 finish_for_cond (FOR_COND (t), NULL_TREE);
2043 finish_for_expr (tmp, NULL_TREE);
2044 expand_stmt (FOR_BODY (t));
2045 finish_for_stmt (tmp, NULL_TREE);
2051 lineno = STMT_LINENO (t);
2052 begin_while_stmt ();
2053 finish_while_stmt_cond (WHILE_COND (t), NULL_TREE);
2054 expand_stmt (WHILE_BODY (t));
2055 finish_while_stmt (NULL_TREE);
2061 lineno = STMT_LINENO (t);
2063 expand_stmt (DO_BODY (t));
2064 finish_do_body (NULL_TREE);
2065 finish_do_stmt (DO_COND (t), NULL_TREE);
2070 lineno = STMT_LINENO (t);
2072 finish_if_stmt_cond (IF_COND (t), NULL_TREE);
2073 if (THEN_CLAUSE (t))
2075 expand_stmt (THEN_CLAUSE (t));
2076 finish_then_clause (NULL_TREE);
2078 if (ELSE_CLAUSE (t))
2080 begin_else_clause ();
2081 expand_stmt (ELSE_CLAUSE (t));
2082 finish_else_clause (NULL_TREE);
2088 lineno = STMT_LINENO (t);
2089 begin_compound_stmt (COMPOUND_STMT_NO_SCOPE (t));
2090 expand_stmts (COMPOUND_BODY (t));
2091 return finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t),
2095 lineno = STMT_LINENO (t);
2096 finish_break_stmt ();
2100 lineno = STMT_LINENO (t);
2101 finish_continue_stmt ();
2105 lineno = STMT_LINENO (t);
2106 begin_switch_stmt ();
2107 finish_switch_cond (SWITCH_COND (t));
2108 if (TREE_OPERAND (t, 1))
2109 expand_stmt (SWITCH_BODY (t));
2110 finish_switch_stmt (SWITCH_COND (t), NULL_TREE);
2114 finish_case_label (CASE_LOW (t), CASE_HIGH (t));
2118 lineno = STMT_LINENO (t);
2119 finish_label_stmt (DECL_NAME (LABEL_STMT_LABEL (t)));
2123 lineno = STMT_LINENO (t);
2124 if (TREE_CODE (GOTO_DESTINATION (t)) == LABEL_DECL)
2125 finish_goto_stmt (DECL_NAME (GOTO_DESTINATION (t)));
2127 finish_goto_stmt (GOTO_DESTINATION (t));
2131 lineno = STMT_LINENO (t);
2132 finish_asm_stmt (ASM_CV_QUAL (t), ASM_STRING (t), ASM_OUTPUTS
2133 (t), ASM_INPUTS (t), ASM_CLOBBERS (t));
2137 lineno = STMT_LINENO (t);
2140 expand_eh_region_start ();
2141 expand_stmt (TRY_STMTS (t));
2142 finish_cleanup (TRY_HANDLERS (t), NULL_TREE);
2147 expand_stmt (TRY_STMTS (t));
2148 finish_try_block (NULL_TREE);
2149 expand_stmts (TRY_HANDLERS (t));
2150 finish_handler_sequence (NULL_TREE);
2155 lineno = STMT_LINENO (t);
2157 if (HANDLER_PARMS (t))
2158 expand_start_catch_block (DECL_STMT_DECL (HANDLER_PARMS (t)));
2160 expand_start_catch_block (NULL_TREE);
2161 finish_handler_parms (NULL_TREE);
2162 expand_stmt (HANDLER_BODY (t));
2163 finish_handler (NULL_TREE);
2167 lineno = STMT_LINENO (t);
2168 finish_subobject (SUBOBJECT_CLEANUP (t));
2172 my_friendly_abort (19990810);
2179 /* Generate RTL for FN. */
2188 start_function (NULL_TREE, fn, NULL_TREE, SF_PRE_PARSED | SF_EXPAND);
2189 store_parm_decls ();
2191 /* There are a few things that we do not handle recursively. For
2192 example, a function try-block is handled differently from an
2193 ordinary try-block, so we must handle it here. */
2194 t = DECL_SAVED_TREE (fn);
2195 try_block = NULL_TREE;
2196 if (t && TREE_CODE (t) == TRY_BLOCK)
2199 begin_function_try_block ();
2200 t = TRY_STMTS (try_block);
2203 if (t && TREE_CODE (t) == RETURN_INIT)
2205 /* Clear this out so that finish_named_return_value can set it
2207 DECL_NAME (DECL_RESULT (fn)) = NULL_TREE;
2208 finish_named_return_value (TREE_OPERAND (t, 0), TREE_OPERAND (t, 1));
2212 if (t && TREE_CODE (t) == CTOR_INITIALIZER)
2214 current_member_init_list = TREE_OPERAND (t, 0);
2215 current_base_init_list = TREE_OPERAND (t, 1);
2219 /* If this is a constructor, we need to initialize our members and
2223 /* Expand the body. */
2226 /* If there was a function try-block, expand the handlers. */
2229 finish_function_try_block (NULL_TREE);
2231 tree handler = TRY_HANDLERS (try_block);
2232 for (; handler; handler = TREE_CHAIN (handler))
2233 expand_stmt (handler);
2235 finish_function_handler_sequence (NULL_TREE);
2238 finish_function (lineno, 0);