diff options
author | Tom Tromey <tromey@redhat.com> | 2001-08-24 17:24:02 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-08-24 17:24:02 +0000 |
commit | 66b461ce02570f05b7ddd76e2de1a82f3a6618e3 (patch) | |
tree | c022ddf73be4bc070372f075be9b84b48990b1db /gcc/java/class.c | |
parent | 20787c010ac0cd423df4ca43a6d850e8131506f8 (diff) | |
download | gcc-66b461ce02570f05b7ddd76e2de1a82f3a6618e3.zip gcc-66b461ce02570f05b7ddd76e2de1a82f3a6618e3.tar.gz gcc-66b461ce02570f05b7ddd76e2de1a82f3a6618e3.tar.bz2 |
decl.c (init_decl_processing): Add `throws' field to method descriptor.
* decl.c (init_decl_processing): Add `throws' field to method
descriptor.
* class.c (make_method_value): Compute `throws' field for method.
From-SVN: r45152
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r-- | gcc/java/class.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c index e8f7e6f..e0caeae 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1151,6 +1151,7 @@ static tree make_method_value (mdecl) tree mdecl; { + static int method_name_count = 0; tree minit; tree code; #define ACC_TRANSLATED 0x4000 @@ -1173,6 +1174,44 @@ make_method_value (mdecl) } PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0)); PUSH_FIELD_VALUE (minit, "ncode", code); + + { + /* Compute the `throws' information for the method. */ + tree table = integer_zero_node; + if (DECL_FUNCTION_THROWS (mdecl) != NULL_TREE) + { + int length = 1 + list_length (DECL_FUNCTION_THROWS (mdecl)); + tree iter, type, array; + char buf[60]; + + table = tree_cons (NULL_TREE, table, NULL_TREE); + for (iter = DECL_FUNCTION_THROWS (mdecl); + iter != NULL_TREE; + iter = TREE_CHAIN (iter)) + { + tree sig = build_java_signature (TREE_VALUE (iter)); + tree utf8 + = build_utf8_ref (unmangle_classname (IDENTIFIER_POINTER (sig), + IDENTIFIER_LENGTH (sig))); + table = tree_cons (NULL_TREE, utf8, table); + } + type = build_prim_array_type (ptr_type_node, length); + table = build (CONSTRUCTOR, type, NULL_TREE, table); + /* Compute something unique enough. */ + sprintf (buf, "_methods%d", method_name_count++); + array = build_decl (VAR_DECL, get_identifier (buf), type); + DECL_INITIAL (array) = table; + TREE_STATIC (array) = 1; + DECL_ARTIFICIAL (array) = 1; + DECL_IGNORED_P (array) = 1; + rest_of_decl_compilation (array, (char*) 0, 1, 0); + + table = build1 (ADDR_EXPR, ptr_type_node, array); + } + + PUSH_FIELD_VALUE (minit, "throws", table); + } + FINISH_RECORD_CONSTRUCTOR (minit); return minit; } |