OSDN Git Service

* cp-tree.h (finish_cleanup_try_block): New function.
[pf3gnuchains/gcc-fork.git] / gcc / cp / semantics.c
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. 
5
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.  
9
10    This file is part of GNU CC.
11
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)
15    any later version.
16    
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.
21    
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
25    02111-1307, USA.  */
26
27 #include "config.h"
28 #include "system.h"
29 #include "tree.h"
30 #include "cp-tree.h"
31 #include "except.h"
32 #include "lex.h"
33 #include "toplev.h"
34
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.  */
43
44 static void do_pushlevel PROTO((void));
45 static tree do_poplevel PROTO((void));
46 static void finish_expr_stmt_real PROTO((tree, int));
47 static tree expand_cond PROTO((tree));
48
49 /* When parsing a template, LAST_TREE contains the last statement
50    parsed.  These are chained together through the TREE_CHAIN field,
51    but often need to be re-organized since the parse is performed
52    bottom-up.  This macro makes LAST_TREE the indicated SUBSTMT of
53    STMT.  */
54
55 #define RECHAIN_STMTS(stmt, substmt)    \
56   do {                                  \
57     substmt = TREE_CHAIN (stmt);        \
58     TREE_CHAIN (stmt) = NULL_TREE;      \
59     last_tree = stmt;                   \
60   } while (0)
61
62 /* Finish processing the COND, the SUBSTMT condition for STMT.  */
63
64 #define FINISH_COND(cond, stmt, substmt)        \
65   do {                                          \
66     if (last_tree != stmt)                      \
67       RECHAIN_STMTS (stmt, substmt);            \
68     else                                        \
69       substmt = cond;                           \
70   } while (0)
71   
72 /* T is a statement.  Add it to the statement-tree.  */
73
74 void
75 add_tree (t)
76      tree t;
77 {
78   /* Add T to the statement-tree.  */
79   last_tree = TREE_CHAIN (last_tree) = t;
80
81   /* When we expand a statement-tree, we must know whether or not the
82      statements are full-expresions.  We record that fact here.  */
83   if (building_stmt_tree ())
84     STMT_IS_FULL_EXPR_P (last_tree) = stmts_are_full_exprs_p;
85 }
86
87 /* Finish an expression-statement, whose EXPRESSION is as indicated.
88    If ASSIGNED_THIS is non-zero, then this statement just assigned to
89    the `this' pointer.  */
90
91 static void 
92 finish_expr_stmt_real (expr, assigned_this)
93      tree expr;
94      int assigned_this;
95 {
96   if (expr != NULL_TREE)
97     {
98       if (building_stmt_tree ())
99         add_tree (build_min_nt (EXPR_STMT, expr));
100       else
101         {
102           emit_line_note (input_filename, lineno);
103           /* Do default conversion if safe and possibly important,
104              in case within ({...}).  */
105           if (!stmts_are_full_exprs_p &&
106               ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
107                 && lvalue_p (expr))
108                || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE))
109             expr = default_conversion (expr);
110
111           if (stmts_are_full_exprs_p)
112             expand_start_target_temps ();
113             
114           cplus_expand_expr_stmt (expr);
115
116           if (stmts_are_full_exprs_p)
117             {
118               expand_end_target_temps ();
119               clear_momentary ();
120             }
121         }
122     }
123
124   /* If this statement assigned to the `this' pointer, record that
125      fact for finish_stmt.  */
126   if (assigned_this)
127     current_function_just_assigned_this = 1;
128
129   finish_stmt ();
130
131   /* This was an expression-statement, so we save the type of the
132      expression.  */
133   last_expr_type = expr ? TREE_TYPE (expr) : NULL_TREE;
134 }
135
136 /* Like finish_expr_stmt_real, but ASSIGNS_THIS is always zero.  */
137
138 void
139 finish_expr_stmt (expr)
140      tree expr;
141 {
142   finish_expr_stmt_real (expr, /*assigns_this=*/0);
143 }
144
145 /* Begin an if-statement.  Returns a newly created IF_STMT if
146    appropriate.  */
147
148 tree
149 begin_if_stmt ()
150 {
151   tree r;
152
153   if (building_stmt_tree ())
154     {
155       r = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
156       add_tree (r);
157     }
158   else
159     r = NULL_TREE;
160
161   do_pushlevel ();
162
163   return r;
164 }
165
166 /* Process the COND of an if-statement, which may be given by
167    IF_STMT.  */
168
169 void 
170 finish_if_stmt_cond (cond, if_stmt)
171      tree cond;
172      tree if_stmt;
173 {
174   if (building_stmt_tree ())
175     FINISH_COND (cond, if_stmt, IF_COND (if_stmt));
176   else
177     {
178       emit_line_note (input_filename, lineno);
179       expand_start_cond (condition_conversion (cond), 0);
180     }
181 }
182
183 /* Finish the then-clause of an if-statement, which may be given by
184    IF_STMT.  */
185
186 tree
187 finish_then_clause (if_stmt)
188      tree if_stmt;
189 {
190   if (building_stmt_tree ())
191     {
192       RECHAIN_STMTS (if_stmt, THEN_CLAUSE (if_stmt));
193       last_tree = if_stmt;
194       return if_stmt;
195     }
196   else
197     return NULL_TREE;
198 }
199
200 /* Begin the else-clause of an if-statement.  */
201
202 void 
203 begin_else_clause ()
204 {
205   if (!building_stmt_tree ())
206     expand_start_else ();
207 }
208
209 /* Finish the else-clause of an if-statement, which may be given by
210    IF_STMT.  */
211
212 void
213 finish_else_clause (if_stmt)
214      tree if_stmt;
215 {
216   if (building_stmt_tree ())
217     RECHAIN_STMTS (if_stmt, ELSE_CLAUSE (if_stmt));
218 }
219
220 /* Finsh an if-statement.  */
221
222 void 
223 finish_if_stmt ()
224 {
225   if (!building_stmt_tree ())
226     expand_end_cond ();
227
228   do_poplevel ();
229   finish_stmt ();
230 }
231
232 /* Begin a while-statement.  Returns a newly created WHILE_STMT if
233    appropriate.  */
234
235 tree
236 begin_while_stmt ()
237 {
238   tree r;
239
240   if (building_stmt_tree ())
241     {
242       r = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
243       add_tree (r);
244     }
245   else
246     {
247       emit_nop ();
248       emit_line_note (input_filename, lineno);
249       expand_start_loop (1); 
250       r = NULL_TREE;
251     }
252
253   do_pushlevel ();
254
255   return r;
256 }
257
258 /* Process the COND of an if-statement, which may be given by
259    WHILE_STMT.  */
260
261 void 
262 finish_while_stmt_cond (cond, while_stmt)
263      tree cond;
264      tree while_stmt;
265 {
266   if (building_stmt_tree ())
267     FINISH_COND (cond, while_stmt, WHILE_COND (while_stmt));
268   else
269     {
270       emit_line_note (input_filename, lineno);
271       expand_exit_loop_if_false (0, condition_conversion (cond));
272     }
273
274   /* If COND wasn't a declaration, clear out the
275      block we made for it and start a new one here so the
276      optimization in expand_end_loop will work.  */
277   if (getdecls () == NULL_TREE)
278     {
279       do_poplevel ();
280       do_pushlevel ();
281     }
282 }
283
284 /* Finish a while-statement, which may be given by WHILE_STMT.  */
285
286 void 
287 finish_while_stmt (while_stmt)
288      tree while_stmt;
289 {
290   do_poplevel ();
291
292   if (building_stmt_tree ())
293     RECHAIN_STMTS (while_stmt, WHILE_BODY (while_stmt));
294   else
295     expand_end_loop ();
296   finish_stmt ();
297 }
298
299 /* Begin a do-statement.  Returns a newly created DO_STMT if
300    appropriate.  */
301
302 tree
303 begin_do_stmt ()
304 {
305   if (building_stmt_tree ())
306     {
307       tree r = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
308       add_tree (r);
309       return r;
310     }
311   else
312     {
313       emit_nop ();
314       emit_line_note (input_filename, lineno);
315       expand_start_loop_continue_elsewhere (1);
316       return NULL_TREE;
317     }
318 }
319
320 /* Finish the body of a do-statement, which may be given by DO_STMT.  */
321
322 void
323 finish_do_body (do_stmt)
324      tree do_stmt;
325 {
326   if (building_stmt_tree ())
327     RECHAIN_STMTS (do_stmt, DO_BODY (do_stmt));
328   else
329     expand_loop_continue_here ();
330 }
331
332 /* Finish a do-statement, which may be given by DO_STMT, and whose
333    COND is as indicated.  */
334
335 void
336 finish_do_stmt (cond, do_stmt)
337      tree cond;
338      tree do_stmt;
339 {
340   if (building_stmt_tree ())
341     DO_COND (do_stmt) = cond;
342   else
343     {
344       emit_line_note (input_filename, lineno);
345       expand_exit_loop_if_false (0, condition_conversion (cond));
346       expand_end_loop ();
347     }
348
349   clear_momentary ();
350   finish_stmt ();
351 }
352
353 /* Finish a return-statement.  The EXPRESSION returned, if any, is as
354    indicated.  */
355
356 void
357 finish_return_stmt (expr)
358      tree expr;
359 {
360   if (building_stmt_tree ())
361     add_tree (build_min_nt (RETURN_STMT, expr));
362   else
363     {
364       emit_line_note (input_filename, lineno);
365       c_expand_return (expr);
366     }
367
368   finish_stmt ();
369 }
370
371 /* Begin a for-statement.  Returns a new FOR_STMT if appropriate.  */
372
373 tree
374 begin_for_stmt ()
375 {
376   tree r;
377
378   if (building_stmt_tree ())
379     {
380       r = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE, 
381                         NULL_TREE, NULL_TREE);
382       add_tree (r);
383     }
384   else
385     r = NULL_TREE;
386
387   if (flag_new_for_scope > 0)
388     {
389       do_pushlevel ();
390       note_level_for_for ();
391     }
392
393   return r;
394 }
395
396 /* Finish the for-init-statement of a for-statement, which may be
397    given by FOR_STMT.  */
398
399 void
400 finish_for_init_stmt (for_stmt)
401      tree for_stmt;
402 {
403   if (building_stmt_tree ())
404     {
405       if (last_tree != for_stmt)
406         RECHAIN_STMTS (for_stmt, FOR_INIT_STMT (for_stmt));
407     }
408   else
409     {
410       emit_nop ();
411       emit_line_note (input_filename, lineno);
412       expand_start_loop_continue_elsewhere (1); 
413     }
414
415   do_pushlevel ();
416 }
417
418 /* Finish the COND of a for-statement, which may be given by
419    FOR_STMT.  */
420
421 void
422 finish_for_cond (cond, for_stmt)
423      tree cond;
424      tree for_stmt;
425 {
426   if (building_stmt_tree ())
427     FINISH_COND (cond, for_stmt, FOR_COND (for_stmt));
428   else
429     {
430       emit_line_note (input_filename, lineno);
431       if (cond)
432         expand_exit_loop_if_false (0, condition_conversion (cond));
433     }
434   
435   /* If the cond wasn't a declaration, clear out the
436      block we made for it and start a new one here so the
437      optimization in expand_end_loop will work.  */
438   if (getdecls () == NULL_TREE)
439     {
440       do_poplevel ();
441       do_pushlevel ();
442     }  
443 }
444
445 /* Finish the increment-EXPRESSION in a for-statement, which may be
446    given by FOR_STMT.  */
447
448 void
449 finish_for_expr (expr, for_stmt)
450      tree expr;
451      tree for_stmt;
452 {
453   if (building_stmt_tree ())
454     FOR_EXPR (for_stmt) = expr;
455
456   /* Don't let the tree nodes for EXPR be discarded
457      by clear_momentary during the parsing of the next stmt.  */
458   push_momentary ();
459 }
460
461 /* Finish the body of a for-statement, which may be given by
462    FOR_STMT.  The increment-EXPR for the loop must be
463    provided.  */
464
465 void
466 finish_for_stmt (expr, for_stmt)
467      tree expr;
468      tree for_stmt;
469 {
470   /* Pop the scope for the body of the loop.  */
471   do_poplevel ();
472
473   if (building_stmt_tree ())
474     RECHAIN_STMTS (for_stmt, FOR_BODY (for_stmt));
475   else
476     {
477       emit_line_note (input_filename, lineno);
478       expand_loop_continue_here ();
479       if (expr) 
480         finish_expr_stmt (expr);
481       expand_end_loop ();
482     }
483
484   pop_momentary ();
485
486   if (flag_new_for_scope > 0)
487     do_poplevel ();
488
489   finish_stmt (); 
490 }
491
492 /* Finish a break-statement.  */
493
494 void
495 finish_break_stmt ()
496 {
497   emit_line_note (input_filename, lineno);
498   if (building_stmt_tree ())
499     add_tree (build_min_nt (BREAK_STMT));
500   else if ( ! expand_exit_something ())
501     cp_error ("break statement not within loop or switch");
502 }
503
504 /* Finish a continue-statement.  */
505
506 void
507 finish_continue_stmt ()
508 {
509   emit_line_note (input_filename, lineno);
510   if (building_stmt_tree ())
511     add_tree (build_min_nt (CONTINUE_STMT));
512   else if (! expand_continue_loop (0))
513     cp_error ("continue statement not within a loop");   
514 }
515
516 /* Begin a switch-statement.  Returns a new SWITCH_STMT if
517    appropriate.  */
518
519 tree
520 begin_switch_stmt ()
521 {
522   tree r;
523
524   if (building_stmt_tree ())
525     {
526       r = build_min_nt (SWITCH_STMT, NULL_TREE, NULL_TREE);
527       add_tree (r);
528     }
529   else
530     r = NULL_TREE;
531
532   do_pushlevel ();
533
534   return r;
535 }
536
537 /* Finish the cond of a switch-statement.  */
538
539 void
540 finish_switch_cond (cond, switch_stmt)
541      tree cond;
542      tree switch_stmt;
543 {
544   if (building_stmt_tree ())
545     FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
546   else if (cond != error_mark_node)
547     {
548       emit_line_note (input_filename, lineno);
549       c_expand_start_case (cond);
550     }
551   else
552     /* The code is in error, but we don't want expand_end_case to
553        crash. */
554     c_expand_start_case (boolean_false_node);
555
556   push_switch ();
557
558   /* Don't let the tree nodes for COND be discarded by
559      clear_momentary during the parsing of the next stmt.  */
560   push_momentary ();
561 }
562
563 /* Finish the body of a switch-statement, which may be given by
564    SWITCH_STMT.  The COND to switch on is indicated.  */
565
566 void
567 finish_switch_stmt (cond, switch_stmt)
568      tree cond;
569      tree switch_stmt;
570 {
571   if (building_stmt_tree ())
572     RECHAIN_STMTS (switch_stmt, SWITCH_BODY (switch_stmt));
573   else
574     expand_end_case (cond);
575   pop_momentary ();
576   pop_switch (); 
577   do_poplevel ();
578   finish_stmt ();
579 }
580
581 /* Finish a case-label.  */
582
583 void 
584 finish_case_label (low_value, high_value)
585      tree low_value;
586      tree high_value;
587 {
588   if (building_stmt_tree ())
589     {
590       add_tree (build_min_nt (CASE_LABEL, low_value, high_value));
591       return;
592     }
593
594   do_case (low_value, high_value);
595 }
596
597 /* Finish a goto-statement.  */
598
599 void
600 finish_goto_stmt (destination)
601      tree destination;
602 {
603   if (TREE_CODE (destination) == IDENTIFIER_NODE)
604     destination = lookup_label (destination);
605
606   if (building_stmt_tree ())
607     add_tree (build_min_nt (GOTO_STMT, destination));
608   else
609     {
610       emit_line_note (input_filename, lineno);
611
612       if (TREE_CODE (destination) == LABEL_DECL)
613         {
614           TREE_USED (destination) = 1;
615           expand_goto (destination); 
616         }
617       else
618         expand_computed_goto (destination);
619     }
620 }
621
622 /* Begin a try-block.  Returns a newly-created TRY_BLOCK if
623    appropriate.  */
624
625 tree
626 begin_try_block ()
627 {
628   if (building_stmt_tree ())
629     {
630       tree r = build_min_nt (TRY_BLOCK, NULL_TREE,
631                              NULL_TREE);
632       add_tree (r);
633       return r;
634     }
635   else
636     {
637       emit_line_note (input_filename, lineno);
638       expand_start_try_stmts ();
639       return NULL_TREE;
640     }
641 }
642
643 /* Likewise, for a function-try-block.  */
644
645 tree
646 begin_function_try_block ()
647 {
648   if (building_stmt_tree ())
649     {
650       tree r = build_min_nt (TRY_BLOCK, NULL_TREE,
651                              NULL_TREE);
652       FN_TRY_BLOCK_P (r) = 1;
653       add_tree (r);
654       return r;
655     }
656   else
657     {
658       if (! current_function_parms_stored)
659         store_parm_decls ();
660       expand_start_early_try_stmts ();
661       return NULL_TREE;
662     }
663 }
664
665 /* Finish a try-block, which may be given by TRY_BLOCK.  */
666
667 void
668 finish_try_block (try_block)
669      tree try_block;
670 {
671   if (building_stmt_tree ())
672     RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
673   else
674     expand_start_all_catch ();  
675 }
676
677 /* Finish the body of a cleanup try-block, which may be given by
678    TRY_BLOCK.  */
679
680 void
681 finish_cleanup_try_block (try_block)
682      tree try_block;
683 {
684   if (building_stmt_tree ())
685     RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
686 }
687
688 /* Finish an implicitly generated try-block, with a cleanup is given
689    by CLEANUP.  */
690
691 void
692 finish_cleanup (cleanup, try_block)
693      tree cleanup;
694      tree try_block;
695 {
696   if (building_stmt_tree ()) 
697     {
698       TRY_HANDLERS (try_block) = cleanup;
699       CLEANUP_P (try_block) = 1;
700     }
701   else
702     expand_eh_region_end (protect_with_terminate (cleanup));
703 }
704
705 /* Likewise, for a function-try-block.  */
706
707 void
708 finish_function_try_block (try_block)
709      tree try_block; 
710 {
711   if (building_stmt_tree ())
712     {
713       if (TREE_CHAIN (try_block) 
714           && TREE_CODE (TREE_CHAIN (try_block)) == CTOR_INITIALIZER)
715         {
716           /* Chain the compound statement after the CTOR_INITIALIZER.  */
717           TREE_CHAIN (TREE_CHAIN (try_block)) = last_tree;
718           /* And make the CTOR_INITIALIZER the body of the try-block.  */
719           RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
720         }
721       else
722         RECHAIN_STMTS (try_block, TRY_STMTS (try_block));
723     }
724   else
725     {
726       end_protect_partials ();
727       expand_start_all_catch ();
728       in_function_try_handler = 1;
729     }
730 }
731
732 /* Finish a handler-sequence for a try-block, which may be given by
733    TRY_BLOCK.  */
734
735 void
736 finish_handler_sequence (try_block)
737      tree try_block;
738 {
739   if (building_stmt_tree ())
740     RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
741   else
742     expand_end_all_catch ();
743 }
744
745 /* Likewise, for a function-try-block.  */
746
747 void
748 finish_function_handler_sequence (try_block)
749      tree try_block;
750 {
751   if (building_stmt_tree ())
752     RECHAIN_STMTS (try_block, TRY_HANDLERS (try_block));
753   else
754     {
755       in_function_try_handler = 0;
756       expand_end_all_catch ();
757     }
758 }
759
760 /* Begin a handler.  Returns a HANDLER if appropriate.  */
761
762 tree
763 begin_handler ()
764 {
765   tree r;
766
767   if (building_stmt_tree ())
768     {
769       r = build_min_nt (HANDLER, NULL_TREE, NULL_TREE);
770       add_tree (r);
771     }
772   else
773     r = NULL_TREE;
774
775   do_pushlevel ();
776
777   return r;
778 }
779
780 /* Finish the handler-parameters for a handler, which may be given by
781    HANDLER.  */
782
783 void
784 finish_handler_parms (handler)
785      tree handler;
786 {
787   if (building_stmt_tree ())
788     RECHAIN_STMTS (handler, HANDLER_PARMS (handler));
789 }
790
791 /* Finish a handler, which may be given by HANDLER.  */
792
793 void
794 finish_handler (handler)
795      tree handler;
796 {
797   if (building_stmt_tree ())
798     RECHAIN_STMTS (handler, HANDLER_BODY (handler));
799   else
800     expand_end_catch_block ();
801
802   do_poplevel ();
803 }
804
805 /* Begin a compound-statement.  If HAS_NO_SCOPE is non-zero, the
806    compound-statement does not define a scope.  Returns a new
807    COMPOUND_STMT if appropriate.  */
808
809 tree
810 begin_compound_stmt (has_no_scope)
811      int has_no_scope;
812 {
813   tree r; 
814
815   if (building_stmt_tree ())
816     {
817       r = build_min_nt (COMPOUND_STMT, NULL_TREE);
818       add_tree (r);
819       if (has_no_scope)
820         COMPOUND_STMT_NO_SCOPE (r) = 1;
821     }
822   else
823     r = NULL_TREE;
824
825   last_expr_type = NULL_TREE;
826
827   if (!has_no_scope)
828     do_pushlevel ();
829   else
830     /* Normally, we try hard to keep the BLOCK for a
831        statement-expression.  But, if it's a statement-expression with
832        a scopeless block, there's nothing to keep, and we don't want
833        to accidentally keep a block *inside* the scopeless block.  */ 
834     keep_next_level (0);
835
836   return r;
837 }
838
839
840 /* Finish a compound-statement, which may be given by COMPOUND_STMT.
841    If HAS_NO_SCOPE is non-zero, the compound statement does not define
842    a scope.  */
843
844 tree
845 finish_compound_stmt (has_no_scope, compound_stmt)
846      int has_no_scope;
847      tree compound_stmt;
848 {
849   tree r;
850   tree t;
851
852   if (!has_no_scope)
853     r = do_poplevel ();
854   else
855     r = NULL_TREE;
856
857   if (building_stmt_tree ())
858     RECHAIN_STMTS (compound_stmt, COMPOUND_BODY (compound_stmt));
859
860   /* When we call finish_stmt we will lose LAST_EXPR_TYPE.  But, since
861      the precise purpose of that variable is store the type of the
862      last expression statement within the last compound statement, we
863      preserve the value.  */
864   t = last_expr_type;
865   finish_stmt ();
866   last_expr_type = t;
867
868   return r;
869 }
870
871 /* Finish an asm-statement, whose components are a CV_QUALIFIER, a
872    STRING, some OUTPUT_OPERANDS, some INPUT_OPERANDS, and some
873    CLOBBERS.  */
874
875 void
876 finish_asm_stmt (cv_qualifier, string, output_operands,
877                  input_operands, clobbers)
878      tree cv_qualifier;
879      tree string;
880      tree output_operands;
881      tree input_operands;
882      tree clobbers;
883 {
884   if (TREE_CHAIN (string))
885     {
886       if (building_stmt_tree ())
887         /* We need to build the combined string on the permanent
888            obstack so that we can use it during instantiations.  */
889         push_permanent_obstack ();
890
891       string = combine_strings (string);
892
893       if (building_stmt_tree ())
894         pop_obstacks ();
895     }
896
897   if (cv_qualifier != NULL_TREE
898       && cv_qualifier != ridpointers[(int) RID_VOLATILE])
899     {
900       cp_warning ("%s qualifier ignored on asm",
901                   IDENTIFIER_POINTER (cv_qualifier));
902       cv_qualifier = NULL_TREE;
903     }
904
905   if (building_stmt_tree ())
906     {
907       tree r = build_min_nt (ASM_STMT, cv_qualifier, string,
908                              output_operands, input_operands,
909                              clobbers);
910       add_tree (r);
911     }
912   else
913     {
914       emit_line_note (input_filename, lineno);
915       if (output_operands != NULL_TREE || input_operands != NULL_TREE
916             || clobbers != NULL_TREE)
917         {
918           tree t;
919
920           for (t = input_operands; t; t = TREE_CHAIN (t))
921             TREE_VALUE (t) = decay_conversion (TREE_VALUE (t));
922
923           c_expand_asm_operands (string, output_operands,
924                                  input_operands, 
925                                  clobbers,
926                                  cv_qualifier != NULL_TREE,
927                                  input_filename, lineno);
928         }
929       else
930         expand_asm (string);
931       
932       finish_stmt ();
933     }
934 }
935
936 /* Finish a label with the indicated NAME.  */
937
938 void
939 finish_label_stmt (name)
940      tree name;
941 {
942   tree decl = define_label (input_filename, lineno, name);
943
944   if (building_stmt_tree ())
945     add_tree (build_min_nt (LABEL_STMT, decl));
946   else if (decl)
947     expand_label (decl);
948 }
949
950 /* Finish a series of declarations for local labels.  G++ allows users
951    to declare "local" labels, i.e., labels with scope.  This extension
952    is useful when writing code involving statement-expressions.  */
953
954 void
955 finish_label_decl (name)
956      tree name;
957 {
958   tree decl = declare_local_label (name);
959   if (building_stmt_tree ())
960     add_decl_stmt (decl);
961 }
962
963 /* Create a declaration statement for the declaration given by the
964    DECL.  */
965
966 void
967 add_decl_stmt (decl)
968      tree decl;
969 {
970   tree decl_stmt;
971
972   /* We need the type to last until instantiation time.  */
973   decl_stmt = build_min_nt (DECL_STMT, decl);
974   add_tree (decl_stmt);
975 }
976
977 /* We're in a constructor, and have just constructed a a subobject of
978    *THIS.  CLEANUP is code to run if an exception is thrown before the
979    end of the current function is reached.   */
980
981 void 
982 finish_subobject (cleanup)
983      tree cleanup;
984 {
985   if (building_stmt_tree ())
986     {
987       tree r = build_min_nt (SUBOBJECT, cleanup);
988       add_tree (r);
989     }
990   else
991     add_partial_entry (cleanup);
992 }
993
994 /* Bind a name and initialization to the return value of
995    the current function.  */
996
997 void
998 finish_named_return_value (return_id, init)
999      tree return_id, init;
1000 {
1001   tree decl = DECL_RESULT (current_function_decl);
1002
1003   if (pedantic)
1004     /* Give this error as many times as there are occurrences,
1005        so that users can use Emacs compilation buffers to find
1006        and fix all such places.  */
1007     pedwarn ("ANSI C++ does not permit named return values");
1008
1009   if (return_id != NULL_TREE)
1010     {
1011       if (DECL_NAME (decl) == NULL_TREE)
1012         {
1013           DECL_NAME (decl) = return_id;
1014           DECL_ASSEMBLER_NAME (decl) = return_id;
1015         }
1016       else
1017         {
1018           cp_error ("return identifier `%D' already in place", return_id);
1019           return;
1020         }
1021     }
1022
1023   /* Can't let this happen for constructors.  */
1024   if (DECL_CONSTRUCTOR_P (current_function_decl))
1025     {
1026       error ("can't redefine default return value for constructors");
1027       return;
1028     }
1029
1030   /* If we have a named return value, put that in our scope as well.  */
1031   if (DECL_NAME (decl) != NULL_TREE)
1032     {
1033       /* Let `cp_finish_decl' know that this initializer is ok.  */
1034       DECL_INITIAL (decl) = init;
1035       pushdecl (decl);
1036
1037       if (building_stmt_tree ())
1038         add_tree (build_min_nt (RETURN_INIT, return_id, init));
1039       else
1040         {
1041           cp_finish_decl (decl, init, NULL_TREE, 0, 0);
1042           store_return_init (decl);
1043         }
1044     }
1045 }
1046
1047 /* Cache the value of this class's main virtual function table pointer
1048    in a register variable.  This will save one indirection if a
1049    more than one virtual function call is made this function.  */
1050
1051 void
1052 setup_vtbl_ptr ()
1053 {
1054   if (base_init_expr == 0
1055       && DECL_CONSTRUCTOR_P (current_function_decl))
1056     {
1057       if (building_stmt_tree ())
1058         add_tree (build_min_nt
1059                   (CTOR_INITIALIZER,
1060                    current_member_init_list, current_base_init_list));
1061       else
1062         emit_base_init (current_class_type);
1063     }
1064
1065   /* Always keep the BLOCK node associated with the outermost pair of
1066      curley braces of a function.  These are needed for correct
1067      operation of dwarfout.c.  */
1068   keep_next_level (1);
1069 }
1070
1071 /* Begin a new scope.  */
1072
1073 static void
1074 do_pushlevel ()
1075 {
1076   if (!building_stmt_tree ())
1077     {
1078       emit_line_note (input_filename, lineno);
1079       clear_last_expr ();
1080     }
1081   push_momentary ();
1082   if (stmts_are_full_exprs_p)
1083     pushlevel (0);
1084   if (!building_stmt_tree () && stmts_are_full_exprs_p)
1085     expand_start_bindings (0);
1086 }
1087
1088 /* Finish a scope.  */
1089
1090 static tree
1091 do_poplevel ()
1092 {
1093   tree t;
1094
1095   if (!building_stmt_tree () && stmts_are_full_exprs_p)
1096     expand_end_bindings (getdecls (), kept_level_p (), 0);
1097   if (stmts_are_full_exprs_p)
1098     t = poplevel (kept_level_p (), 1, 0);
1099   else
1100     t = NULL_TREE;
1101   pop_momentary ();
1102   return t;
1103 }
1104
1105 /* Finish a parenthesized expression EXPR.  */
1106
1107 tree
1108 finish_parenthesized_expr (expr)
1109      tree expr;
1110 {
1111   if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
1112     /* This inhibits warnings in truthvalue_conversion.  */
1113     C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK); 
1114
1115   return expr;
1116 }
1117
1118 /* Begin a statement-expression.  The value returned must be passed to
1119    finish_stmt_expr.  */
1120
1121 tree 
1122 begin_stmt_expr ()
1123 {
1124   keep_next_level (1);
1125   /* If we're building a statement tree, then the upcoming compound
1126      statement will be chained onto the tree structure, starting at
1127      last_tree.  We return last_tree so that we can later unhook the
1128      compound statement.  */
1129   return building_stmt_tree () ? last_tree : expand_start_stmt_expr(); 
1130 }
1131
1132 /* Finish a statement-expression.  RTL_EXPR should be the value
1133    returned by the previous begin_stmt_expr; EXPR is the
1134    statement-expression.  Returns an expression representing the
1135    statement-expression.  */
1136
1137 tree 
1138 finish_stmt_expr (rtl_expr, expr)
1139      tree rtl_expr;
1140      tree expr;
1141 {
1142   tree result;
1143
1144   if (!building_stmt_tree ())
1145     {
1146       rtl_expr = expand_end_stmt_expr (rtl_expr);
1147       /* The statements have side effects, so the group does.  */
1148       TREE_SIDE_EFFECTS (rtl_expr) = 1;
1149     }
1150
1151   if (building_stmt_tree ())
1152     {
1153       /* If the last thing in the statement-expression was not an
1154          expression-statement, then it has type `void'.  */
1155       if (!last_expr_type)
1156         last_expr_type = void_type_node;
1157       result = build_min (STMT_EXPR, last_expr_type, last_tree);
1158       TREE_SIDE_EFFECTS (result) = 1;
1159       
1160       /* Remove the compound statement from the tree structure; it is
1161          now saved in the STMT_EXPR.  */
1162       last_tree = rtl_expr;
1163       TREE_CHAIN (last_tree) = NULL_TREE;
1164     }
1165   else if (expr && TREE_CODE (expr) == BLOCK)
1166     {
1167       result = build (BIND_EXPR, TREE_TYPE (rtl_expr),
1168                       NULL_TREE, rtl_expr, expr);
1169       delete_block (expr);
1170     }
1171   else
1172     result = rtl_expr;
1173
1174   if (expr && TREE_CODE (expr) == BLOCK)
1175     /* Remove the block from the tree at this point.  It gets put back
1176        at the proper place when the STMT_EXPR or BIND_EXPR is
1177        expanded.  */
1178     delete_block (expr);
1179
1180   return result;
1181 }
1182
1183 /* Finish a call to FN with ARGS.  Returns a representation of the
1184    call.  */
1185
1186 tree 
1187 finish_call_expr (fn, args, koenig)
1188      tree fn;
1189      tree args;
1190      int koenig;
1191 {
1192   tree result;
1193
1194   if (koenig)
1195     {
1196       if (TREE_CODE (fn) == BIT_NOT_EXPR)
1197         fn = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND (fn, 0));
1198       else if (TREE_CODE (fn) != TEMPLATE_ID_EXPR)
1199         fn = do_identifier (fn, 2, args);
1200     }
1201   result = build_x_function_call (fn, args, current_class_ref);
1202
1203   if (TREE_CODE (result) == CALL_EXPR
1204       && (! TREE_TYPE (result)
1205           || TREE_CODE (TREE_TYPE (result)) != VOID_TYPE))
1206     result = require_complete_type (result);
1207
1208   return result;
1209 }
1210
1211 /* Finish a call to a postfix increment or decrement or EXPR.  (Which
1212    is indicated by CODE, which should be POSTINCREMENT_EXPR or
1213    POSTDECREMENT_EXPR.)  */
1214
1215 tree 
1216 finish_increment_expr (expr, code)
1217      tree expr;
1218      enum tree_code code;
1219 {
1220   /* If we get an OFFSET_REF, turn it into what it really means (e.g.,
1221      a COMPONENT_REF).  This way if we've got, say, a reference to a
1222      static member that's being operated on, we don't end up trying to
1223      find a member operator for the class it's in.  */
1224
1225   if (TREE_CODE (expr) == OFFSET_REF)
1226     expr = resolve_offset_ref (expr);
1227   return build_x_unary_op (code, expr);  
1228 }
1229
1230 /* Finish a use of `this'.  Returns an expression for `this'.  */
1231
1232 tree 
1233 finish_this_expr ()
1234 {
1235   tree result;
1236
1237   if (current_class_ptr)
1238     {
1239 #ifdef WARNING_ABOUT_CCD
1240       TREE_USED (current_class_ptr) = 1;
1241 #endif
1242       result = current_class_ptr;
1243     }
1244   else if (current_function_decl
1245            && DECL_STATIC_FUNCTION_P (current_function_decl))
1246     {
1247       error ("`this' is unavailable for static member functions");
1248       result = error_mark_node;
1249     }
1250   else
1251     {
1252       if (current_function_decl)
1253         error ("invalid use of `this' in non-member function");
1254       else
1255         error ("invalid use of `this' at top level");
1256       result = error_mark_node;
1257     }
1258
1259   return result;
1260 }
1261
1262 /* Finish a member function call using OBJECT and ARGS as arguments to
1263    FN.  Returns an expression for the call.  */
1264
1265 tree 
1266 finish_object_call_expr (fn, object, args)
1267      tree fn;
1268      tree object;
1269      tree args;
1270 {
1271 #if 0
1272   /* This is a future direction of this code, but because
1273      build_x_function_call cannot always undo what is done in
1274      build_component_ref entirely yet, we cannot do this.  */
1275
1276   tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
1277   return finish_call_expr (real_fn, args);
1278 #else
1279   if (TREE_CODE (fn) == TYPE_DECL)
1280     {
1281       if (processing_template_decl)
1282         /* This can happen on code like:
1283
1284            class X;
1285            template <class T> void f(T t) {
1286              t.X();
1287            }  
1288
1289            We just grab the underlying IDENTIFIER.  */
1290         fn = DECL_NAME (fn);
1291       else
1292         {
1293           cp_error ("calling type `%T' like a method", fn);
1294           return error_mark_node;
1295         }
1296     }
1297
1298   return build_method_call (object, fn, args, NULL_TREE, LOOKUP_NORMAL);
1299 #endif
1300 }
1301
1302 /* Finish a qualified member function call using OBJECT and ARGS as
1303    arguments to FN.  Returns an expressino for the call.  */
1304
1305 tree 
1306 finish_qualified_object_call_expr (fn, object, args)
1307      tree fn;
1308      tree object;
1309      tree args;
1310 {
1311   return build_scoped_method_call (object, TREE_OPERAND (fn, 0),
1312                                    TREE_OPERAND (fn, 1), args);
1313 }
1314
1315 /* Finish a pseudo-destructor call expression of OBJECT, with SCOPE
1316    being the scope, if any, of DESTRUCTOR.  Returns an expression for
1317    the call.  */
1318
1319 tree 
1320 finish_pseudo_destructor_call_expr (object, scope, destructor)
1321      tree object;
1322      tree scope;
1323      tree destructor;
1324 {
1325   if (processing_template_decl)
1326     return build_min_nt (PSEUDO_DTOR_EXPR, object, scope, destructor);
1327
1328   if (scope && scope != destructor)
1329     cp_error ("destructor specifier `%T::~%T()' must have matching names", 
1330               scope, destructor);
1331
1332   if ((scope == NULL_TREE || IDENTIFIER_GLOBAL_VALUE (destructor))
1333       && (TREE_CODE (TREE_TYPE (object)) !=
1334           TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (destructor)))))
1335     cp_error ("`%E' is not of type `%T'", object, destructor);
1336
1337   return cp_convert (void_type_node, object);
1338 }
1339
1340 /* Finish a call to a globally qualified member function FN using
1341    ARGS.  Returns an expression for the call.  */
1342
1343 tree 
1344 finish_qualified_call_expr (fn, args)
1345      tree fn;
1346      tree args;
1347 {
1348   if (processing_template_decl)
1349     return build_min_nt (CALL_EXPR, fn, args, NULL_TREE);
1350   else
1351     return build_member_call (TREE_OPERAND (fn, 0),
1352                               TREE_OPERAND (fn, 1),
1353                               args);
1354 }
1355
1356 /* Finish an expression taking the address of LABEL.  Returns an
1357    expression for the address.  */
1358
1359 tree 
1360 finish_label_address_expr (label)
1361      tree label;
1362 {
1363   tree result;
1364
1365   label = lookup_label (label);
1366   if (label == NULL_TREE)
1367     result = null_pointer_node;
1368   else
1369     {
1370       TREE_USED (label) = 1;
1371       result = build1 (ADDR_EXPR, ptr_type_node, label);
1372       TREE_CONSTANT (result) = 1;
1373     }
1374
1375   return result;
1376 }
1377
1378 /* Finish an expression of the form CODE EXPR.  */
1379
1380 tree
1381 finish_unary_op_expr (code, expr)
1382      enum tree_code code;
1383      tree expr;
1384 {
1385   tree result = build_x_unary_op (code, expr);
1386   if (code == NEGATE_EXPR && TREE_CODE (expr) == INTEGER_CST)
1387     TREE_NEGATED_INT (result) = 1;
1388   overflow_warning (result);
1389   return result;
1390 }
1391
1392 /* Finish an id-expression.  */
1393
1394 tree
1395 finish_id_expr (expr)
1396      tree expr;
1397 {
1398   if (TREE_CODE (expr) == IDENTIFIER_NODE)
1399     expr = do_identifier (expr, 1, NULL_TREE);
1400
1401   return expr;
1402 }
1403
1404 /* Begin a new-placement.  */
1405
1406 int
1407 begin_new_placement ()
1408 {
1409   /* The arguments to a placement new might be passed to a
1410      deallocation function, in the event that the allocation throws an
1411      exception.  Since we don't expand exception handlers until the
1412      end of a function, we must make sure the arguments stay around
1413      that long.  */
1414   return suspend_momentary ();
1415 }
1416
1417 /* Finish a new-placement.  The ARGS are the placement arguments.  The
1418    COOKIE is the value returned by the previous call to
1419    begin_new_placement.  */
1420
1421 tree
1422 finish_new_placement (args, cookie)
1423      tree args;
1424      int cookie;
1425 {
1426   resume_momentary (cookie);
1427   return args;
1428 }
1429
1430 /* Begin a function defniition declared with DECL_SPECS and
1431    DECLARATOR.  Returns non-zero if the function-declaration is
1432    legal.  */
1433
1434 int
1435 begin_function_definition (decl_specs, declarator)
1436      tree decl_specs;
1437      tree declarator;
1438 {
1439   tree specs;
1440   tree attrs;
1441   split_specs_attrs (decl_specs, &specs, &attrs);
1442   if (!start_function (specs, declarator, attrs, SF_DEFAULT))
1443     return 0;
1444   
1445   reinit_parse_for_function ();
1446   /* The things we're about to see are not directly qualified by any
1447      template headers we've seen thus far.  */
1448   reset_specialization ();
1449
1450   return 1;
1451 }
1452
1453 /* Begin a constructor declarator of the form `SCOPE::NAME'.  Returns
1454    a SCOPE_REF.  */
1455
1456 tree 
1457 begin_constructor_declarator (scope, name)
1458      tree scope;
1459      tree name;
1460 {
1461   tree result = build_parse_node (SCOPE_REF, scope, name);
1462   enter_scope_of (result);
1463   return result;
1464 }
1465
1466 /* Finish an init-declarator.  Returns a DECL.  */
1467
1468 tree
1469 finish_declarator (declarator, declspecs, attributes,
1470                    prefix_attributes, initialized)
1471      tree declarator;
1472      tree declspecs;
1473      tree attributes;
1474      tree prefix_attributes;
1475      int initialized;
1476 {
1477   return start_decl (declarator, declspecs, initialized, attributes,
1478                      prefix_attributes); 
1479 }
1480
1481 /* Finish a translation unit.  */
1482
1483 void 
1484 finish_translation_unit ()
1485 {
1486   /* In case there were missing closebraces,
1487      get us back to the global binding level.  */
1488   while (! toplevel_bindings_p ())
1489     poplevel (0, 0, 0);
1490   while (current_namespace != global_namespace)
1491     pop_namespace ();
1492   finish_file ();
1493 }
1494
1495 /* Finish a template type parameter, specified as AGGR IDENTIFIER.
1496    Returns the parameter.  */
1497
1498 tree 
1499 finish_template_type_parm (aggr, identifier)
1500      tree aggr;
1501      tree identifier;
1502 {
1503   if (aggr != class_type_node)
1504     {
1505       pedwarn ("template type parameters must use the keyword `class' or `typename'");
1506       aggr = class_type_node;
1507     }
1508
1509   return build_tree_list (aggr, identifier);
1510 }
1511
1512 /* Finish a template template parameter, specified as AGGR IDENTIFIER.
1513    Returns the parameter.  */
1514
1515 tree 
1516 finish_template_template_parm (aggr, identifier)
1517      tree aggr;
1518      tree identifier;
1519 {
1520   tree decl = build_decl (TYPE_DECL, identifier, NULL_TREE);
1521   tree tmpl = build_lang_decl (TEMPLATE_DECL, identifier, NULL_TREE);
1522   DECL_TEMPLATE_PARMS (tmpl) = current_template_parms;
1523   DECL_TEMPLATE_RESULT (tmpl) = decl;
1524   SET_DECL_ARTIFICIAL (decl);
1525   end_template_decl ();
1526
1527   return finish_template_type_parm (aggr, tmpl);
1528 }
1529
1530 /* Finish a parameter list, indicated by PARMS.  If ELLIPSIS is
1531    non-zero, the parameter list was terminated by a `...'.  */
1532
1533 tree
1534 finish_parmlist (parms, ellipsis)
1535      tree parms;
1536      int ellipsis;
1537 {
1538   if (!ellipsis)
1539     chainon (parms, void_list_node);
1540   /* We mark the PARMS as a parmlist so that declarator processing can
1541      disambiguate certain constructs.  */
1542   if (parms != NULL_TREE)
1543     TREE_PARMLIST (parms) = 1;
1544
1545   return parms;
1546 }
1547
1548 /* Begin a class definition, as indicated by T.  */
1549
1550 tree
1551 begin_class_definition (t)
1552      tree t;
1553 {
1554   push_permanent_obstack ();
1555
1556   if (t == error_mark_node
1557       || ! IS_AGGR_TYPE (t))
1558     {
1559       t = make_lang_type (RECORD_TYPE);
1560       pushtag (make_anon_name (), t, 0);
1561     }
1562
1563   /* In a definition of a member class template, we will get here with an
1564      implicit typename, a TYPENAME_TYPE with a type.  */
1565   if (TREE_CODE (t) == TYPENAME_TYPE)
1566     t = TREE_TYPE (t);
1567   
1568   /* If we generated a partial instantiation of this type, but now
1569      we're seeing a real definition, we're actually looking at a
1570      partial specialization.  Consider:
1571
1572        template <class T, class U>
1573        struct Y {};
1574
1575        template <class T>
1576        struct X {};
1577
1578        template <class T, class U>
1579        void f()
1580        {
1581          typename X<Y<T, U> >::A a;
1582        }
1583
1584        template <class T, class U>
1585        struct X<Y<T, U> >
1586        {
1587        };
1588
1589      We have to undo the effects of the previous partial
1590      instantiation.  */
1591   if (PARTIAL_INSTANTIATION_P (t))
1592     {
1593       if (!pedantic) 
1594         {
1595           /* Unfortunately, when we're not in pedantic mode, we
1596              attempt to actually fill in some of the fields of the
1597              partial instantiation, in order to support the implicit
1598              typename extension.  Clear those fields now, in
1599              preparation for the definition here.  The fields cleared
1600              here must match those set in instantiate_class_template.
1601              Look for a comment mentioning begin_class_definition
1602              there.  */
1603           TYPE_BINFO_BASETYPES (t) = NULL_TREE;
1604           TYPE_FIELDS (t) = NULL_TREE;
1605           TYPE_METHODS (t) = NULL_TREE;
1606           CLASSTYPE_TAGS (t) = NULL_TREE;
1607           TYPE_SIZE (t) = NULL_TREE;
1608         }
1609
1610       /* This isn't a partial instantiation any more.  */
1611       PARTIAL_INSTANTIATION_P (t) = 0;
1612     }
1613   /* If this type was already complete, and we see another definition,
1614      that's an error.  */
1615   else if (TYPE_SIZE (t))
1616     duplicate_tag_error (t);
1617
1618   /* Update the location of the decl.  */
1619   DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
1620   DECL_SOURCE_LINE (TYPE_NAME (t)) = lineno;
1621   
1622   if (TYPE_BEING_DEFINED (t))
1623     {
1624       t = make_lang_type (TREE_CODE (t));
1625       pushtag (TYPE_IDENTIFIER (t), t, 0);
1626     }
1627   maybe_process_partial_specialization (t);
1628   pushclass (t, 1);
1629   TYPE_BEING_DEFINED (t) = 1;
1630   /* Reset the interface data, at the earliest possible
1631      moment, as it might have been set via a class foo;
1632      before.  */
1633   {
1634     tree name = TYPE_IDENTIFIER (t);
1635     
1636     if (! ANON_AGGRNAME_P (name))
1637       {
1638         CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
1639         SET_CLASSTYPE_INTERFACE_UNKNOWN_X
1640           (t, interface_unknown);
1641       }
1642     
1643     /* Only leave this bit clear if we know this
1644        class is part of an interface-only specification.  */
1645     if (! CLASSTYPE_INTERFACE_KNOWN (t)
1646         || ! CLASSTYPE_INTERFACE_ONLY (t))
1647       CLASSTYPE_VTABLE_NEEDS_WRITING (t) = 1;
1648   }
1649 #if 0
1650   tmp = TYPE_IDENTIFIER ($<ttype>0);
1651   if (tmp && IDENTIFIER_TEMPLATE (tmp))
1652     overload_template_name (tmp, 1);
1653 #endif
1654   reset_specialization();
1655   
1656   /* In case this is a local class within a template
1657      function, we save the current tree structure so
1658      that we can get it back later.  */
1659   begin_tree ();
1660
1661   /* Make a declaration for this class in its own scope.  */
1662   build_self_reference ();
1663
1664   return t;
1665 }
1666
1667 /* Finish the member declaration given by DECL.  */
1668
1669 void
1670 finish_member_declaration (decl)
1671      tree decl;
1672 {
1673   if (decl == error_mark_node || decl == NULL_TREE)
1674     return;
1675
1676   if (decl == void_type_node)
1677     /* The COMPONENT was a friend, not a member, and so there's
1678        nothing for us to do.  */
1679     return;
1680
1681   /* We should see only one DECL at a time.  */
1682   my_friendly_assert (TREE_CHAIN (decl) == NULL_TREE, 0);
1683
1684   /* Set up access control for DECL.  */
1685   TREE_PRIVATE (decl) 
1686     = (current_access_specifier == access_private_node);
1687   TREE_PROTECTED (decl) 
1688     = (current_access_specifier == access_protected_node);
1689   if (TREE_CODE (decl) == TEMPLATE_DECL)
1690     {
1691       TREE_PRIVATE (DECL_RESULT (decl)) = TREE_PRIVATE (decl);
1692       TREE_PROTECTED (DECL_RESULT (decl)) = TREE_PROTECTED (decl);
1693     }
1694
1695   /* Mark the DECL as a member of the current class.  */
1696   if (TREE_CODE (decl) == FUNCTION_DECL 
1697       || DECL_FUNCTION_TEMPLATE_P (decl))
1698     /* Historically, DECL_CONTEXT was not set for a FUNCTION_DECL in
1699        finish_struct.  Presumably it is already set as the function is
1700        parsed.  Perhaps DECL_CLASS_CONTEXT is already set, too?  */
1701     DECL_CLASS_CONTEXT (decl) = current_class_type;
1702   else
1703     DECL_CONTEXT (decl) = current_class_type;
1704
1705   /* Put functions on the TYPE_METHODS list and everything else on the
1706      TYPE_FIELDS list.  Note that these are built up in reverse order.
1707      We reverse them (to obtain declaration order) in finish_struct.  */
1708   if (TREE_CODE (decl) == FUNCTION_DECL 
1709       || DECL_FUNCTION_TEMPLATE_P (decl))
1710     {
1711       /* We also need to add this function to the
1712          CLASSTYPE_METHOD_VEC.  */
1713       add_method (current_class_type, 0, decl);
1714
1715       TREE_CHAIN (decl) = TYPE_METHODS (current_class_type);
1716       TYPE_METHODS (current_class_type) = decl;
1717     }
1718   else
1719     {
1720       /* All TYPE_DECLs go at the end of TYPE_FIELDS.  Ordinary fields
1721          go at the beginning.  The reason is that lookup_field_1
1722          searches the list in order, and we want a field name to
1723          override a type name so that the "struct stat hack" will
1724          work.  In particular:
1725
1726            struct S { enum E { }; int E } s;
1727            s.E = 3;
1728
1729          is legal.  In addition, the FIELD_DECLs must be maintained in
1730          declaration order so that class layout works as expected.
1731          However, we don't need that order until class layout, so we
1732          save a little time by putting FIELD_DECLs on in reverse order
1733          here, and then reversing them in finish_struct_1.  (We could
1734          also keep a pointer to the correct insertion points in the
1735          list.)  */
1736
1737       if (TREE_CODE (decl) == TYPE_DECL)
1738         TYPE_FIELDS (current_class_type) 
1739           = chainon (TYPE_FIELDS (current_class_type), decl);
1740       else
1741         {
1742           TREE_CHAIN (decl) = TYPE_FIELDS (current_class_type);
1743           TYPE_FIELDS (current_class_type) = decl;
1744         }
1745
1746       /* Enter the DECL into the scope of the class.  */
1747       if (TREE_CODE (decl) != USING_DECL)
1748         pushdecl_class_level (decl);
1749     }
1750 }
1751
1752 /* Finish a class definition T with the indicate ATTRIBUTES.  If SEMI,
1753    the definition is immediately followed by a semicolon.  Returns the
1754    type.  */
1755
1756 tree
1757 finish_class_definition (t, attributes, semi, pop_scope_p)
1758      tree t;
1759      tree attributes;
1760      int semi;
1761      int pop_scope_p;
1762 {
1763   /* finish_struct nukes this anyway; if finish_exception does too,
1764      then it can go.  */
1765   if (semi)
1766     note_got_semicolon (t);
1767
1768   /* If we got any attributes in class_head, xref_tag will stick them in
1769      TREE_TYPE of the type.  Grab them now.  */
1770   attributes = chainon (TREE_TYPE (t), attributes);
1771   TREE_TYPE (t) = NULL_TREE;
1772
1773   if (TREE_CODE (t) == ENUMERAL_TYPE)
1774     ;
1775   else
1776     {
1777       t = finish_struct (t, attributes);
1778       if (semi) 
1779         note_got_semicolon (t);
1780     }
1781
1782   pop_obstacks ();
1783
1784   if (! semi)
1785     check_for_missing_semicolon (t); 
1786   if (pop_scope_p)
1787     pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (t)));
1788   if (current_scope () == current_function_decl)
1789     do_pending_defargs ();
1790
1791   return t;
1792 }
1793
1794 /* Finish processing the default argument expressions cached during
1795    the processing of a class definition.  */
1796
1797 void
1798 begin_inline_definitions ()
1799 {
1800   if (pending_inlines 
1801       && current_scope () == current_function_decl)
1802     do_pending_inlines ();
1803 }
1804
1805 /* Finish processing the inline function definitions cached during the
1806    processing of a class definition.  */
1807
1808 void
1809 finish_inline_definitions ()
1810 {
1811   if (current_class_type == NULL_TREE)
1812     clear_inline_text_obstack (); 
1813   
1814   /* Undo the begin_tree in begin_class_definition.  */
1815   end_tree ();
1816 }
1817
1818 /* Finish processing the declaration of a member class template
1819    TYPES whose template parameters are given by PARMS.  */
1820
1821 tree
1822 finish_member_class_template (types)
1823      tree types;
1824 {
1825   tree t;
1826
1827   /* If there are declared, but undefined, partial specializations
1828      mixed in with the typespecs they will not yet have passed through
1829      maybe_process_partial_specialization, so we do that here.  */
1830   for (t = types; t != NULL_TREE; t = TREE_CHAIN (t))
1831     if (IS_AGGR_TYPE_CODE (TREE_CODE (TREE_VALUE (t))))
1832       maybe_process_partial_specialization (TREE_VALUE (t));
1833
1834   note_list_got_semicolon (types);
1835   grok_x_components (types);
1836   if (TYPE_CONTEXT (TREE_VALUE (types)) != current_class_type)
1837     /* The component was in fact a friend declaration.  We avoid
1838        finish_member_template_decl performing certain checks by
1839        unsetting TYPES.  */
1840     types = NULL_TREE;
1841   
1842   finish_member_template_decl (types);
1843
1844   /* As with other component type declarations, we do
1845      not store the new DECL on the list of
1846      component_decls.  */
1847   return NULL_TREE;
1848 }
1849
1850 /* Finish processsing a complete template declaration.  The PARMS are
1851    the template parameters.  */
1852
1853 void
1854 finish_template_decl (parms)
1855      tree parms;
1856 {
1857   if (parms)
1858     end_template_decl ();
1859   else
1860     end_specialization ();
1861 }
1862
1863 /* Finish processing a a template-id (which names a type) of the form
1864    NAME < ARGS >.  Return the TYPE_DECL for the type named by the
1865    template-id.  If ENTERING_SCOPE is non-zero we are about to enter
1866    the scope of template-id indicated.  */
1867
1868 tree
1869 finish_template_type (name, args, entering_scope)
1870      tree name;
1871      tree args;
1872      int entering_scope;
1873 {
1874   tree decl;
1875
1876   decl = lookup_template_class (name, args,
1877                                 NULL_TREE, NULL_TREE, entering_scope);
1878   if (decl != error_mark_node)
1879     decl = TYPE_STUB_DECL (decl);
1880
1881   return decl;
1882 }
1883
1884 /* SR is a SCOPE_REF node.  Enter the scope of SR, whether it is a
1885    namespace scope or a class scope.  */
1886
1887 void
1888 enter_scope_of (sr)
1889      tree sr;
1890 {
1891   tree scope = TREE_OPERAND (sr, 0);
1892
1893   if (TREE_CODE (scope) == NAMESPACE_DECL)
1894     {
1895       push_decl_namespace (scope);
1896       TREE_COMPLEXITY (sr) = -1;
1897     }
1898   else if (scope != current_class_type)
1899     {
1900       if (TREE_CODE (scope) == TYPENAME_TYPE)
1901         {
1902           /* In a declarator for a template class member, the scope will
1903              get here as an implicit typename, a TYPENAME_TYPE with a type.  */
1904           scope = TREE_TYPE (scope);
1905           TREE_OPERAND (sr, 0) = scope;
1906         }
1907       push_nested_class (scope, 3);
1908       TREE_COMPLEXITY (sr) = current_class_depth;
1909     }
1910 }
1911
1912 /* Finish processing a BASE_CLASS with the indicated ACCESS_SPECIFIER.
1913    Return a TREE_LIST containing the ACCESS_SPECIFIER and the
1914    BASE_CLASS, or NULL_TREE if an error occurred.  The
1915    ACCESSS_SPECIFIER is one of
1916    access_{default,public,protected_private}[_virtual]_node.*/
1917
1918 tree 
1919 finish_base_specifier (access_specifier, base_class)
1920      tree access_specifier;
1921      tree base_class;
1922 {
1923   tree type;
1924   tree result;
1925
1926   if (base_class == NULL_TREE)
1927     {
1928       error ("invalid base class");
1929       type = error_mark_node;
1930     }
1931   else
1932     type = TREE_TYPE (base_class);
1933
1934   if (! is_aggr_type (type, 1))
1935     result = NULL_TREE;
1936   else
1937     result = build_tree_list (access_specifier, type);
1938
1939   return result;
1940 }
1941
1942 /* Called when multiple declarators are processed.  If that is not
1943    premitted in this context, an error is issued.  */
1944
1945 void
1946 check_multiple_declarators ()
1947 {
1948   /* [temp]
1949      
1950      In a template-declaration, explicit specialization, or explicit
1951      instantiation the init-declarator-list in the declaration shall
1952      contain at most one declarator.  
1953
1954      We don't just use PROCESSING_TEMPLATE_DECL for the first
1955      condition since that would disallow the perfectly legal code, 
1956      like `template <class T> struct S { int i, j; };'.  */
1957   tree scope = current_scope ();
1958
1959   if (scope && TREE_CODE (scope) == FUNCTION_DECL)
1960     /* It's OK to write `template <class T> void f() { int i, j;}'.  */
1961     return;
1962      
1963   if (PROCESSING_REAL_TEMPLATE_DECL_P () 
1964       || processing_explicit_instantiation
1965       || processing_specialization)
1966     cp_error ("multiple declarators in template declaration");
1967 }
1968
1969 tree
1970 finish_typeof (expr)
1971      tree expr;
1972 {
1973   if (processing_template_decl)
1974     {
1975       tree t;
1976
1977       push_permanent_obstack ();
1978       t = make_lang_type (TYPEOF_TYPE);
1979       TYPE_FIELDS (t) = expr;
1980       pop_obstacks ();
1981
1982       return t;
1983     }
1984
1985   return TREE_TYPE (expr);
1986 }
1987
1988 /* Create an empty statement tree for FN.  */
1989
1990 void
1991 begin_stmt_tree (fn)
1992      tree fn;
1993 {
1994   /* We create a trivial EXPR_STMT so that last_tree is never NULL in
1995      what follows.  We remove the extraneous statement in
1996      finish_stmt_tree.  */
1997   DECL_SAVED_TREE (fn) = build_nt (EXPR_STMT, void_zero_node);
1998   last_tree = DECL_SAVED_TREE (fn);
1999   last_expr_type = NULL_TREE;
2000 }
2001
2002 /* Finish the statement tree for FN.  */
2003
2004 void
2005 finish_stmt_tree (fn)
2006      tree fn;
2007 {
2008   tree stmt;
2009   
2010   /* Remove the fake extra statement added in begin_stmt_tree.  */
2011   stmt = TREE_CHAIN (DECL_SAVED_TREE (fn));
2012   DECL_SAVED_TREE (fn) = stmt;
2013
2014   /* The line-number recorded in the outermost statement in a function
2015      is the line number of the end of the function.  */
2016   STMT_LINENO (stmt) = lineno;
2017   STMT_LINENO_FOR_FN_P (stmt) = 1;
2018 }
2019
2020 /* We're about to expand T, a statement.  Set up appropriate context
2021    for the substitution.  */
2022
2023 void
2024 prep_stmt (t)
2025      tree t;
2026 {
2027   if (!STMT_LINENO_FOR_FN_P (t))
2028     lineno = STMT_LINENO (t);
2029   stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
2030 }
2031
2032 /* Some statements, like for-statements or if-statements, require a
2033    condition.  This condition can be a declaration.  If T is such a
2034    declaration it is processed, and an expression appropriate to use
2035    as the condition is returned.  Otherwise, T itself is returned.  */
2036
2037 static tree
2038 expand_cond (t)
2039      tree t;
2040 {
2041   if (t && TREE_CODE (t) == DECL_STMT)
2042     {
2043       expand_stmt (t);
2044       return convert_from_reference (DECL_STMT_DECL (t));
2045     }
2046   else 
2047     return t;
2048 }
2049
2050 /* Generate RTL for the statement T, and its substatements, and any
2051    other statements at its nesting level.  */
2052
2053 tree
2054 expand_stmt (t)
2055      tree t;
2056 {
2057   tree rval;
2058
2059   while (t && t != error_mark_node)
2060     {
2061       int saved_stmts_are_full_exprs_p;
2062
2063       /* Assume we'll have nothing to return.  */
2064       rval = NULL_TREE;
2065
2066       /* Set up context appropriately for handling this statement.  */
2067       saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p;
2068       prep_stmt (t);
2069
2070       switch (TREE_CODE (t))
2071         {
2072         case RETURN_STMT:
2073           finish_return_stmt (RETURN_EXPR (t));
2074           break;
2075
2076         case EXPR_STMT:
2077           finish_expr_stmt_real (EXPR_STMT_EXPR (t),
2078                                  EXPR_STMT_ASSIGNS_THIS (t));
2079           break;
2080
2081         case DECL_STMT:
2082           {
2083             tree decl;
2084             int i = suspend_momentary ();
2085
2086             emit_line_note (input_filename, lineno);
2087             decl = DECL_STMT_DECL (t);
2088             if (TREE_CODE (decl) == LABEL_DECL)
2089               finish_label_decl (DECL_NAME (decl));
2090             else
2091               {
2092                 /* If we marked this variable as dead when we processed it
2093                    before, we must undo that now.  The variable has been
2094                    resuscitated.  */
2095                 if (TREE_CODE (decl) == VAR_DECL)
2096                   DECL_DEAD_FOR_LOCAL (decl) = 0;
2097                 /* We need to clear DECL_CONTEXT so that maybe_push_decl
2098                    will push it into the current scope.  */
2099                 if (DECL_CONTEXT (decl) == current_function_decl)
2100                   {
2101                     DECL_CONTEXT (decl) = NULL_TREE;
2102                     maybe_push_decl (decl);
2103                   }
2104                 /* If this is a declaration for an automatic local
2105                    variable, initialize it.  Note that we might also see a
2106                    declaration for a namespace-scope object (declared with
2107                    `extern') or an object with static storage duration
2108                    (declared with `static').  We don't have to handle the
2109                    initialization of those objects here; the former can
2110                    never be a definition (only a declaration), and the
2111                    latter is handled in finish_file.  */
2112                 if (TREE_CODE (decl) == VAR_DECL 
2113                     && !TREE_STATIC (decl)
2114                     && !DECL_EXTERNAL (decl))
2115                   {
2116                     /* Support the old for-scope rules for backwards
2117                        compatibility.  */
2118                     maybe_inject_for_scope_var (decl);
2119                     /* Let the back-end know about this variable.  */
2120                     initialize_local_var (decl, DECL_INITIAL (decl), 0);
2121                   }
2122               }
2123             resume_momentary (i);
2124           }
2125           break;
2126
2127         case FOR_STMT:
2128           {
2129             tree tmp;
2130
2131             begin_for_stmt ();
2132             expand_stmt (FOR_INIT_STMT (t));
2133             finish_for_init_stmt (NULL_TREE);
2134             finish_for_cond (expand_cond (FOR_COND (t)), NULL_TREE);
2135             tmp = FOR_EXPR (t);
2136             finish_for_expr (tmp, NULL_TREE);
2137             expand_stmt (FOR_BODY (t));
2138             finish_for_stmt (tmp, NULL_TREE);
2139           }
2140           break;
2141
2142         case WHILE_STMT:
2143           {
2144             begin_while_stmt ();
2145             finish_while_stmt_cond (expand_cond (WHILE_COND (t)), NULL_TREE);
2146             expand_stmt (WHILE_BODY (t));
2147             finish_while_stmt (NULL_TREE);
2148           }
2149           break;
2150
2151         case DO_STMT:
2152           {
2153             begin_do_stmt ();
2154             expand_stmt (DO_BODY (t));
2155             finish_do_body (NULL_TREE);
2156             finish_do_stmt (DO_COND (t), NULL_TREE);
2157           }
2158           break;
2159
2160         case IF_STMT:
2161           begin_if_stmt ();
2162           finish_if_stmt_cond (expand_cond (IF_COND (t)), NULL_TREE);
2163           if (THEN_CLAUSE (t))
2164             {
2165               expand_stmt (THEN_CLAUSE (t));
2166               finish_then_clause (NULL_TREE);
2167             }
2168           if (ELSE_CLAUSE (t))
2169             {
2170               begin_else_clause ();
2171               expand_stmt (ELSE_CLAUSE (t));
2172               finish_else_clause (NULL_TREE);
2173             }
2174           finish_if_stmt ();
2175           break;
2176
2177         case COMPOUND_STMT:
2178           begin_compound_stmt (COMPOUND_STMT_NO_SCOPE (t));
2179           expand_stmt (COMPOUND_BODY (t));
2180           rval = finish_compound_stmt (COMPOUND_STMT_NO_SCOPE (t), 
2181                                        NULL_TREE);
2182           break;
2183
2184         case BREAK_STMT:
2185           finish_break_stmt ();
2186           break;
2187
2188         case CONTINUE_STMT:
2189           finish_continue_stmt ();
2190           break;
2191
2192         case SWITCH_STMT:
2193           {
2194             tree cond;
2195
2196             begin_switch_stmt ();
2197             cond = expand_cond (SWITCH_COND (t));
2198             finish_switch_cond (cond, NULL_TREE);
2199             expand_stmt (SWITCH_BODY (t));
2200             finish_switch_stmt (cond, NULL_TREE);
2201           }
2202           break;
2203
2204         case CASE_LABEL:
2205           finish_case_label (CASE_LOW (t), CASE_HIGH (t));
2206           break;
2207
2208         case LABEL_STMT:
2209           finish_label_stmt (DECL_NAME (LABEL_STMT_LABEL (t)));
2210           break;
2211
2212         case GOTO_STMT:
2213           if (TREE_CODE (GOTO_DESTINATION (t)) == LABEL_DECL)
2214             finish_goto_stmt (DECL_NAME (GOTO_DESTINATION (t)));
2215           else
2216             finish_goto_stmt (GOTO_DESTINATION (t));
2217           break;
2218
2219         case ASM_STMT:
2220           finish_asm_stmt (ASM_CV_QUAL (t), ASM_STRING (t), ASM_OUTPUTS
2221                            (t), ASM_INPUTS (t), ASM_CLOBBERS (t));
2222           break;
2223
2224         case TRY_BLOCK:
2225           if (CLEANUP_P (t))
2226             {
2227               expand_eh_region_start ();
2228               expand_stmt (TRY_STMTS (t));
2229               finish_cleanup_try_block (NULL_TREE);
2230               finish_cleanup (TRY_HANDLERS (t), NULL_TREE);
2231             }
2232           else
2233             {
2234               begin_try_block ();
2235               expand_stmt (TRY_STMTS (t));
2236               finish_try_block (NULL_TREE);
2237               expand_stmt (TRY_HANDLERS (t));
2238               finish_handler_sequence (NULL_TREE);
2239             }
2240           break;
2241
2242         case HANDLER:
2243           begin_handler ();
2244           if (HANDLER_PARMS (t))
2245             expand_start_catch_block (DECL_STMT_DECL (HANDLER_PARMS (t)));
2246           else
2247             expand_start_catch_block (NULL_TREE);
2248           finish_handler_parms (NULL_TREE);
2249           expand_stmt (HANDLER_BODY (t));
2250           finish_handler (NULL_TREE);
2251           break;
2252
2253         case SUBOBJECT:
2254           finish_subobject (SUBOBJECT_CLEANUP (t));
2255           break;
2256
2257         default:
2258           my_friendly_abort (19990810);
2259           break;
2260         }
2261
2262       /* Restore saved state.  */
2263       stmts_are_full_exprs_p = saved_stmts_are_full_exprs_p;
2264
2265       /* Go on to the next statement in this scope.  */
2266       t = TREE_CHAIN (t);
2267     }
2268
2269   return rval;
2270 }
2271
2272 /* Generate RTL for FN.  */
2273
2274 void
2275 expand_body (fn)
2276      tree fn;
2277 {
2278   int saved_lineno;
2279   char *saved_input_filename;
2280   tree t;
2281   tree try_block;
2282
2283   /* When the parser calls us after finishing the body of a template
2284      function, we don't really want to expand the body.  When we're
2285      processing an in-class definition of an inline function,
2286      PROCESSING_TEMPLATE_DECL will no longer be set here, so we have
2287      to look at the function itself.  */
2288   if (processing_template_decl
2289       || (DECL_LANG_SPECIFIC (fn) 
2290           && DECL_TEMPLATE_INFO (fn)
2291           && uses_template_parms (DECL_TI_ARGS (fn))))
2292     return;
2293
2294   /* Save the current file name and line number.  When we expand the
2295      body of the funciton, we'll set LINENO and INPUT_FILENAME so that
2296      error-mesages come out in the right places.  */
2297   saved_lineno = lineno;
2298   saved_input_filename = input_filename;
2299   lineno = DECL_SOURCE_LINE (fn);
2300   input_filename = DECL_SOURCE_FILE (fn);
2301
2302   start_function (NULL_TREE, fn, NULL_TREE, SF_PRE_PARSED | SF_EXPAND);
2303   store_parm_decls ();
2304
2305   /* There are a few things that we do not handle recursively.  For
2306      example, a function try-block is handled differently from an
2307      ordinary try-block, so we must handle it here.  */
2308   t = DECL_SAVED_TREE (fn);
2309   try_block = NULL_TREE;
2310   if (t && TREE_CODE (t) == TRY_BLOCK)
2311     {
2312       try_block = t;
2313       begin_function_try_block ();
2314       t = TRY_STMTS (try_block);
2315     }
2316
2317   if (t && TREE_CODE (t) == RETURN_INIT)
2318     {
2319       /* Clear this out so that finish_named_return_value can set it
2320          again.  */
2321       DECL_NAME (DECL_RESULT (fn)) = NULL_TREE;
2322       finish_named_return_value (TREE_OPERAND (t, 0), TREE_OPERAND (t, 1));
2323       t = TREE_CHAIN (t);
2324     }
2325
2326   if (t && TREE_CODE (t) == CTOR_INITIALIZER)
2327     {
2328       current_member_init_list = TREE_OPERAND (t, 0);
2329       current_base_init_list = TREE_OPERAND (t, 1);
2330       t = TREE_CHAIN (t);
2331     }
2332
2333   /* If this is a constructor, we need to initialize our members and
2334      base-classes.  */
2335   setup_vtbl_ptr ();
2336
2337   /* Expand the body.  */
2338   expand_stmt (t);
2339
2340   /* If there was a function try-block, expand the handlers.  */
2341   if (try_block)
2342     {
2343       finish_function_try_block (NULL_TREE);
2344       expand_stmt (TRY_HANDLERS (try_block));
2345       finish_function_handler_sequence (NULL_TREE);
2346     }
2347
2348   /* Statements should always be full-expressions at the outermost set
2349      of curly braces for a function.  */
2350   my_friendly_assert (stmts_are_full_exprs_p, 19990831);
2351
2352   /* The outermost statement for a function contains the line number
2353      recorded when we finished processing the function.  */
2354   lineno = STMT_LINENO (DECL_SAVED_TREE (fn));
2355
2356   /* Generate code for the function.  */
2357   finish_function (lineno, 0);
2358
2359   /* And restore the current source position.  */
2360   lineno = saved_lineno;
2361   input_filename = saved_input_filename;
2362 }