gcc/
[official-gcc.git] / gcc / java / java-except.h
blobe9adf83606ba49ff0670c025166eb2774a06695a
1 /* Definitions for exception handling for use by the GNU compiler
2 for the Java(TM) language compiler.
3 Copyright (C) 1997-2015 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>.
21 Java and all Java-based marks are trademarks or registered trademarks
22 of Sun Microsystems, Inc. in the United States and other countries.
23 The Free Software Foundation is independent of Sun Microsystems, Inc. */
25 struct eh_range
27 /* The (byte-code PC) range of the handled block. */
28 int start_pc;
29 int end_pc;
31 /* A list of handlers. For each element in the list,
32 the TREE_PURPOSE is the handled class (NULL_EXPR for a finally block),
33 and the TREE_VALUE is the LABEL_DECL of the handler. */
34 tree handlers;
36 /* Surrounding handler, if any. */
37 struct eh_range *outer;
39 /* The first child range. It is is nested inside this range
40 (i.e. this.start_pc <= first_child.end_pc
41 && this.end_pc >= first_child.end_pc).
42 The children are linked together using next_sibling, and are sorted
43 by increasing start_pc and end_pc (we do not support non-nested
44 overlapping ranges). */
45 struct eh_range *first_child;
47 /* The next child of outer, in address order. */
48 struct eh_range *next_sibling;
50 /* True if this range has already been expanded. */
51 int expanded;
53 /* The TRY_CATCH_EXPR for this EH range. */
54 tree stmt;
57 /* A dummy range that represents the entire method. */
58 extern struct eh_range whole_range;
60 #define NULL_EH_RANGE (&whole_range)
62 extern struct eh_range * find_handler (int);
63 extern void method_init_exceptions (void);
64 extern void maybe_start_try (int, int);
65 extern void add_handler (int, int, tree, tree);
66 extern void expand_end_java_handler (struct eh_range *);
67 extern bool sanity_check_exception_range (struct eh_range *);