diff options
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/java/builtins.c | 5 | ||||
-rw-r--r-- | gcc/java/class.c | 101 | ||||
-rw-r--r-- | gcc/java/constants.c | 5 | ||||
-rw-r--r-- | gcc/java/decl.c | 278 | ||||
-rw-r--r-- | gcc/java/except.c | 6 | ||||
-rw-r--r-- | gcc/java/expr.c | 29 | ||||
-rw-r--r-- | gcc/java/java-gimplify.c | 2 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 6 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 8 | ||||
-rw-r--r-- | gcc/java/resource.c | 14 | ||||
-rw-r--r-- | gcc/java/typeck.c | 8 |
12 files changed, 308 insertions, 170 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1ea81d6..b3daaa8 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,19 @@ +2009-06-12 Aldy Hernandez <aldyh@redhat.com> + + * java-gimplify.c (java_gimplify_block): New argument to + build_empty_stmt. + * expr.c (force_evaluation_order): Same. + * typeck.c: Add location to build_decl or PUSH_FIELD calls. + * class.c: Same. + * decl.c: Same. + * jcf-parse.c: Same. + * constants.c: Same. + * resource.c: Same. + * except.c: Same. + * builtins.c: Same. + * expr.c: Same. + * java-tree.h (PUSH_FIELD): Add location field. + 2009-06-09 Ian Lance Taylor <iant@google.com> * verify.h: Remove extern "C". diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 39c73a5..0f7b197 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -411,7 +411,7 @@ getVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED, stmt = build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0); - tmp = build_decl (VAR_DECL, NULL, method_return_type); + tmp = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL, method_return_type); DECL_IGNORED_P (tmp) = 1; DECL_ARTIFICIAL (tmp) = 1; pushdecl (tmp); @@ -453,7 +453,8 @@ define_builtin (enum built_in_function val, { tree decl; - decl = build_decl (FUNCTION_DECL, get_identifier (name), type); + decl = build_decl (BUILTINS_LOCATION, + FUNCTION_DECL, get_identifier (name), type); DECL_EXTERNAL (decl) = 1; TREE_PUBLIC (decl) = 1; SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname)); diff --git a/gcc/java/class.c b/gcc/java/class.c index edd16f0..1b594e5 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -420,7 +420,7 @@ do \ \ sprintf (buf, #NAME "_%s", type_name); \ TYPE_## TABLE ##_DECL (type) = decl = \ - build_decl (VAR_DECL, get_identifier (buf), TABLE_TYPE); \ + build_decl (input_location, VAR_DECL, get_identifier (buf), TABLE_TYPE); \ DECL_EXTERNAL (decl) = 1; \ TREE_STATIC (decl) = 1; \ TREE_READONLY (decl) = 1; \ @@ -432,7 +432,7 @@ do \ DECL_OWNER (decl) = TYPE; \ sprintf (buf, #NAME "_syms_%s", type_name); \ TYPE_## TABLE ##_SYMS_DECL (TYPE) = \ - build_decl (VAR_DECL, get_identifier (buf), symbols_array_type); \ + build_decl (input_location, VAR_DECL, get_identifier (buf), symbols_array_type); \ TREE_STATIC (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \ TREE_CONSTANT (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \ DECL_IGNORED_P (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \ @@ -452,12 +452,14 @@ gen_indirect_dispatch_tables (tree type) tree catch_class_type = make_node (RECORD_TYPE); sprintf (buf, "_catch_classes_%s", type_name); - PUSH_FIELD (catch_class_type, field, "address", utf8const_ptr_type); - PUSH_FIELD (catch_class_type, field, "classname", ptr_type_node); + PUSH_FIELD (input_location, + catch_class_type, field, "address", utf8const_ptr_type); + PUSH_FIELD (input_location, + catch_class_type, field, "classname", ptr_type_node); FINISH_RECORD (catch_class_type); TYPE_CTABLE_DECL (type) - = build_decl (VAR_DECL, get_identifier (buf), + = build_decl (input_location, VAR_DECL, get_identifier (buf), build_array_type (catch_class_type, 0)); DECL_EXTERNAL (TYPE_CTABLE_DECL (type)) = 1; TREE_STATIC (TYPE_CTABLE_DECL (type)) = 1; @@ -483,7 +485,7 @@ push_class (tree class_type, tree class_name) tree decl, signature; location_t saved_loc = input_location; CLASS_P (class_type) = 1; - decl = build_decl (TYPE_DECL, class_name, class_type); + decl = build_decl (input_location, TYPE_DECL, class_name, class_type); TYPE_DECL_SUPPRESS_DEBUG (decl) = 1; /* dbxout needs a DECL_SIZE if in gstabs mode */ @@ -758,7 +760,7 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type) method_type = build_java_method_type (function_type, this_class, access_flags); - fndecl = build_decl (FUNCTION_DECL, name, method_type); + fndecl = build_decl (input_location, FUNCTION_DECL, name, method_type); DECL_CONTEXT (fndecl) = this_class; DECL_LANG_SPECIFIC (fndecl) @@ -844,7 +846,8 @@ add_field (tree klass, tree name, tree field_type, int flags) { int is_static = (flags & ACC_STATIC) != 0; tree field; - field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type); + field = build_decl (input_location, + is_static ? VAR_DECL : FIELD_DECL, name, field_type); TREE_CHAIN (field) = TYPE_FIELDS (klass); TYPE_FIELDS (klass) = field; DECL_CONTEXT (field) = klass; @@ -948,9 +951,10 @@ build_utf8_ref (tree name) - (name_len & (TYPE_ALIGN_UNIT (utf8const_type) - 1)); str_type = build_prim_array_type (unsigned_byte_type_node, name_len + name_pad); - PUSH_FIELD (ctype, field, "hash", unsigned_short_type_node); - PUSH_FIELD (ctype, field, "length", unsigned_short_type_node); - PUSH_FIELD (ctype, field, "data", str_type); + PUSH_FIELD (input_location, ctype, field, "hash", unsigned_short_type_node); + PUSH_FIELD (input_location, + ctype, field, "length", unsigned_short_type_node); + PUSH_FIELD (input_location, ctype, field, "data", str_type); FINISH_RECORD (ctype); START_RECORD_CONSTRUCTOR (cinit, ctype); name_hash = hashUtf8String (name_ptr, name_len) & 0xFFFF; @@ -965,7 +969,8 @@ build_utf8_ref (tree name) /* Generate a unique-enough identifier. */ sprintf(buf, "_Utf%d", ++utf8_count); - decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_type); + decl = build_decl (input_location, + VAR_DECL, get_identifier (buf), utf8const_type); TREE_STATIC (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; @@ -1027,7 +1032,7 @@ build_static_class_ref (tree type) decl = IDENTIFIER_GLOBAL_VALUE (decl_name); if (decl == NULL_TREE) { - decl = build_decl (VAR_DECL, decl_name, class_type_node); + decl = build_decl (input_location, VAR_DECL, decl_name, class_type_node); TREE_STATIC (decl) = 1; if (! flag_indirect_classes) { @@ -1062,7 +1067,8 @@ build_classdollar_field (tree type) if (decl == NULL_TREE) { decl - = build_decl (VAR_DECL, decl_name, + = build_decl (input_location, + VAR_DECL, decl_name, (build_type_variant (build_pointer_type (build_type_variant (class_type_node, @@ -1097,7 +1103,8 @@ cache_this_class_ref (tree fndecl) else classdollar_field = build_static_class_ref (output_class); - this_classdollar = build_decl (VAR_DECL, NULL_TREE, + this_classdollar = build_decl (input_location, + VAR_DECL, NULL_TREE, TREE_TYPE (classdollar_field)); java_add_local_var (this_classdollar); @@ -1175,7 +1182,8 @@ build_class_ref (tree type) decl = IDENTIFIER_GLOBAL_VALUE (decl_name); if (decl == NULL_TREE) { - decl = build_decl (VAR_DECL, decl_name, class_type_node); + decl = build_decl (input_location, + VAR_DECL, decl_name, class_type_node); TREE_STATIC (decl) = 1; TREE_PUBLIC (decl) = 1; DECL_EXTERNAL (decl) = 1; @@ -1205,7 +1213,8 @@ build_fieldref_cache_entry (int index, tree fdecl ATTRIBUTE_UNUSED) decl = IDENTIFIER_GLOBAL_VALUE (decl_name); if (decl == NULL_TREE) { - decl = build_decl (VAR_DECL, decl_name, ptr_type_node); + decl = build_decl (input_location, + VAR_DECL, decl_name, ptr_type_node); TREE_STATIC (decl) = 1; TREE_PUBLIC (decl) = 0; DECL_EXTERNAL (decl) = 0; @@ -1386,7 +1395,8 @@ make_local_function_alias (tree method) strcpy (name + 1, method_name); ASM_GENERATE_INTERNAL_LABEL (buf, name, alias_labelno++); - alias = build_decl (FUNCTION_DECL, get_identifier (buf), + alias = build_decl (input_location, + FUNCTION_DECL, get_identifier (buf), TREE_TYPE (method)); DECL_CONTEXT (alias) = NULL; TREE_READONLY (alias) = TREE_READONLY (method); @@ -1530,7 +1540,8 @@ make_method_value (tree mdecl) table = build_constructor_from_list (type, table); /* Compute something unique enough. */ sprintf (buf, "_methods%d", method_name_count++); - array = build_decl (VAR_DECL, get_identifier (buf), type); + array = build_decl (input_location, + VAR_DECL, get_identifier (buf), type); DECL_INITIAL (array) = table; TREE_STATIC (array) = 1; DECL_ARTIFICIAL (array) = 1; @@ -1862,7 +1873,8 @@ make_class_data (tree type) instance_fields = nreverse (instance_fields); static_fields = chainon (static_fields, instance_fields); field_array_type = build_prim_array_type (field_type_node, field_count); - fields_decl = build_decl (VAR_DECL, mangled_classname ("_FL_", type), + fields_decl = build_decl (input_location, + VAR_DECL, mangled_classname ("_FL_", type), field_array_type); DECL_INITIAL (fields_decl) = build_constructor_from_list (field_array_type, static_fields); @@ -1918,7 +1930,8 @@ make_class_data (tree type) } } method_array_type = build_prim_array_type (method_type_node, method_count); - methods_decl = build_decl (VAR_DECL, mangled_classname ("_MT_", type), + methods_decl = build_decl (input_location, + VAR_DECL, mangled_classname ("_MT_", type), method_array_type); DECL_INITIAL (methods_decl) = build_constructor_from_list (method_array_type, nreverse (methods)); @@ -1964,7 +1977,8 @@ make_class_data (tree type) tree interface_array_type, idecl; interface_array_type = build_prim_array_type (class_ptr_type, interface_len); - idecl = build_decl (VAR_DECL, mangled_classname ("_IF_", type), + idecl = build_decl (input_location, + VAR_DECL, mangled_classname ("_IF_", type), interface_array_type); for (i = interface_len; i > 0; i--) @@ -2168,7 +2182,8 @@ make_class_data (tree type) static int reflection_data_count; sprintf (buf, "_reflection_data_%d", reflection_data_count++); - array = build_decl (VAR_DECL, get_identifier (buf), type); + array = build_decl (input_location, + VAR_DECL, get_identifier (buf), type); rewrite_reflection_indexes (field_indexes); @@ -2298,23 +2313,25 @@ build_dtable_decl (tree type) dtype = make_node (RECORD_TYPE); - PUSH_FIELD (dtype, dummy, "top_offset", ptr_type_node); - PUSH_FIELD (dtype, dummy, "type_info", ptr_type_node); + PUSH_FIELD (input_location, dtype, dummy, "top_offset", ptr_type_node); + PUSH_FIELD (input_location, dtype, dummy, "type_info", ptr_type_node); - PUSH_FIELD (dtype, dummy, "class", class_ptr_type); + PUSH_FIELD (input_location, dtype, dummy, "class", class_ptr_type); for (n = 1; n < TARGET_VTABLE_USES_DESCRIPTORS; ++n) { - tree tmp_field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node); + tree tmp_field = build_decl (input_location, + FIELD_DECL, NULL_TREE, ptr_type_node); TREE_CHAIN (dummy) = tmp_field; DECL_CONTEXT (tmp_field) = dtype; DECL_ARTIFICIAL (tmp_field) = 1; dummy = tmp_field; } - PUSH_FIELD (dtype, dummy, "gc_descr", ptr_type_node); + PUSH_FIELD (input_location, dtype, dummy, "gc_descr", ptr_type_node); for (n = 1; n < TARGET_VTABLE_USES_DESCRIPTORS; ++n) { - tree tmp_field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node); + tree tmp_field = build_decl (input_location, + FIELD_DECL, NULL_TREE, ptr_type_node); TREE_CHAIN (dummy) = tmp_field; DECL_CONTEXT (tmp_field) = dtype; DECL_ARTIFICIAL (tmp_field) = 1; @@ -2325,14 +2342,15 @@ build_dtable_decl (tree type) if (TARGET_VTABLE_USES_DESCRIPTORS) n *= TARGET_VTABLE_USES_DESCRIPTORS; - PUSH_FIELD (dtype, dummy, "methods", + PUSH_FIELD (input_location, dtype, dummy, "methods", build_prim_array_type (nativecode_ptr_type_node, n)); layout_type (dtype); } else dtype = dtable_type; - decl = build_decl (VAR_DECL, get_identifier ("vt$"), dtype); + decl = build_decl (input_location, + VAR_DECL, get_identifier ("vt$"), dtype); DECL_CONTEXT (decl) = type; MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); DECL_VTABLE_P (decl) = 1; @@ -2350,7 +2368,8 @@ push_super_field (tree this_class, tree super_class) /* Don't insert the field if we're just re-laying the class out. */ if (TYPE_FIELDS (this_class) && !DECL_NAME (TYPE_FIELDS (this_class))) return; - base_decl = build_decl (FIELD_DECL, NULL_TREE, super_class); + base_decl = build_decl (input_location, + FIELD_DECL, NULL_TREE, super_class); DECL_IGNORED_P (base_decl) = 1; TREE_CHAIN (base_decl) = TYPE_FIELDS (this_class); TYPE_FIELDS (this_class) = base_decl; @@ -2719,7 +2738,8 @@ emit_indirect_register_classes (tree *list_p) int size = VEC_length (tree, registered_class) * 2 + 1; tree class_array_type = build_prim_array_type (ptr_type_node, size); - tree cdecl = build_decl (VAR_DECL, get_identifier ("_Jv_CLS"), + tree cdecl = build_decl (input_location, + VAR_DECL, get_identifier ("_Jv_CLS"), class_array_type); tree reg_class_list; for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i) @@ -2747,7 +2767,8 @@ emit_indirect_register_classes (tree *list_p) t = build_function_type_list (void_type_node, build_pointer_type (ptr_type_node), NULL); - t = build_decl (FUNCTION_DECL, + t = build_decl (input_location, + FUNCTION_DECL, get_identifier ("_Jv_RegisterNewClasses"), t); TREE_PUBLIC (t) = 1; DECL_EXTERNAL (t) = 1; @@ -2809,7 +2830,8 @@ emit_register_classes (tree *list_p) int i; t = build_function_type_list (void_type_node, class_ptr_type, NULL); - t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t); + t = build_decl (input_location, + FUNCTION_DECL, get_identifier ("_Jv_RegisterClass"), t); TREE_PUBLIC (t) = 1; DECL_EXTERNAL (t) = 1; register_class_fn = t; @@ -2915,7 +2937,8 @@ emit_symbol_table (tree name, tree the_table, tree decl_list, table_size = build_index_type (build_int_cst (NULL_TREE, index * element_size + 1)); the_array_type = build_array_type (the_array_element_type, table_size); - the_table = build_decl (VAR_DECL, name, the_array_type); + the_table = build_decl (input_location, + VAR_DECL, name, the_array_type); TREE_STATIC (the_table) = 1; TREE_READONLY (the_table) = 1; rest_of_decl_compilation (the_table, 1, 0); @@ -2959,7 +2982,8 @@ emit_catch_table (tree this_class) = build_array_type (TREE_TYPE (TREE_TYPE (TYPE_CTABLE_DECL (this_class))), table_size); table = - build_decl (VAR_DECL, DECL_NAME (TYPE_CTABLE_DECL (this_class)), array_type); + build_decl (input_location, + VAR_DECL, DECL_NAME (TYPE_CTABLE_DECL (this_class)), array_type); DECL_INITIAL (table) = build_constructor_from_list (array_type, TYPE_CATCH_CLASSES (this_class)); TREE_STATIC (table) = 1; @@ -3043,7 +3067,8 @@ emit_assertion_table (tree klass) list = nreverse (list); ctor = build_constructor_from_list (assertion_table_type, list); - table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", klass), + table_decl = build_decl (input_location, + VAR_DECL, mangled_classname ("_type_assert_", klass), assertion_table_type); TREE_STATIC (table_decl) = 1; diff --git a/gcc/java/constants.c b/gcc/java/constants.c index 70d628b..541e78d 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -463,7 +463,7 @@ build_constant_data_ref (bool indirect) thinks the type is incomplete. */ layout_type (type); - decl = build_decl (VAR_DECL, decl_name, type); + decl = build_decl (input_location, VAR_DECL, decl_name, type); TREE_STATIC (decl) = 1; IDENTIFIER_GLOBAL_VALUE (decl_name) = decl; } @@ -581,7 +581,8 @@ build_constants_constructor (void) data_value = build_address_of (data_decl); tags_type = build_array_type (unsigned_byte_type_node, index_type); - tags_decl = build_decl (VAR_DECL, mangled_classname ("_CT_", + tags_decl = build_decl (input_location, + VAR_DECL, mangled_classname ("_CT_", current_class), tags_type); TREE_STATIC (tags_decl) = 1; diff --git a/gcc/java/decl.c b/gcc/java/decl.c index bd0cc8e..3c1e7ea 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -274,7 +274,7 @@ find_local_variable (int index, tree type, int pc ATTRIBUTE_UNUSED) tree name; sprintf (buf, "#slot#%d#%d", index, uniq++); name = get_identifier (buf); - decl = build_decl (VAR_DECL, name, type); + decl = build_decl (input_location, VAR_DECL, name, type); DECL_IGNORED_P (decl) = 1; DECL_ARTIFICIAL (decl) = 1; decl = push_jvm_slot (index, decl); @@ -297,7 +297,7 @@ find_local_variable (int index, tree type, int pc ATTRIBUTE_UNUSED) name = get_identifier (buf); base_decl = TREE_VEC_ELT (base_decl_map, index) - = build_decl (VAR_DECL, name, ptr_type_node); + = build_decl (input_location, VAR_DECL, name, ptr_type_node); pushdecl_function_level (base_decl); DECL_IGNORED_P (base_decl) = 1; DECL_ARTIFICIAL (base_decl) = 1; @@ -450,7 +450,8 @@ push_promoted_type (const char *name, tree actual_type) TYPE_PRECISION (type) = TYPE_PRECISION (int_type_node); TYPE_STRING_FLAG (type) = TYPE_STRING_FLAG (actual_type); layout_type (type); - pushdecl (build_decl (TYPE_DECL, get_identifier (name), type)); + pushdecl (build_decl (input_location, + TYPE_DECL, get_identifier (name), type)); return type; } @@ -462,7 +463,8 @@ create_primitive_vtable (const char *name) char buf[50]; sprintf (buf, "_Jv_%sVTable", name); - r = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node); + r = build_decl (input_location, + VAR_DECL, get_identifier (buf), ptr_type_node); DECL_EXTERNAL (r) = 1; return r; } @@ -545,25 +547,33 @@ java_init_decl_processing (void) initialize_sizetypes (false); byte_type_node = make_signed_type (8); - pushdecl (build_decl (TYPE_DECL, get_identifier ("byte"), byte_type_node)); + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("byte"), byte_type_node)); short_type_node = make_signed_type (16); - pushdecl (build_decl (TYPE_DECL, get_identifier ("short"), short_type_node)); + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("short"), short_type_node)); int_type_node = make_signed_type (32); - pushdecl (build_decl (TYPE_DECL, get_identifier ("int"), int_type_node)); + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("int"), int_type_node)); long_type_node = make_signed_type (64); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long"), long_type_node)); + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("long"), long_type_node)); unsigned_byte_type_node = make_unsigned_type (8); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned byte"), + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("unsigned byte"), unsigned_byte_type_node)); unsigned_short_type_node = make_unsigned_type (16); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned short"), + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("unsigned short"), unsigned_short_type_node)); unsigned_int_type_node = make_unsigned_type (32); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"), + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("unsigned int"), unsigned_int_type_node)); unsigned_long_type_node = make_unsigned_type (64); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned long"), + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("unsigned long"), unsigned_long_type_node)); /* This is not a java type, however tree-dfa requires a definition for @@ -600,7 +610,8 @@ java_init_decl_processing (void) long_zero_node = build_int_cst (long_type_node, 0); void_type_node = make_node (VOID_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("void"), void_type_node)); + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("void"), void_type_node)); layout_type (void_type_node); /* Uses size_zero_node */ ptr_type_node = build_pointer_type (void_type_node); @@ -617,12 +628,14 @@ java_init_decl_processing (void) TYPE_STRING_FLAG (char_type_node) = 1; TYPE_PRECISION (char_type_node) = 16; fixup_unsigned_type (char_type_node); - pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node)); + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("char"), char_type_node)); boolean_type_node = make_node (BOOLEAN_TYPE); TYPE_PRECISION (boolean_type_node) = 1; fixup_unsigned_type (boolean_type_node); - pushdecl (build_decl (TYPE_DECL, get_identifier ("boolean"), + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("boolean"), boolean_type_node)); boolean_false_node = TYPE_MIN_VALUE (boolean_type_node); boolean_true_node = TYPE_MAX_VALUE (boolean_type_node); @@ -638,13 +651,15 @@ java_init_decl_processing (void) float_type_node = make_node (REAL_TYPE); TYPE_PRECISION (float_type_node) = 32; - pushdecl (build_decl (TYPE_DECL, get_identifier ("float"), + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("float"), float_type_node)); layout_type (float_type_node); double_type_node = make_node (REAL_TYPE); TYPE_PRECISION (double_type_node) = 64; - pushdecl (build_decl (TYPE_DECL, get_identifier ("double"), + pushdecl (build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("double"), double_type_node)); layout_type (double_type_node); @@ -663,8 +678,10 @@ java_init_decl_processing (void) one_elt_array_domain_type = build_index_type (integer_one_node); utf8const_type = make_node (RECORD_TYPE); - PUSH_FIELD (utf8const_type, field, "hash", unsigned_short_type_node); - PUSH_FIELD (utf8const_type, field, "length", unsigned_short_type_node); + PUSH_FIELD (input_location, + utf8const_type, field, "hash", unsigned_short_type_node); + PUSH_FIELD (input_location, + utf8const_type, field, "length", unsigned_short_type_node); FINISH_RECORD (utf8const_type); utf8const_ptr_type = build_pointer_type (utf8const_type); @@ -679,9 +696,11 @@ java_init_decl_processing (void) itable_ptr_type = build_pointer_type (itable_type); symbol_type = make_node (RECORD_TYPE); - PUSH_FIELD (symbol_type, field, "clname", utf8const_ptr_type); - PUSH_FIELD (symbol_type, field, "name", utf8const_ptr_type); - PUSH_FIELD (symbol_type, field, "signature", utf8const_ptr_type); + PUSH_FIELD (input_location, + symbol_type, field, "clname", utf8const_ptr_type); + PUSH_FIELD (input_location, symbol_type, field, "name", utf8const_ptr_type); + PUSH_FIELD (input_location, + symbol_type, field, "signature", utf8const_ptr_type); FINISH_RECORD (symbol_type); symbols_array_type = build_array_type (symbol_type, @@ -689,9 +708,12 @@ java_init_decl_processing (void) symbols_array_ptr_type = build_pointer_type (symbols_array_type); assertion_entry_type = make_node (RECORD_TYPE); - PUSH_FIELD (assertion_entry_type, field, "assertion_code", integer_type_node); - PUSH_FIELD (assertion_entry_type, field, "op1", utf8const_ptr_type); - PUSH_FIELD (assertion_entry_type, field, "op2", utf8const_ptr_type); + PUSH_FIELD (input_location, + assertion_entry_type, field, "assertion_code", integer_type_node); + PUSH_FIELD (input_location, + assertion_entry_type, field, "op1", utf8const_ptr_type); + PUSH_FIELD (input_location, + assertion_entry_type, field, "op2", utf8const_ptr_type); FINISH_RECORD (assertion_entry_type); assertion_table_type = build_array_type (assertion_entry_type, @@ -729,7 +751,8 @@ java_init_decl_processing (void) methodtable_type = make_node (RECORD_TYPE); layout_type (methodtable_type); - build_decl (TYPE_DECL, get_identifier ("methodtable"), methodtable_type); + build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("methodtable"), methodtable_type); methodtable_ptr_type = build_pointer_type (methodtable_type); TYPE_identifier_node = get_identifier ("TYPE"); @@ -747,12 +770,16 @@ java_init_decl_processing (void) init_expr_processing(); constants_type_node = make_node (RECORD_TYPE); - PUSH_FIELD (constants_type_node, field, "size", unsigned_int_type_node); - PUSH_FIELD (constants_type_node, field, "tags", ptr_type_node); - PUSH_FIELD (constants_type_node, field, "data", ptr_type_node); + PUSH_FIELD (input_location, + constants_type_node, field, "size", unsigned_int_type_node); + PUSH_FIELD (input_location, + constants_type_node, field, "tags", ptr_type_node); + PUSH_FIELD (input_location, + constants_type_node, field, "data", ptr_type_node); constants_data_field_decl_node = field; FINISH_RECORD (constants_type_node); - build_decl (TYPE_DECL, get_identifier ("constants"), constants_type_node); + build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("constants"), constants_type_node); access_flags_type_node = unsigned_short_type_node; @@ -764,7 +791,8 @@ java_init_decl_processing (void) TYPE_NONALIASED_COMPONENT (otable_type) = 1; otable_ptr_type = build_pointer_type (otable_type); - PUSH_FIELD (object_type_node, field, "vtable", dtable_ptr_type); + PUSH_FIELD (input_location, + object_type_node, field, "vtable", dtable_ptr_type); DECL_FCONTEXT (field) = object_type_node; TYPE_VFIELD (object_type_node) = field; @@ -772,7 +800,7 @@ java_init_decl_processing (void) There is an unresolved issue here, which is whether the vtable should be marked by the GC. */ if (! flag_hash_synchronization) - PUSH_FIELD (object_type_node, field, "sync_info", + PUSH_FIELD (input_location, object_type_node, field, "sync_info", build_pointer_type (object_type_node)); for (t = TYPE_FIELDS (object_type_node); t != NULL_TREE; t = TREE_CHAIN (t)) FIELD_PRIVATE (t) = 1; @@ -787,101 +815,154 @@ java_init_decl_processing (void) set_super_info (0, string_type_node, object_type_node, 0); class_ptr_type = build_pointer_type (class_type_node); - PUSH_FIELD (class_type_node, field, "next_or_version", class_ptr_type); - PUSH_FIELD (class_type_node, field, "name", utf8const_ptr_type); - PUSH_FIELD (class_type_node, field, "accflags", access_flags_type_node); - PUSH_FIELD (class_type_node, field, "superclass", class_ptr_type); - PUSH_FIELD (class_type_node, field, "constants", constants_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "next_or_version", class_ptr_type); + PUSH_FIELD (input_location, + class_type_node, field, "name", utf8const_ptr_type); + PUSH_FIELD (input_location, + class_type_node, field, "accflags", access_flags_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "superclass", class_ptr_type); + PUSH_FIELD (input_location, + class_type_node, field, "constants", constants_type_node); constants_field_decl_node = field; - PUSH_FIELD (class_type_node, field, "methods", method_ptr_type_node); - PUSH_FIELD (class_type_node, field, "method_count", short_type_node); - PUSH_FIELD (class_type_node, field, "vtable_method_count", short_type_node); - PUSH_FIELD (class_type_node, field, "fields", field_ptr_type_node); - PUSH_FIELD (class_type_node, field, "size_in_bytes", int_type_node); - PUSH_FIELD (class_type_node, field, "field_count", short_type_node); - PUSH_FIELD (class_type_node, field, "static_field_count", short_type_node); - PUSH_FIELD (class_type_node, field, "vtable", dtable_ptr_type); - PUSH_FIELD (class_type_node, field, "otable", otable_ptr_type); - PUSH_FIELD (class_type_node, field, "otable_syms", + PUSH_FIELD (input_location, + class_type_node, field, "methods", method_ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "method_count", short_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "vtable_method_count", short_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "fields", field_ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "size_in_bytes", int_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "field_count", short_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "static_field_count", short_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "vtable", dtable_ptr_type); + PUSH_FIELD (input_location, + class_type_node, field, "otable", otable_ptr_type); + PUSH_FIELD (input_location, + class_type_node, field, "otable_syms", symbols_array_ptr_type); - PUSH_FIELD (class_type_node, field, "atable", atable_ptr_type); - PUSH_FIELD (class_type_node, field, "atable_syms", + PUSH_FIELD (input_location, + class_type_node, field, "atable", atable_ptr_type); + PUSH_FIELD (input_location, + class_type_node, field, "atable_syms", symbols_array_ptr_type); - PUSH_FIELD (class_type_node, field, "itable", itable_ptr_type); - PUSH_FIELD (class_type_node, field, "itable_syms", + PUSH_FIELD (input_location, + class_type_node, field, "itable", itable_ptr_type); + PUSH_FIELD (input_location, class_type_node, field, "itable_syms", symbols_array_ptr_type); - PUSH_FIELD (class_type_node, field, "catch_classes", ptr_type_node); - PUSH_FIELD (class_type_node, field, "interfaces", + PUSH_FIELD (input_location, + class_type_node, field, "catch_classes", ptr_type_node); + PUSH_FIELD (input_location, class_type_node, field, "interfaces", build_pointer_type (class_ptr_type)); - PUSH_FIELD (class_type_node, field, "loader", ptr_type_node); - PUSH_FIELD (class_type_node, field, "interface_count", short_type_node); - PUSH_FIELD (class_type_node, field, "state", byte_type_node); - PUSH_FIELD (class_type_node, field, "thread", ptr_type_node); - PUSH_FIELD (class_type_node, field, "depth", short_type_node); - PUSH_FIELD (class_type_node, field, "ancestors", ptr_type_node); - PUSH_FIELD (class_type_node, field, "idt", ptr_type_node); - PUSH_FIELD (class_type_node, field, "arrayclass", ptr_type_node); - PUSH_FIELD (class_type_node, field, "protectionDomain", ptr_type_node); - PUSH_FIELD (class_type_node, field, "assertion_table", ptr_type_node); - PUSH_FIELD (class_type_node, field, "hack_signers", ptr_type_node); - PUSH_FIELD (class_type_node, field, "chain", ptr_type_node); - PUSH_FIELD (class_type_node, field, "aux_info", ptr_type_node); - PUSH_FIELD (class_type_node, field, "engine", ptr_type_node); - PUSH_FIELD (class_type_node, field, "reflection_data", ptr_type_node); + PUSH_FIELD (input_location, class_type_node, field, "loader", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "interface_count", short_type_node); + PUSH_FIELD (input_location, class_type_node, field, "state", byte_type_node); + PUSH_FIELD (input_location, class_type_node, field, "thread", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "depth", short_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "ancestors", ptr_type_node); + PUSH_FIELD (input_location, class_type_node, field, "idt", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "arrayclass", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "protectionDomain", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "assertion_table", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "hack_signers", ptr_type_node); + PUSH_FIELD (input_location, class_type_node, field, "chain", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "aux_info", ptr_type_node); + PUSH_FIELD (input_location, class_type_node, field, "engine", ptr_type_node); + PUSH_FIELD (input_location, + class_type_node, field, "reflection_data", ptr_type_node); for (t = TYPE_FIELDS (class_type_node); t != NULL_TREE; t = TREE_CHAIN (t)) FIELD_PRIVATE (t) = 1; push_super_field (class_type_node, object_type_node); FINISH_RECORD (class_type_node); - build_decl (TYPE_DECL, get_identifier ("Class"), class_type_node); + build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("Class"), class_type_node); field_info_union_node = make_node (UNION_TYPE); - PUSH_FIELD (field_info_union_node, field, "boffset", int_type_node); - PUSH_FIELD (field_info_union_node, field, "addr", ptr_type_node); + PUSH_FIELD (input_location, + field_info_union_node, field, "boffset", int_type_node); + PUSH_FIELD (input_location, + field_info_union_node, field, "addr", ptr_type_node); layout_type (field_info_union_node); - PUSH_FIELD (field_type_node, field, "name", utf8const_ptr_type); - PUSH_FIELD (field_type_node, field, "type", class_ptr_type); - PUSH_FIELD (field_type_node, field, "accflags", access_flags_type_node); - PUSH_FIELD (field_type_node, field, "bsize", unsigned_short_type_node); - PUSH_FIELD (field_type_node, field, "info", field_info_union_node); + PUSH_FIELD (input_location, + field_type_node, field, "name", utf8const_ptr_type); + PUSH_FIELD (input_location, field_type_node, field, "type", class_ptr_type); + PUSH_FIELD (input_location, + field_type_node, field, "accflags", access_flags_type_node); + PUSH_FIELD (input_location, + field_type_node, field, "bsize", unsigned_short_type_node); + PUSH_FIELD (input_location, + field_type_node, field, "info", field_info_union_node); FINISH_RECORD (field_type_node); - build_decl (TYPE_DECL, get_identifier ("Field"), field_type_node); + build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("Field"), field_type_node); nativecode_ptr_array_type_node = build_array_type (nativecode_ptr_type_node, one_elt_array_domain_type); - PUSH_FIELD (dtable_type, field, "class", class_ptr_type); - PUSH_FIELD (dtable_type, field, "methods", nativecode_ptr_array_type_node); + PUSH_FIELD (input_location, + dtable_type, field, "class", class_ptr_type); + PUSH_FIELD (input_location, + dtable_type, field, "methods", nativecode_ptr_array_type_node); FINISH_RECORD (dtable_type); - build_decl (TYPE_DECL, get_identifier ("dispatchTable"), dtable_type); + build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("dispatchTable"), dtable_type); jexception_type = make_node (RECORD_TYPE); - PUSH_FIELD (jexception_type, field, "start_pc", ptr_type_node); - PUSH_FIELD (jexception_type, field, "end_pc", ptr_type_node); - PUSH_FIELD (jexception_type, field, "handler_pc", ptr_type_node); - PUSH_FIELD (jexception_type, field, "catch_type", class_ptr_type); + PUSH_FIELD (input_location, + jexception_type, field, "start_pc", ptr_type_node); + PUSH_FIELD (input_location, jexception_type, field, "end_pc", ptr_type_node); + PUSH_FIELD (input_location, + jexception_type, field, "handler_pc", ptr_type_node); + PUSH_FIELD (input_location, + jexception_type, field, "catch_type", class_ptr_type); FINISH_RECORD (jexception_type); - build_decl (TYPE_DECL, get_identifier ("jexception"), field_type_node); + build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("jexception"), field_type_node); jexception_ptr_type = build_pointer_type (jexception_type); lineNumberEntry_type = make_node (RECORD_TYPE); - PUSH_FIELD (lineNumberEntry_type, field, "line_nr", unsigned_short_type_node); - PUSH_FIELD (lineNumberEntry_type, field, "start_pc", ptr_type_node); + PUSH_FIELD (input_location, + lineNumberEntry_type, field, "line_nr", unsigned_short_type_node); + PUSH_FIELD (input_location, + lineNumberEntry_type, field, "start_pc", ptr_type_node); FINISH_RECORD (lineNumberEntry_type); lineNumbers_type = make_node (RECORD_TYPE); - PUSH_FIELD (lineNumbers_type, field, "length", unsigned_int_type_node); + PUSH_FIELD (input_location, + lineNumbers_type, field, "length", unsigned_int_type_node); FINISH_RECORD (lineNumbers_type); - PUSH_FIELD (method_type_node, field, "name", utf8const_ptr_type); - PUSH_FIELD (method_type_node, field, "signature", utf8const_ptr_type); - PUSH_FIELD (method_type_node, field, "accflags", access_flags_type_node); - PUSH_FIELD (method_type_node, field, "index", unsigned_short_type_node); - PUSH_FIELD (method_type_node, field, "ncode", nativecode_ptr_type_node); - PUSH_FIELD (method_type_node, field, "throws", ptr_type_node); + PUSH_FIELD (input_location, + method_type_node, field, "name", utf8const_ptr_type); + PUSH_FIELD (input_location, + method_type_node, field, "signature", utf8const_ptr_type); + PUSH_FIELD (input_location, + method_type_node, field, "accflags", access_flags_type_node); + PUSH_FIELD (input_location, + method_type_node, field, "index", unsigned_short_type_node); + PUSH_FIELD (input_location, + method_type_node, field, "ncode", nativecode_ptr_type_node); + PUSH_FIELD (input_location, + method_type_node, field, "throws", ptr_type_node); FINISH_RECORD (method_type_node); - build_decl (TYPE_DECL, get_identifier ("Method"), method_type_node); + build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("Method"), method_type_node); endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE); @@ -1632,7 +1713,7 @@ give_name_to_locals (JCF *jcf) { tree *ptr; int end_pc = start_pc + length; - tree decl = build_decl (VAR_DECL, name, type); + tree decl = build_decl (input_location, VAR_DECL, name, type); if (end_pc > DECL_CODE_LENGTH (current_function_decl)) { warning (0, "bad PC range for debug info for local %q+D", @@ -1694,7 +1775,8 @@ build_result_decl (tree fndecl) tree result = DECL_RESULT (fndecl); if (! result) { - result = build_decl (RESULT_DECL, NULL_TREE, restype); + result = build_decl (DECL_SOURCE_LOCATION (fndecl), + RESULT_DECL, NULL_TREE, restype); DECL_ARTIFICIAL (result) = 1; DECL_IGNORED_P (result) = 1; DECL_CONTEXT (result) = fndecl; @@ -1733,7 +1815,7 @@ start_java_method (tree fndecl) tree parm_type = TREE_VALUE (tem); gcc_assert (i < DECL_MAX_LOCALS (fndecl)); - parm_decl = build_decl (PARM_DECL, parm_name, parm_type); + parm_decl = build_decl (input_location, PARM_DECL, parm_name, parm_type); DECL_CONTEXT (parm_decl) = fndecl; if (targetm.calls.promote_prototypes (parm_type) && TYPE_PRECISION (parm_type) < TYPE_PRECISION (integer_type_node) diff --git a/gcc/java/except.c b/gcc/java/except.c index d163ba0..e97ed77 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -393,7 +393,8 @@ prepare_eh_table_type (tree type) name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); buf = (char *) alloca (strlen (name) + 5); sprintf (buf, "%s_ref", name); - decl = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node); + decl = build_decl (input_location, + VAR_DECL, get_identifier (buf), ptr_type_node); TREE_STATIC (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; @@ -410,7 +411,8 @@ prepare_eh_table_type (tree type) name = IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (utf8_ref, 0))); buf = (char *) alloca (strlen (name) + 5); sprintf (buf, "%s_ref", name); - decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_ptr_type); + decl = build_decl (input_location, + VAR_DECL, get_identifier (buf), utf8const_ptr_type); TREE_STATIC (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 858bc93..72ca773 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -669,7 +669,7 @@ java_stack_swap (void) flush_quick_stack (); decl1 = find_stack_slot (stack_pointer - 1, type1); decl2 = find_stack_slot (stack_pointer - 2, type2); - temp = build_decl (VAR_DECL, NULL_TREE, type1); + temp = build_decl (input_location, VAR_DECL, NULL_TREE, type1); java_add_local_var (temp); java_add_stmt (build2 (MODIFY_EXPR, type1, temp, decl1)); java_add_stmt (build2 (MODIFY_EXPR, type2, @@ -1192,7 +1192,7 @@ expand_java_arraystore (tree rhs_type_node) MODIFY_EXPR to set the array element. */ access = build_java_arrayaccess (array, rhs_type_node, index); - temp = build_decl (VAR_DECL, NULL_TREE, + temp = build_decl (input_location, VAR_DECL, NULL_TREE, build_pointer_type (TREE_TYPE (access))); java_add_local_var (temp); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (temp), @@ -1332,7 +1332,7 @@ expand_load_internal (int index, tree type, int pc) generated. To avoid this we create a new local and copy our value into it. Then we push this new local on the stack. Hopefully this all gets optimized out. */ - copy = build_decl (VAR_DECL, NULL_TREE, type); + copy = build_decl (input_location, VAR_DECL, NULL_TREE, type); if ((INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)) && TREE_TYPE (copy) != TREE_TYPE (var)) var = convert (type, var); @@ -1824,7 +1824,7 @@ tree create_label_decl (tree name) { tree decl; - decl = build_decl (LABEL_DECL, name, + decl = build_decl (input_location, LABEL_DECL, name, TREE_TYPE (return_address_type_node)); DECL_CONTEXT (decl) = current_function_decl; DECL_IGNORED_P (decl) = 1; @@ -1907,7 +1907,7 @@ expand_java_switch (tree selector, int default_pc) java_add_stmt (switch_expr); x = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE, NULL_TREE, - create_artificial_label ()); + create_artificial_label (input_location)); append_to_statement_list (x, &SWITCH_BODY (switch_expr)); x = build1 (GOTO_EXPR, void_type_node, lookup_label (default_pc)); @@ -1924,7 +1924,7 @@ expand_java_add_case (tree switch_expr, int match, int target_pc) value = build_int_cst (TREE_TYPE (switch_expr), match); x = build3 (CASE_LABEL_EXPR, void_type_node, value, NULL_TREE, - create_artificial_label ()); + create_artificial_label (input_location)); append_to_statement_list (x, &SWITCH_BODY (switch_expr)); x = build1 (GOTO_EXPR, void_type_node, lookup_label (target_pc)); @@ -2026,7 +2026,7 @@ build_class_init (tree clas, tree expr) { /* Build a declaration and mark it as a flag used to track static class initializations. */ - decl = build_decl (VAR_DECL, NULL_TREE, + decl = build_decl (input_location, VAR_DECL, NULL_TREE, boolean_type_node); MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); DECL_CONTEXT (decl) = current_function_decl; @@ -2666,12 +2666,13 @@ build_jni_stub (tree method) DECL_ARTIFICIAL (method) = 1; DECL_EXTERNAL (method) = 0; - env_var = build_decl (VAR_DECL, get_identifier ("env"), ptr_type_node); + env_var = build_decl (input_location, + VAR_DECL, get_identifier ("env"), ptr_type_node); DECL_CONTEXT (env_var) = method; if (TREE_TYPE (TREE_TYPE (method)) != void_type_node) { - res_var = build_decl (VAR_DECL, get_identifier ("res"), + res_var = build_decl (input_location, VAR_DECL, get_identifier ("res"), TREE_TYPE (TREE_TYPE (method))); DECL_CONTEXT (res_var) = method; TREE_CHAIN (env_var) = res_var; @@ -2745,7 +2746,8 @@ build_jni_stub (tree method) garbage-collected. If it is, we end up using canonical types with different uids for equivalent function types, and this in turn causes utf8 identifiers and output order to vary. */ - meth_var = build_decl (VAR_DECL, get_identifier ("meth"), jni_func_type); + meth_var = build_decl (input_location, + VAR_DECL, get_identifier ("meth"), jni_func_type); TREE_STATIC (meth_var) = 1; TREE_PUBLIC (meth_var) = 0; DECL_EXTERNAL (meth_var) = 0; @@ -2971,7 +2973,8 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index) } else { - tree temp = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (field_ref)); + tree temp = build_decl (input_location, + VAR_DECL, NULL_TREE, TREE_TYPE (field_ref)); java_add_local_var (temp); if (TREE_THIS_VOLATILE (field_decl)) @@ -3795,7 +3798,7 @@ force_evaluation_order (tree node) tree build_java_empty_stmt (void) { - tree t = build_empty_stmt (); + tree t = build_empty_stmt (input_location); return t; } @@ -3832,7 +3835,7 @@ cache_cpool_data_ref (void) { tree cpool; tree d = build_constant_data_ref (flag_indirect_classes); - tree cpool_ptr = build_decl (VAR_DECL, NULL_TREE, + tree cpool_ptr = build_decl (input_location, VAR_DECL, NULL_TREE, build_pointer_type (TREE_TYPE (d))); java_add_local_var (cpool_ptr); TREE_CONSTANT (cpool_ptr) = 1; diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c index e2ad02b..c460e5b 100644 --- a/gcc/java/java-gimplify.c +++ b/gcc/java/java-gimplify.c @@ -163,7 +163,7 @@ java_gimplify_block (tree java_block) /* Don't bother with empty blocks. */ if (! body) - return build_empty_stmt (); + return build_empty_stmt (input_location); if (IS_EMPTY_STMT (body)) return body; diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 9ab7660..98352a2 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -1435,15 +1435,15 @@ extern tree *type_map; #define DECL_INNER_CLASS_LIST(NODE) DECL_INITIAL (TYPE_DECL_CHECK (NODE)) /* Add a FIELD_DECL to RECORD_TYPE RTYPE. - The field has name NAME (a char*), and type FTYPE. + The field has name NAME (a char*), a type FTYPE, and a location of LOC. Unless this is the first field, FIELD most hold the previous field. FIELD is set to the newly created FIELD_DECL. We set DECL_ARTIFICIAL so these fields get skipped by make_class_data if compiling java.lang.Object or java.lang.Class. */ -#define PUSH_FIELD(RTYPE, FIELD, NAME, FTYPE) \ -{ tree _field = build_decl (FIELD_DECL, get_identifier ((NAME)), (FTYPE)); \ +#define PUSH_FIELD(LOC, RTYPE, FIELD, NAME, FTYPE) \ +{ tree _field = build_decl (LOC, FIELD_DECL, get_identifier ((NAME)), (FTYPE)); \ if (TYPE_FIELDS (RTYPE) == NULL_TREE) \ TYPE_FIELDS (RTYPE) = _field; \ else \ diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index f28acb0..98c98c8 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -1703,10 +1703,11 @@ java_emit_static_constructor (void) tree name = get_identifier ("_Jv_global_static_constructor"); tree decl - = build_decl (FUNCTION_DECL, name, + = build_decl (input_location, FUNCTION_DECL, name, build_function_type (void_type_node, void_list_node)); - tree resdecl = build_decl (RESULT_DECL, NULL_TREE, void_type_node); + tree resdecl = build_decl (input_location, + RESULT_DECL, NULL_TREE, void_type_node); DECL_ARTIFICIAL (resdecl) = 1; DECL_RESULT (decl) = resdecl; current_function_decl = decl; @@ -1835,7 +1836,8 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) duplicate_class_warning (IDENTIFIER_POINTER (node)); else { - tree file_decl = build_decl (TRANSLATION_UNIT_DECL, node, NULL); + tree file_decl = build_decl (input_location, + TRANSLATION_UNIT_DECL, node, NULL); TREE_CHAIN (file_decl) = current_file_list; current_file_list = file_decl; IS_A_COMMAND_LINE_FILENAME_P (node) = 1; diff --git a/gcc/java/resource.c b/gcc/java/resource.c index e6e50ba..550e1d5 100644 --- a/gcc/java/resource.c +++ b/gcc/java/resource.c @@ -59,9 +59,11 @@ compile_resource_data (const char *name, const char *buffer, int length) data_type = build_prim_array_type (unsigned_byte_type_node, strlen (name) + length); rtype = make_node (RECORD_TYPE); - PUSH_FIELD (rtype, field, "name_length", unsigned_int_type_node); - PUSH_FIELD (rtype, field, "resource_length", unsigned_int_type_node); - PUSH_FIELD (rtype, field, "data", data_type); + PUSH_FIELD (input_location, + rtype, field, "name_length", unsigned_int_type_node); + PUSH_FIELD (input_location, + rtype, field, "resource_length", unsigned_int_type_node); + PUSH_FIELD (input_location, rtype, field, "data", data_type); FINISH_RECORD (rtype); START_RECORD_CONSTRUCTOR (rinit, rtype); PUSH_FIELD_VALUE (rinit, "name_length", @@ -74,7 +76,8 @@ compile_resource_data (const char *name, const char *buffer, int length) FINISH_RECORD_CONSTRUCTOR (rinit); TREE_CONSTANT (rinit) = 1; - decl = build_decl (VAR_DECL, java_mangle_resource_name (name), rtype); + decl = build_decl (input_location, + VAR_DECL, java_mangle_resource_name (name), rtype); TREE_STATIC (decl) = 1; TREE_PUBLIC (decl) = 1; java_hide_decl (decl); @@ -100,7 +103,8 @@ write_resource_constructor (tree *list_p) return; t = build_function_type_list (void_type_node, ptr_type_node, NULL); - t = build_decl (FUNCTION_DECL, get_identifier ("_Jv_RegisterResource"), t); + t = build_decl (input_location, + FUNCTION_DECL, get_identifier ("_Jv_RegisterResource"), t); TREE_PUBLIC (t) = 1; DECL_EXTERNAL (t) = 1; register_resource_fn = t; diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index e812f31..c16976c 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -347,7 +347,7 @@ build_java_array_type (tree element_type, HOST_WIDE_INT length) strcpy (suffix, "[]"); TYPE_NAME (t) = TYPE_STUB_DECL (t) - = build_decl (TYPE_DECL, + = build_decl (input_location, TYPE_DECL, identifier_subst (el_name, "", '.', '.', suffix), t); TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (t)) = true; @@ -360,7 +360,8 @@ build_java_array_type (tree element_type, HOST_WIDE_INT length) TYPE_ARRAY_ELEMENT (t) = element_type; /* Add length pseudo-field. */ - fld = build_decl (FIELD_DECL, get_identifier ("length"), int_type_node); + fld = build_decl (input_location, + FIELD_DECL, get_identifier ("length"), int_type_node); TYPE_FIELDS (t) = fld; DECL_CONTEXT (fld) = t; FIELD_PUBLIC (fld) = 1; @@ -368,7 +369,8 @@ build_java_array_type (tree element_type, HOST_WIDE_INT length) TREE_READONLY (fld) = 1; atype = build_prim_array_type (element_type, length); - arfld = build_decl (FIELD_DECL, get_identifier ("data"), atype); + arfld = build_decl (input_location, + FIELD_DECL, get_identifier ("data"), atype); DECL_CONTEXT (arfld) = t; TREE_CHAIN (fld) = arfld; DECL_ALIGN (arfld) = TYPE_ALIGN (element_type); |