diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2009-06-12 22:06:47 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2009-06-12 22:06:47 +0000 |
commit | c2255bc4884a7624b32185e188fdb94a4167a35c (patch) | |
tree | 67f495ddc3964a90084152e177995da72e7bce30 /gcc/cp | |
parent | 312243969e3a0022c0eabe6f974c24abd4a2211b (diff) | |
download | gcc-c2255bc4884a7624b32185e188fdb94a4167a35c.zip gcc-c2255bc4884a7624b32185e188fdb94a4167a35c.tar.gz gcc-c2255bc4884a7624b32185e188fdb94a4167a35c.tar.bz2 |
java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt.
gcc/java/
* 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.
gcc/objc/
* objc-act.c (finish_var_decl): Pass location to finish_decl.
(objc_get_parm_info): Same.
(get_super_receiver): Same.
* objc-act.c (objc_build_component_ref): Pass location to
build_compound_ref.
(build_module_initializer_routine): Pass location to
c_end_compound_stmt.
(objc_generate_static_init_call): Pass location to build_stmt.
(build_typed_selector_reference): New location argument.
(build_selector_reference): Same.
(objc_substitute_decl): Pass location to build_array_ref.
(next_sjlj_build_try_catch_finally): Pass location to build_stmt.
(objc_begin_catch_clause): Same.
(objc_finish_try_stmt): Same.
(objc_finish_catch_clause): Pass location to c_end_compound_stmt.
(objc_build_throw_stmt): New argument.
(generate_shared_structures): Pass location to build_c_cast.
(objc_build_message_expr): Use local location.
(objc_finish_message_expr): Use input_location.
(build_objc_method_call): New argument.
(objc_build_selector_expr): Same.
(get_super_receiver): Pass location to build_c_cast,
build_modify_expr, build_compound_expr.
* objc-act.c: Add location to all calls to start_struct, build_decl,
finish_struct.
gcc/
* tree-pretty-print.c (dump_generic_node): Dump column numbers.
* gimple-pretty-print.c (dump_gimple_stmt): Same.
* gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs
created.
* c-parser.c (c_parser_binary_expression): Use current column while
building binary operations.
* common.opt (fshow-column): Enable by default.
* tree-vrp.c (check_array_ref): Use warning_at.
(check_array_bounds): Use location from call back if expr has no
location.
* tree.h: Add location argument to maybe_fold_*.
* tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*.
(maybe_fold_offset_to_array_ref): Add location argument and use it.
(maybe_fold_offset_to_component_ref): Same.
(maybe_fold_offset_to_reference): Same.
(maybe_fold_offset_to_address): Same.
(maybe_fold_stmt_indirect): Same.
(maybe_fold_stmt_addition): Same.
(fold_stmt_r): Pass location to maybe_fold_*.
(fold_gimple_assign): Same.
* c-tree.h: Add location argument to finish_decl,
default_function_array_conversion, store_init_value.
* c-decl.c (define_label): Use error_at.
(c_make_fname_decl): Pass location to finish_decl.
(finish_decl): New location argument.
(build_compound_literal): Pass location to store_init_value.
(grokdeclarator): Pass location to finish_decl.
(grokfield): Same.
* c-typeck.c (array_to_pointer_conversion): New location argument.
(function_to_pointer_conversion): Same.
(default_function_array_conversion): Same.
(parser_build_unary_op): Pass location to overflow_warning.
(parser_build_binary_op): Same. Use warning_at.
(build_unary_op): Pass location to array_to_pointer_conversion.
(build_c_cast): Pass location to digest_init.
(build_modify_expr): New location argument.
(convert_for_assignment): Same.
(store_init_value): Same.
(digest_init): Same.
(output_init_element): Pass location to digest_init and
array_to_pointer_conversion.
(c_finish_return): Pass location to convert_for_assignment.
* gimplify.c (gimplify_conversion): Pass location to
maybe_fold_offset_to_address.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location
to maybe_fold_stmt_addition.
* c-omp.c (c_finish_omp_atomic): Pass new location to
build_modify_expr.
(c_finish_omp_for): Same.
* c-common.c (overflow_warning): New argument.
* c-common.h: New argument to build_modify_expr, overflow_warning.
* c-parser.c (c_parser_declaration_or_fndef): Pass location to
finish_decl.
(c_parser_initializer): Pass location to
default_function_array_conversion.
(c_parser_initelt): Same.
(c_parser_initval): Same.
(c_parser_asm_operands): Same.
(c_parser_expr_no_commas): Same. Pass location to build_modify_expr.
(c_parser_conditional_expression): Same.
(c_parser_binary_expression): Add location info to stack. Use it.
(c_parser_unary_expression): Pass location to
default_function_array_conversion, parser_build_unary_op,
build_indirect_ref, c_parser_postfix_expression_after_primary.
(c_parser_postfix_expression_after_primary): New location argument.
Use it.
(c_parser_expression_conv): Pass location to
default_function_array_conversion.
(c_parser_expr_list): Same.
(c_parser_omp_atomic): Same.
(c_parser_omp_for_loop): Same.
* c-tree.h: (struct c_declarator): Add comment to id_loc.
(build_array_declarator): New argument.
* c-decl.c (build_array_declarator): Add location argument.
(grokdeclarator): Set id_loc for cdk_array.
* c-parser.c (c_parser_direct_declarator_inner): Pass location to
build_array_declarator.
* tree.c (build_omp_clause): Add location argument.
* tree.h (OMP_CLAUSE_HAS_LOCATION): New macro.
(OMP_CLAUSE_LOCATION): New macro.
(struct tree_omp_clause): Add location field.
(build_omp_clause): Add argument.
* testsuite/gcc.dg/gomp/for-1.c: Fix column.
* cp/pt.c (tsubst_omp_for_iterator): Pass location to
build_omp_clause.
* cp/parser.c (cp_parser_omp_var_list_no_open): Same.
(cp_parser_omp_clause_collapse): Same.
(cp_parser_omp_clause_default): Same.
(cp_parser_omp_clause_if): Same.
(cp_parser_omp_clause_nowait): Same.
(cp_parser_omp_clause_num_threads): Same.
(cp_parser_omp_clause_ordered): Same.
(cp_parser_omp_clause_schedule): Same.
(cp_parser_omp_clause_untied): Same.
(cp_parser_omp_for_loop): Same.
(cp_parser_omp_parallel): Pass location to c_split_parallel_clauses.
* c-tree.h (c_start_case): Add location argument.
(c_process_expr_stmt): Same.
(c_finish_goto_*): Same.
* tree-parloops.c (initialize_reductions): Pass location to
build_omp_clause.
(create_parallel_loop): Same.
* fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same.
(gfc_trans_omp_reduction_list): Same.
(gfc_trans_omp_clauses): Same.
(gfc_trans_omp_do): Same.
* c-typeck.c (c_finish_goto_label): Same.
(c_finish_goto_ptr): New location argument.
(c_start_case): Same.
(emit_side_effect_warnings): Same.
(c_process_expr_stmt): Same.
(c_finish_stmt_expr): Same.
(c_finish_omp_clauses): Use error_at instead of error.
* gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to
build_omp_clause.
* c-omp.c (c_split_parallel_clauses): New location argument.
* tree-nested.c (convert_nonlocal_reference_stmt): Pass location
to build_omp_clause.
(convert_local_reference_stmt): Same.
(convert_gimple_call): Same.
* c-common.h (c_split_parallel_clauses): New argument.
* c-parser.c (c_parser_statement_after_labels): Pass location to
c_finish_goto_label.
(c_parser_switch_statement): Pass location to c_start_case.
(c_parser_for_statement): Pass location to c_finish_expr_stmt,
and c_process_expr_stmt.
(c_parser_omp_variable_list): Add location argument.
(c_parser_omp_clause_collapse): Pass location to
build_omp_clause.
(c_parser_omp_clause_default): Same.
(c_parser_omp_clause_if): Same.
(c_parser_omp_clause_num_threads): Same.
(-c_parser_omp_clause_ordered): Same.
(c_parser_omp_clause_reduction): Pass location to
c_parser_omp_variable_list.
(c_parser_omp_clause_schedule): Pass location to build_omp_clause.
(c_parser_omp_clause_untied): Same.
(c_parser_omp_for_loop): Pass location to c_process_expr_stmt.
(c_parser_omp_parallel): Pass location to
c_split_parallel_clauses.
* c-tree.h (check_for_loop_decls, undeclared_variable,
build_component_ref, build_array_ref, build_external_ref,
c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op,
build_conditional_expr, build_compound_expr, c_cast_expr,
build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr,
c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New
argument.
* c-semantics.c (build_stmt): Same.
(build_case_label): Same.
* c-decl.c (c_finish_incomplete_decl): Pass location on down.
(undeclared_variable): New argument.
(make_label): Same.
(lookup_label): Pass location on down.
(define_label): Same.
(finish_decl): Same.
(build_compound_literal): Same.
(finish_struct): Same.
(finish_function): Do not set location here.
(check_for_loop_decls): New argument.
* tree.c (save_expr): Set location.
(build_empty_stmt): New argument.
* tree.h (build_empty_stmt): New argument to build_empty_stmt.
(CAN_HAVE_LOCATION_P): Make sure we have a non empty node.
* builtins.c (gimplify_va_arg_expr): Use locations.
(expand_builtin_sync_operation): Same.
* c-typeck.c (build_component_ref): New argument.
(build_array_ref): Same.
(build_external_ref): Same.
(c_expr_sizeof_expr): Same.
(c_expr_sizeof_type): Same.
(parser_build_unary_op): Same.
(build_conditional_expr): Same.
(build_compound_expr): Pass location on down.
(build_compound_expr): New argument.
(build_c_cast): Same.
(c_cast_expr): Same.
(build_asm_expr): Same.
(c_finish_return): Same.
(c_process_expr_stmt): Pass location on down.
(c_finish_stmt_expr): New argument.
(push_clenaup): Same.
(c_finish_omp_parallel): Same.
(c_finish_omp_task): Same.
* gimplify.c (gimplify_call_expr): Pass location on down.
* c-omp.c (c_finish_omp_master): New argument.
(c_finish_omp_critical): Same.
(c_finish_omp_ordered): Same.
(c_finish_omp_barrier): Same.
(-c_finish_omp_taskwait): Same.
(c_finish_omp_atomic): Same.
(c_finish_omp_flush): Same.
* tree-inline.c (copy_tree_body_r): Pass location on down.
(inline_forbidden_p): Remove use of input_location.
* c-gimplify.c (c_build_bind_expr): New argument.
* c-common.c (c_common_truthvalue_conversion): Pass location on down.
(c_sizeof_or_alignof_type): New argument.
(c_alignof_expr): Same.
(build_va_arg): Same.
(c_add_case_label): Same.
* c-common.h (c_sizeof_or_alignof_type, c_alignof_expr,
c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label,
c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt,
c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered,
c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush,
c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses):
New argument.
* stub-objc.c (objc_build_selector_expr): Same.
(objc_build_throw_stmt): Same.
* c-parser.c (c_parser_declaration_or_fndef): Pass location on down.
(c_parser_initelt): Same.
(c_parser_compound_statement): Same.
(c_parser_compound_statement_nostart): Same.
(c_parser_label): Same.
(c_parser_statement_after_labels): Same.
(c_parser_if_body): Same.
(c_parser_else_body): Same.
(c_parser_if_statement): Same.
(c_parser_switch_statement): Same.
(c_parser_while_statement): Same.
(c_parser_do_statement): Same.
(c_parser_for_statement): Same.
(c_parser_asm_statement): Same.
(c_parser_conditional_expression): Same.
(c_parser_binary_expression): Same.
(c_parser_cast_expression): Same.
(c_parser_unary_expression): Same.
(c_parser_sizeof_expression): Same.
(c_parser_alignof_expression): Same.
(c_parser_postfix_expression): Same.
(c_parser_expression): Same.
(c_parser_objc_receiver): Same.
(c_parser_omp_variable_list): Same.
(c_parser_omp_structured_block): Same.
(c_parser_omp_atomic): New argument.
(c_parser_omp_barrier): Same.
(c_parser_omp_critical): Same.
(c_parser_omp_flush): Pass location on down.
(c_parser_omp_for_loop): New argument.
(c_parser_omp_for): Same.
(c_parser_omp_master): Same.
(c_parser_omp_ordered): Same.
(c_parser_omp_sections_scope): Same.
(c_parser_omp_sections): Same.
(c_parser_omp_parallel): Same.
(c_parser_omp_single): Same.
(c_parser_omp_task): Same.
(c_parser_omp_taskwait): Pass location on down.
(c_parser_omp_construct): Same.
(c_parser_omp_threadprivate): Same.
* dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h,
builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c,
tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c,
c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c,
c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c,
emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c,
rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h,
tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c,
config/i386/i386.c, stmt.c:
Add location argument to the following function definitions and/or
function calls: build_decl, objcp_start_struct, objcp_finish_struct,
start_struct, finish_struct, PUSH_FIELD, create_artificial_label,
cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl,
build_compound_literal, parser_xref_tag, resolve_overloaded_builtin,
do_case, c_finish_bc_stmt, build_compound_literal,
build_function_call.
* c-decl.c (build_compound_literal): Add location argument.
Make all diagnostic calls use location.
(start_struct): Same.
(finish_struct): Same.
(start_enum): Same.
(build_enumerator): Same.
(start_function): Same.
(grokdeclarator): Make all diagnostic calls use location.
(store_parm_decls_oldstyle): Same.
* c-typeck.c (build_function_call): Add location argument.
Make all diagnostic calls use location.
(do_case): Same.
(c_finish_bc_stmt): Same.
* tree-nested.c (get_trampoline_type): Add argument.
Pass location to build_decl.
(lookup_tramp_for_decl): Pass location to get_trampoline_type.
* rtl.h (RTL_LOCATION): New.
* c-common.c (c_add_case_label): Add location argument.
Make all diagnostic calls use location.
* c-common.h: Add location argument to make_fname_decl, do_case,
c_add_case_label, build_function_call, resolve_overloaded_builtin.
* c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc.
Set it appropriately for every case. Pass enum_loc to start_enum
call. Pass value_loc first to build_enumerator. Pass enum_loc to
parser_xref_tag.
(c_parser_struct_or_union_specifier): Save location. Use it for
start_struct, finish_struct, and parser_xref_tag.
gcc/testsuite/
* gcc.dg/old-style-prom-3.c: Add column info.
* gcc.dg/overflow-warn-1.c
* gcc.dg/gomp/pr27415.c
* gcc.dg/gomp/for-1.c: Same.
* gcc.dg/enum-compat-1.c: Same.
* gcc.dg/c99-tag-3.c: Same.
* gcc.dg/Wredundant-decls-2.c: Same.
* gcc.dg/func-ptr-conv-1.c: Same.
* gcc.dg/asm-wide-1.c: Same.
* gcc.dg/nofixed-point-2.c: Same.
* gcc.dg/cpp/line3.c: Same.
* gcc.dg/array-10.c: Same.
* gcc.dg/c99-vla-jump-1.c: Same.
* gcc.dg/pr20368-1.c: Same.
* gcc.dg/Wshadow-3.c: Same.
* gcc.dg/c90-const-expr-8.c: Same.
* gcc.dg/label-decl-2.c: Same.
* gcc.dg/dremf-type-compat-2.c: Same.
* gcc.dg/c90-const-expr-5.c: Same.
* gcc.dg/builtins-30.c: Same.
* gcc.dg/Warray-bounds.c: Same.
* gcc.dg/Wcxx-compat-2.c: Same.
* gcc.dg/tree-ssa/col-1.c: Same.
* gcc.dg/old-style-prom-2.c: Same.
* gcc.dg/cast-function-1.c: Same.
* gcc.dg/pr15698-1.c: Same.
* gcc.dg/dremf-type-compat-3.c: Same.
* gcc.dg/vla-8.c: Same.
* gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct
line.
* gcc.dg/label-decl-2.c: Move label diagnostic to correct line.
* gcc.dg/old-style-prom-3.c: Check for error on the correct line.
* gcc.dg/enum-compat-1.c: Same.
* gcc.dg/dremf-type-compat-2.c: Same.
* gcc.dg/old-style-prom-2.c: Same.
* gcc.dg/pr15698-1.c: Same.
* gcc.dg/pr20368-1.c: Same.
* gcc.dg/dremf-type-compat-3.c: Same.
* gcc.dg/builtins-30.c: Same. Test for columns.
gcc/objcp/
* objcp-decl.h (c_end_compound_stmt): New argument.
* objcp-decl.c (objcp_start_struct): Add argument.
(objcp_finish_struct): Same.
gcc/cp/
* typeck.c (cp_build_binary_op): Pass location to overflow_warning.
(build_modify_expr): New arg.
* semantics.c (finish_unary_op_expr): Pass location to
overflow_warning.
(handle_omp_for_class_iterator): Pass location to build_modify_expr.
* typeck.c (cxx_sizeof_or_alignof_type): Pass location to
c_sizeof_or_alignof_type.
(build_array_ref): New argument.
(build_compound_expr): Same.
(build_const_cast): Same.
(build_ptrmemfunc): Pass location to build_c_cast.
* init.c (avoid_placement_new_aliasing): Pass location to
build_stmt.
(build_vec_delete_1): Pass location to cp_build_modify_expr,
build_compound_expr.
* class.c (build_vtbl_ref_1): Pass location to build_array_ref.
* decl.c (poplevel): Pass location to c_build_bind_expr.
(finish_case_label): Pass location to build_case_label.
(finish_constructor_body): Same.
(finish_destructor_body): Pass location to build_stmt.
(cxx_maybe_build_cleanup): Same, but to build_compound_expr.
* call.c (build_new_op): Pass location to build_array_ref.
(build_x_va_arg): Pass location to build_va_arg.
* except.c (expand_end_catch_block): Pass location to
build_stmt.
* cp-tree.h (build_array_ref): New argument.
(build_compound_expr): Same.
(build_c_cast): Same.
* cp-gimplify.c (gimplify_if_stmt): Pass location on down.
(gimplify_switch_stmt): Same.
* typeck2.c (split_nonconstant_init_1): Same.
* pt.c (tsubst_copy): Same.
* semantics.c (add_decl_expr): Same.
(do_poplevel): Same.
(push_cleanup): Same.
(finish_goto_stmt): Same.
(finish_expr_stmt): Same.
(begin_if_stmt): Same.
(begin_while_stmt): Same.
(begin_do_stmt): Same.
(finish_return_stmt): Same.
(begin_for_stmt): Same.
(finish_break_stmt): Same.
(finish_continue_stmt): Same.
(begin_switch_stmt): Same.
(begin_try_block): Same.
(begin_handler): Same.
(finish_asm_stmt): Same.
(finish_label_stmt): Same.
(finish_stmt_expr_expr): Same.
(finalize_nrv_r): Same.
(finish_omp_atomic): Same.
* name-lookup.c (do_using_directive): Same.
* decl2.c (grok_array_decl): Same.
* parser.c (cp_parser_cast_expression): Same.
(cp_parser_selection_statement): Same.
(cp_parser_implicitly_scoped_statement): Same.
(cp_parser_objc_selector_expression): Same.
(cp_parser_objc_synchronized_statement): Same.
(cp_parser_objc_throw_statement): Same.
(cp_parser_omp_critical): Same.
(cp_parser_omp_master): Same.
* typeck.c (build_function_call): Add location argument.
* init.c: Add location argument to all build_decl calls.
* class.c: Same.
* method.c: Same.
* rtti.c: Same.
* tree.c: Same.
* pt.c: Same.
* semantics.c: Same.
* lex.c: Same.
* decl2.c: Same.
* cp-gimplify.c: Same.
* decl.c: Same.
(cp_make_fname_decl): Add location argument. Pass location ot
build_decl.
(finish_case_label): Same.
* cp-tree.h (finish_case_label): Add location argument.
* parser.c (cp_parser_label_for_labeled_statement): Pass location to
finish_case_label.
gcc/fortran/
* trans-array.c (gfc_trans_allocate_array_storage): Pass
location on down.
(gfc_trans_array_constructor_value): Same.
(gfc_trans_scalarized_loop_end): Same.
(gfc_conv_ss_startstride): Same.
(gfc_trans_g77_array): Same.
(gfc_trans_dummy_array_bias): Same.
(gfc_conv_array_parameter): Same.
(structure_alloc_comps): Same.
* trans-expr.c (gfc_conv_function_call): Same.
(fill_with_spaces): Same.
(gfc_trans_string_copy): Same.
(gfc_trans_scalar_assign): Same.
* trans-stmt.c (gfc_trans_goto): Same.
(gfc_trans_if_1): Same.
(gfc_trans_simple_do): Same.
(gfc_trans_do): Same.
(gfc_trans_do_while): Same.
(gfc_trans_logical_select): Same.
(gfc_trans_select): Same.
(gfc_trans_forall_loop): Same.
(gfc_trans_nested_forall_loop): Same.
(generate_loop_for_temp_to_lhs): Same.
(generate_loop_for_rhs_to_temp): Same.
(gfc_trans_forall_1): Same.
(gfc_trans_where_assign): Same.
(gfc_trans_where_3): Same.
(gfc_trans_allocate): Same.
* trans.c (gfc_finish_block): Same.
(gfc_trans_runtime_check): Same.
(gfc_call_malloc): Same.
(gfc_allocate_with_status): Same.
(gfc_call_free): Same.
(gfc_deallocate_with_status): Same.
(gfc_call_realloc): Same.
(gfc_trans_code): Same.
* trans-decl.c (gfc_init_default_dt): Same.
(gfc_generate_constructors): Same.
* trans-io.c (gfc_trans_io_runtime_check): Same.
* trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same.
(gfc_conv_intrinsic_fdate): Same.
(gfc_conv_intrinsic_ttynam): Same.
(gfc_conv_intrinsic_minmax): Same.
(gfc_conv_intrinsic_minmax_char): Same.
(gfc_conv_intrinsic_anyall): Same.
(gfc_conv_intrinsic_count): Same.
(gfc_conv_intrinsic_arith): Same.
(gfc_conv_intrinsic_minmaxloc): Same.
(gfc_conv_intrinsic_minmaxval): Same.
(gfc_conv_intrinsic_rrspacing): Same.
(gfc_conv_intrinsic_array_transfer): Same.
(gfc_conv_intrinsic_trim): Same.
(gfc_conv_intrinsic_repeat): Same.
From-SVN: r148442
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 83 | ||||
-rw-r--r-- | gcc/cp/call.c | 4 | ||||
-rw-r--r-- | gcc/cp/class.c | 17 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 15 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 11 | ||||
-rw-r--r-- | gcc/cp/decl.c | 73 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 11 | ||||
-rw-r--r-- | gcc/cp/except.c | 2 | ||||
-rw-r--r-- | gcc/cp/init.c | 17 | ||||
-rw-r--r-- | gcc/cp/lex.c | 6 | ||||
-rw-r--r-- | gcc/cp/method.c | 9 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 64 | ||||
-rw-r--r-- | gcc/cp/pt.c | 28 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 42 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 49 | ||||
-rw-r--r-- | gcc/cp/tree.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 29 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 |
19 files changed, 310 insertions, 164 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 76f83c6..ec8cef0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,86 @@ +2009-06-12 Aldy Hernandez <aldyh@redhat.com> + + * typeck.c (cp_build_binary_op): Pass location to overflow_warning. + (build_modify_expr): New arg. + * semantics.c (finish_unary_op_expr): Pass location to + overflow_warning. + (handle_omp_for_class_iterator): Pass location to build_modify_expr. + * typeck.c (cxx_sizeof_or_alignof_type): Pass location to + c_sizeof_or_alignof_type. + (build_array_ref): New argument. + (build_compound_expr): Same. + (build_const_cast): Same. + (build_ptrmemfunc): Pass location to build_c_cast. + * init.c (avoid_placement_new_aliasing): Pass location to + build_stmt. + (build_vec_delete_1): Pass location to cp_build_modify_expr, + build_compound_expr. + * class.c (build_vtbl_ref_1): Pass location to build_array_ref. + * decl.c (poplevel): Pass location to c_build_bind_expr. + (finish_case_label): Pass location to build_case_label. + (finish_constructor_body): Same. + (finish_destructor_body): Pass location to build_stmt. + (cxx_maybe_build_cleanup): Same, but to build_compound_expr. + * call.c (build_new_op): Pass location to build_array_ref. + (build_x_va_arg): Pass location to build_va_arg. + * except.c (expand_end_catch_block): Pass location to + build_stmt. + * cp-tree.h (build_array_ref): New argument. + (build_compound_expr): Same. + (build_c_cast): Same. + * cp-gimplify.c (gimplify_if_stmt): Pass location on down. + (gimplify_switch_stmt): Same. + * typeck2.c (split_nonconstant_init_1): Same. + * pt.c (tsubst_copy): Same. + * semantics.c (add_decl_expr): Same. + (do_poplevel): Same. + (push_cleanup): Same. + (finish_goto_stmt): Same. + (finish_expr_stmt): Same. + (begin_if_stmt): Same. + (begin_while_stmt): Same. + (begin_do_stmt): Same. + (finish_return_stmt): Same. + (begin_for_stmt): Same. + (finish_break_stmt): Same. + (finish_continue_stmt): Same. + (begin_switch_stmt): Same. + (begin_try_block): Same. + (begin_handler): Same. + (finish_asm_stmt): Same. + (finish_label_stmt): Same. + (finish_stmt_expr_expr): Same. + (finalize_nrv_r): Same. + (finish_omp_atomic): Same. + * name-lookup.c (do_using_directive): Same. + * decl2.c (grok_array_decl): Same. + * parser.c (cp_parser_cast_expression): Same. + (cp_parser_selection_statement): Same. + (cp_parser_implicitly_scoped_statement): Same. + (cp_parser_objc_selector_expression): Same. + (cp_parser_objc_synchronized_statement): Same. + (cp_parser_objc_throw_statement): Same. + (cp_parser_omp_critical): Same. + (cp_parser_omp_master): Same. + * typeck.c (build_function_call): Add location argument. + * init.c: Add location argument to all build_decl calls. + * class.c: Same. + * method.c: Same. + * rtti.c: Same. + * tree.c: Same. + * pt.c: Same. + * semantics.c: Same. + * lex.c: Same. + * decl2.c: Same. + * cp-gimplify.c: Same. + * decl.c: Same. + (cp_make_fname_decl): Add location argument. Pass location ot + build_decl. + (finish_case_label): Same. + * cp-tree.h (finish_case_label): Add location argument. + * parser.c (cp_parser_label_for_labeled_statement): Pass location to + finish_case_label. + 2009-06-09 Jason Merrill <jason@redhat.com> PR c++/40381 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index db45ab0..f33d645 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4398,7 +4398,7 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3, return cp_build_unary_op (code, arg1, candidates != 0, complain); case ARRAY_REF: - return build_array_ref (arg1, arg2, input_location); + return build_array_ref (input_location, arg1, arg2); case COND_EXPR: return build_conditional_expr (arg1, arg2, arg3, complain); @@ -5102,7 +5102,7 @@ build_x_va_arg (tree expr, tree type) return expr; } - return build_va_arg (expr, type); + return build_va_arg (input_location, expr, type); } /* TYPE has been given to va_arg. Apply the default conversions which diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 20ceb65..94b75ca 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -626,7 +626,7 @@ build_vtbl_ref_1 (tree instance, tree idx) vtbl = build_vfield_ref (instance, basetype); - aref = build_array_ref (vtbl, idx, input_location); + aref = build_array_ref (input_location, vtbl, idx); TREE_CONSTANT (aref) |= TREE_CONSTANT (vtbl) && TREE_CONSTANT (idx); return aref; @@ -3636,7 +3636,8 @@ build_base_field (record_layout_info rli, tree binfo, CLASSTYPE_EMPTY_P (t) = 0; /* Create the FIELD_DECL. */ - decl = build_decl (FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype)); + decl = build_decl (input_location, + FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype)); DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; DECL_FIELD_CONTEXT (decl) = t; @@ -4428,7 +4429,8 @@ create_vtable_ptr (tree t, tree* virtuals_p) stores cannot alias stores to void*! */ tree field; - field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node); + field = build_decl (input_location, + FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node); DECL_VIRTUAL_P (field) = 1; DECL_ARTIFICIAL (field) = 1; DECL_FIELD_CONTEXT (field) = t; @@ -5008,7 +5010,8 @@ layout_class_type (tree t, tree *virtuals_p) { tree padding_field; - padding_field = build_decl (FIELD_DECL, + padding_field = build_decl (input_location, + FIELD_DECL, NULL_TREE, char_type_node); DECL_BIT_FIELD (padding_field) = 1; @@ -5096,7 +5099,8 @@ layout_class_type (tree t, tree *virtuals_p) for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field)) if (TREE_CODE (field) == FIELD_DECL) { - *next_field = build_decl (FIELD_DECL, + *next_field = build_decl (input_location, + FIELD_DECL, DECL_NAME (field), TREE_TYPE (field)); DECL_CONTEXT (*next_field) = base_t; @@ -5137,7 +5141,8 @@ layout_class_type (tree t, tree *virtuals_p) /* Make sure not to create any structures with zero size. */ if (integer_zerop (rli_size_unit_so_far (rli)) && CLASSTYPE_EMPTY_P (t)) place_field (rli, - build_decl (FIELD_DECL, NULL_TREE, char_type_node)); + build_decl (input_location, + FIELD_DECL, NULL_TREE, char_type_node)); /* Let the back end lay out the type. */ finish_record_layout (rli, /*free_p=*/true); diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 4664157..29f4f38 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -50,7 +50,7 @@ static tree bc_label[2]; static tree begin_bc_block (enum bc_t bc) { - tree label = create_artificial_label (); + tree label = create_artificial_label (input_location); TREE_CHAIN (label) = bc_label[bc]; bc_label[bc] = label; return label; @@ -169,9 +169,9 @@ genericize_if_stmt (tree *stmt_p) else_ = ELSE_CLAUSE (stmt); if (!then_) - then_ = build_empty_stmt (); + then_ = build_empty_stmt (locus); if (!else_) - else_ = build_empty_stmt (); + else_ = build_empty_stmt (locus); if (integer_nonzerop (cond) && !TREE_SIDE_EFFECTS (else_)) stmt = then_; @@ -226,7 +226,7 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) back through the main gimplifier to lower it. Given that we have to gimplify the loop body NOW so that we can resolve break/continue stmts, seems easier to just expand to gotos. */ - top = gimple_build_label (create_artificial_label ()); + top = gimple_build_label (create_artificial_label (stmt_locus)); /* If we have an exit condition, then we build an IF with gotos either out of the loop, or to the top of it. If there's no exit condition, @@ -247,7 +247,8 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) { if (incr) { - entry = gimple_build_label (create_artificial_label ()); + entry = gimple_build_label + (create_artificial_label (stmt_locus)); stmt = gimple_build_goto (gimple_label_label (entry)); } else @@ -334,7 +335,7 @@ gimplify_switch_stmt (tree *stmt_p, gimple_seq *pre_p) body = SWITCH_STMT_BODY (stmt); if (!body) - body = build_empty_stmt (); + body = build_empty_stmt (stmt_locus); t = build3 (SWITCH_EXPR, SWITCH_STMT_TYPE (stmt), SWITCH_STMT_COND (stmt), body, NULL_TREE); @@ -939,7 +940,7 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) append_to_statement_list (t, &ret); } - lab = create_artificial_label (); + lab = create_artificial_label (input_location); t = build1 (LABEL_EXPR, void_type_node, lab); append_to_statement_list (t, &ret); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e31726c..19d61bf 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4380,7 +4380,7 @@ extern tree reshape_init (tree, tree); extern bool defer_mark_used_calls; extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls; -extern tree finish_case_label (tree, tree); +extern tree finish_case_label (location_t, tree, tree); extern tree cxx_maybe_build_cleanup (tree); /* in decl2.c */ @@ -4542,7 +4542,8 @@ extern tree type_uses_auto (tree); extern void append_type_to_template_for_access_check (tree, tree, tree); extern tree splice_late_return_type (tree, tree); extern bool is_auto (const_tree); -extern tree process_template_parm (tree, tree, bool, bool); +extern tree process_template_parm (tree, location_t, tree, + bool, bool); extern tree end_template_parm_list (tree); extern void end_template_decl (void); extern bool check_default_tmpl_args (tree, tree, int, int, int); @@ -4933,7 +4934,7 @@ extern tree build_x_indirect_ref (tree, const char *, tsubst_flags_t); extern tree cp_build_indirect_ref (tree, const char *, tsubst_flags_t); -extern tree build_array_ref (tree, tree, location_t); +extern tree build_array_ref (location_t, tree, tree); extern tree get_member_function_from_ptrfunc (tree *, tree); extern tree cp_build_function_call (tree, tree, tsubst_flags_t); extern tree cp_build_function_call_vec (tree, VEC(tree,gc) **, @@ -4953,12 +4954,12 @@ extern tree build_x_conditional_expr (tree, tree, tree, extern tree build_x_compound_expr_from_list (tree, const char *); extern tree build_x_compound_expr_from_vec (VEC(tree,gc) *, const char *); extern tree build_x_compound_expr (tree, tree, tsubst_flags_t); -extern tree build_compound_expr (tree, tree); +extern tree build_compound_expr (location_t, tree, tree); extern tree cp_build_compound_expr (tree, tree, tsubst_flags_t); extern tree build_static_cast (tree, tree, tsubst_flags_t); extern tree build_reinterpret_cast (tree, tree, tsubst_flags_t); extern tree build_const_cast (tree, tree, tsubst_flags_t); -extern tree build_c_cast (tree, tree); +extern tree build_c_cast (location_t, tree, tree); extern tree cp_build_c_cast (tree, tree, tsubst_flags_t); extern tree build_x_modify_expr (tree, enum tree_code, tree, tsubst_flags_t); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index bf99b3d..22c426b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -94,7 +94,7 @@ static tree get_atexit_node (void); static tree get_dso_handle_node (void); static tree start_cleanup_fn (void); static void end_cleanup_fn (void); -static tree cp_make_fname_decl (tree, int); +static tree cp_make_fname_decl (location_t, tree, int); static void initialize_predefined_identifiers (void); static tree check_special_function_return_type (special_function_kind, tree, tree); @@ -743,7 +743,7 @@ poplevel (int keep, int reverse, int functionbody) have pushed a statement list level. Pop that, create a new BIND_EXPR for the block, and insert it into the stream. */ stmt = pop_stmt_list (current_binding_level->statement_list); - stmt = c_build_bind_expr (block, stmt); + stmt = c_build_bind_expr (input_location, block, stmt); add_stmt (stmt); } @@ -842,7 +842,7 @@ create_implicit_typedef (tree name, tree type) { tree decl; - decl = build_decl (TYPE_DECL, name, type); + decl = build_decl (input_location, TYPE_DECL, name, type); DECL_ARTIFICIAL (decl) = 1; /* There are other implicit type declarations, like the one *within* a class that allows you to write `S::S'. We must distinguish @@ -2368,7 +2368,7 @@ make_label_decl (tree id, int local_p) void **slot; tree decl; - decl = build_decl (LABEL_DECL, id, void_type_node); + decl = build_decl (input_location, LABEL_DECL, id, void_type_node); DECL_CONTEXT (decl) = current_function_decl; DECL_MODE (decl) = VOIDmode; @@ -2795,7 +2795,7 @@ pop_switch (void) is a bad place for one. */ tree -finish_case_label (tree low_value, tree high_value) +finish_case_label (location_t loc, tree low_value, tree high_value) { tree cond, r; struct cp_binding_level *p; @@ -2806,8 +2806,8 @@ finish_case_label (tree low_value, tree high_value) /* For templates, just add the case label; we'll do semantic analysis at instantiation-time. */ - label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - return add_stmt (build_case_label (low_value, high_value, label)); + label = build_decl (loc, LABEL_DECL, NULL_TREE, NULL_TREE); + return add_stmt (build_case_label (loc, low_value, high_value, label)); } /* Find the condition on which this switch statement depends. */ @@ -2818,7 +2818,7 @@ finish_case_label (tree low_value, tree high_value) if (!check_switch_goto (switch_stack->level)) return error_mark_node; - r = c_add_case_label (switch_stack->cases, cond, + r = c_add_case_label (loc, switch_stack->cases, cond, SWITCH_STMT_TYPE (switch_stack->switch_stmt), low_value, high_value); @@ -2915,7 +2915,7 @@ build_typename_type (tree context, tree name, tree fullname, TYPENAME_IS_CLASS_P (t) = ti.class_p; /* Build the corresponding TYPE_DECL. */ - d = build_decl (TYPE_DECL, name, t); + d = build_decl (input_location, TYPE_DECL, name, t); TYPE_NAME (TREE_TYPE (d)) = d; TYPE_STUB_DECL (TREE_TYPE (d)) = d; DECL_CONTEXT (d) = FROB_CONTEXT (context); @@ -3113,7 +3113,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list, SET_TYPE_STRUCTURAL_EQUALITY (t); /* Build the corresponding TEMPLATE_DECL. */ - d = build_decl (TEMPLATE_DECL, name, t); + d = build_decl (input_location, TEMPLATE_DECL, name, t); TYPE_NAME (TREE_TYPE (d)) = d; TYPE_STUB_DECL (TREE_TYPE (d)) = d; DECL_CONTEXT (d) = FROB_CONTEXT (context); @@ -3150,7 +3150,7 @@ record_builtin_type (enum rid rid_index, up built-in types by name. */ if (tname) { - tdecl = build_decl (TYPE_DECL, tname, type); + tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, tname, type); DECL_ARTIFICIAL (tdecl) = 1; SET_IDENTIFIER_GLOBAL_VALUE (tname, tdecl); } @@ -3158,7 +3158,7 @@ record_builtin_type (enum rid rid_index, { if (!tdecl) { - tdecl = build_decl (TYPE_DECL, rname, type); + tdecl = build_decl (BUILTINS_LOCATION, TYPE_DECL, rname, type); DECL_ARTIFICIAL (tdecl) = 1; } SET_IDENTIFIER_GLOBAL_VALUE (rname, tdecl); @@ -3218,7 +3218,8 @@ record_builtin_java_type (const char* name, int size) static void record_unknown_type (tree type, const char* name) { - tree decl = pushdecl (build_decl (TYPE_DECL, get_identifier (name), type)); + tree decl = pushdecl (build_decl (UNKNOWN_LOCATION, + TYPE_DECL, get_identifier (name), type)); /* Make sure the "unknown type" typedecl gets ignored for debug info. */ DECL_IGNORED_P (decl) = 1; TYPE_DECL_SUPPRESS_DEBUG (decl) = 1; @@ -3492,20 +3493,21 @@ cp_fname_init (const char* name, tree *type_p) return init; } -/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give the - decl, NAME is the initialization string and TYPE_DEP indicates whether - NAME depended on the type of the function. We make use of that to detect - __PRETTY_FUNCTION__ inside a template fn. This is being done - lazily at the point of first use, so we mustn't push the decl now. */ +/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give + the decl, LOC is the location to give the decl, NAME is the + initialization string and TYPE_DEP indicates whether NAME depended + on the type of the function. We make use of that to detect + __PRETTY_FUNCTION__ inside a template fn. This is being done lazily + at the point of first use, so we mustn't push the decl now. */ static tree -cp_make_fname_decl (tree id, int type_dep) +cp_make_fname_decl (location_t loc, tree id, int type_dep) { const char *const name = (type_dep && processing_template_decl ? NULL : fname_as_string (type_dep)); tree type; tree init = cp_fname_init (name, &type); - tree decl = build_decl (VAR_DECL, id, type); + tree decl = build_decl (loc, VAR_DECL, id, type); if (name) free (CONST_CAST (char *, name)); @@ -5898,7 +5900,7 @@ declare_global_var (tree name, tree type) tree decl; push_to_top_level (); - decl = build_decl (VAR_DECL, name, type); + decl = build_decl (input_location, VAR_DECL, name, type); TREE_PUBLIC (decl) = 1; DECL_EXTERNAL (decl) = 1; DECL_ARTIFICIAL (decl) = 1; @@ -6952,7 +6954,7 @@ grokvardecl (tree type, || TYPE_P (scope))) decl = build_lang_decl (VAR_DECL, name, type); else - decl = build_decl (VAR_DECL, name, type); + decl = build_decl (input_location, VAR_DECL, name, type); if (explicit_scope && TREE_CODE (explicit_scope) == NAMESPACE_DECL) set_decl_namespace (decl, explicit_scope, 0); @@ -7063,10 +7065,11 @@ build_ptrmemfunc_type (tree type) /* ... and not really a class type. */ SET_CLASS_TYPE_P (t, 0); - field = build_decl (FIELD_DECL, pfn_identifier, type); + field = build_decl (input_location, FIELD_DECL, pfn_identifier, type); fields = field; - field = build_decl (FIELD_DECL, delta_identifier, delta_type_node); + field = build_decl (input_location, FIELD_DECL, delta_identifier, + delta_type_node); TREE_CHAIN (field) = fields; fields = field; @@ -8804,7 +8807,7 @@ grokdeclarator (const cp_declarator *declarator, if (decl_context == FIELD) decl = build_lang_decl (TYPE_DECL, unqualified_id, type); else - decl = build_decl (TYPE_DECL, unqualified_id, type); + decl = build_decl (input_location, TYPE_DECL, unqualified_id, type); if (id_declarator && declarator->u.id.qualifying_scope) { error ("%Jtypedef name may not be a nested-name-specifier", decl); TREE_TYPE (decl) = error_mark_node; @@ -9310,7 +9313,8 @@ grokdeclarator (const cp_declarator *declarator, } else { - decl = build_decl (FIELD_DECL, unqualified_id, type); + decl = build_decl (input_location, + FIELD_DECL, unqualified_id, type); DECL_NONADDRESSABLE_P (decl) = bitfield; if (bitfield && !unqualified_id) TREE_NO_WARNING (decl) = 1; @@ -11387,7 +11391,7 @@ build_enumerator (tree name, tree value, tree enumtype) else /* It's a global enum, or it's local to a function. (Note local to a function could mean local to a class method. */ - decl = build_decl (CONST_DECL, name, type); + decl = build_decl (input_location, CONST_DECL, name, type); DECL_CONTEXT (decl) = FROB_CONTEXT (context); TREE_CONSTANT (decl) = 1; @@ -11614,7 +11618,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) { tree resdecl; - resdecl = build_decl (RESULT_DECL, 0, restype); + resdecl = build_decl (input_location, RESULT_DECL, 0, restype); DECL_ARTIFICIAL (resdecl) = 1; DECL_IGNORED_P (resdecl) = 1; DECL_RESULT (decl1) = resdecl; @@ -11857,7 +11861,8 @@ start_preparsed_function (tree decl1, tree attrs, int flags) || (DECL_CONSTRUCTOR_P (decl1) && targetm.cxx.cdtor_returns_this ())) { - cdtor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); + cdtor_label = build_decl (input_location, + LABEL_DECL, NULL_TREE, NULL_TREE); DECL_CONTEXT (cdtor_label) = current_function_decl; } @@ -12039,13 +12044,13 @@ finish_constructor_body (void) && (! TYPE_FOR_JAVA (current_class_type))) { /* Any return from a constructor will end up here. */ - add_stmt (build_stmt (LABEL_EXPR, cdtor_label)); + add_stmt (build_stmt (input_location, LABEL_EXPR, cdtor_label)); val = DECL_ARGUMENTS (current_function_decl); val = build2 (MODIFY_EXPR, TREE_TYPE (val), DECL_RESULT (current_function_decl), val); /* Return the address of the object. */ - exprstmt = build_stmt (RETURN_EXPR, val); + exprstmt = build_stmt (input_location, RETURN_EXPR, val); add_stmt (exprstmt); } } @@ -12087,7 +12092,7 @@ finish_destructor_body (void) /* Any return from a destructor will end up here; that way all base and member cleanups will be run when the function returns. */ - add_stmt (build_stmt (LABEL_EXPR, cdtor_label)); + add_stmt (build_stmt (input_location, LABEL_EXPR, cdtor_label)); /* In a virtual destructor, we must call delete. */ if (DECL_VIRTUAL_P (current_function_decl)) @@ -12125,7 +12130,7 @@ finish_destructor_body (void) val = build2 (MODIFY_EXPR, TREE_TYPE (val), DECL_RESULT (current_function_decl), val); /* Return the address of the object. */ - exprstmt = build_stmt (RETURN_EXPR, val); + exprstmt = build_stmt (input_location, RETURN_EXPR, val); add_stmt (exprstmt); } } @@ -12709,7 +12714,7 @@ cxx_maybe_build_cleanup (tree decl) call = build_delete (TREE_TYPE (addr), addr, sfk_complete_destructor, flags, 0); if (cleanup) - cleanup = build_compound_expr (cleanup, call); + cleanup = build_compound_expr (input_location, cleanup, call); else cleanup = call; } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index b4f4404..c540c08 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -132,7 +132,8 @@ build_memfn_type (tree fntype, tree ctype, cp_cv_quals quals) tree cp_build_parm_decl (tree name, tree type) { - tree parm = build_decl (PARM_DECL, name, type); + tree parm = build_decl (input_location, + PARM_DECL, name, type); /* DECL_ARG_TYPE is only used by the back end and the back end never sees templates. */ if (!processing_template_decl) @@ -354,7 +355,7 @@ grok_array_decl (tree array_expr, tree index_exp) if (array_expr == error_mark_node || index_exp == error_mark_node) error ("ambiguous conversion for array subscript"); - expr = build_array_ref (array_expr, index_exp, input_location); + expr = build_array_ref (input_location, array_expr, index_exp); } if (processing_template_decl && expr != error_mark_node) return build_min_non_dep (ARRAY_REF, expr, orig_array_expr, orig_index_exp, @@ -1287,7 +1288,8 @@ build_anon_union_vars (tree type, tree object) { tree base; - decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field)); + decl = build_decl (input_location, + VAR_DECL, DECL_NAME (field), TREE_TYPE (field)); DECL_ANON_UNION_VAR_P (decl) = 1; base = get_base_address (object); @@ -2495,7 +2497,8 @@ get_guard (tree decl) /* We use a type that is big enough to contain a mutex as well as an integer counter. */ guard_type = targetm.cxx.guard_type (); - guard = build_decl (VAR_DECL, sname, guard_type); + guard = build_decl (DECL_SOURCE_LOCATION (decl), + VAR_DECL, sname, guard_type); /* The guard should have the same linkage as what it guards. */ TREE_PUBLIC (guard) = TREE_PUBLIC (decl); diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 99c7036..92def0f 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -521,7 +521,7 @@ expand_end_catch_block (void) tree begin_eh_spec_block (void) { - tree r = build_stmt (EH_SPEC_BLOCK, NULL_TREE, NULL_TREE); + tree r = build_stmt (input_location, EH_SPEC_BLOCK, NULL_TREE, NULL_TREE); add_stmt (r); EH_SPEC_STMTS (r) = push_stmt_list (); return r; diff --git a/gcc/cp/init.c b/gcc/cp/init.c index a99983e..2608996 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2399,7 +2399,8 @@ build_java_class_ref (tree type) class_decl = IDENTIFIER_GLOBAL_VALUE (name); if (class_decl == NULL_TREE) { - class_decl = build_decl (VAR_DECL, name, TREE_TYPE (jclass_node)); + class_decl = build_decl (input_location, + VAR_DECL, name, TREE_TYPE (jclass_node)); TREE_STATIC (class_decl) = 1; DECL_EXTERNAL (class_decl) = 1; TREE_PUBLIC (class_decl) = 1; @@ -2465,15 +2466,17 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, fold_convert (ptype, base))); tmp = fold_build1 (NEGATE_EXPR, sizetype, size_exp); body = build_compound_expr - (body, cp_build_modify_expr (tbase, NOP_EXPR, + (input_location, + body, cp_build_modify_expr (tbase, NOP_EXPR, build2 (POINTER_PLUS_EXPR, ptype, tbase, tmp), tf_warning_or_error)); body = build_compound_expr - (body, build_delete (ptype, tbase, sfk_complete_destructor, + (input_location, + body, build_delete (ptype, tbase, sfk_complete_destructor, LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1)); loop = build1 (LOOP_EXPR, void_type_node, body); - loop = build_compound_expr (tbase_init, loop); + loop = build_compound_expr (input_location, tbase_init, loop); no_destructor: /* If the delete flag is one, or anything else with the low bit set, @@ -2520,7 +2523,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, else if (!body) body = deallocate_expr; else - body = build_compound_expr (body, deallocate_expr); + body = build_compound_expr (input_location, body, deallocate_expr); if (!body) body = integer_zero_node; @@ -2553,11 +2556,11 @@ create_temporary_var (tree type) { tree decl; - decl = build_decl (VAR_DECL, NULL_TREE, type); + decl = build_decl (input_location, + VAR_DECL, NULL_TREE, type); TREE_USED (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; - DECL_SOURCE_LOCATION (decl) = input_location; DECL_CONTEXT (decl) = current_function_decl; return decl; diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 66377ff..bf50741 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -454,7 +454,8 @@ unqualified_name_lookup_error (tree name) if (current_function_decl) { tree decl; - decl = build_decl (VAR_DECL, name, error_mark_node); + decl = build_decl (input_location, + VAR_DECL, name, error_mark_node); DECL_CONTEXT (decl) = current_function_decl; push_local_binding (name, decl, 0); /* Mark the variable as used so that we do not get warnings @@ -511,7 +512,8 @@ build_lang_decl (enum tree_code code, tree name, tree type) { tree t; - t = build_decl (code, name, type); + t = build_decl (input_location, + code, name, type); retrofit_lang_decl (t); /* All nesting of C++ functions is lexical; there is never a "static diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 410503d..0ceff66 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -126,7 +126,8 @@ make_thunk (tree function, bool this_adjusting, gcc_assert (TYPE_SIZE (DECL_CONTEXT (function)) && TYPE_BEING_DEFINED (DECL_CONTEXT (function))); - thunk = build_decl (FUNCTION_DECL, NULL_TREE, TREE_TYPE (function)); + thunk = build_decl (DECL_SOURCE_LOCATION (function), + FUNCTION_DECL, NULL_TREE, TREE_TYPE (function)); DECL_LANG_SPECIFIC (thunk) = DECL_LANG_SPECIFIC (function); cxx_dup_lang_specific_decl (thunk); DECL_THUNKS (thunk) = NULL_TREE; @@ -262,7 +263,8 @@ static GTY (()) int thunk_labelno; tree make_alias_for (tree function, tree newid) { - tree alias = build_decl (FUNCTION_DECL, newid, TREE_TYPE (function)); + tree alias = build_decl (DECL_SOURCE_LOCATION (function), + FUNCTION_DECL, newid, TREE_TYPE (function)); DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function); cxx_dup_lang_specific_decl (alias); DECL_CONTEXT (alias) = NULL; @@ -428,7 +430,8 @@ use_thunk (tree thunk_fndecl, bool emit_p) current_function_decl = thunk_fndecl; DECL_RESULT (thunk_fndecl) - = build_decl (RESULT_DECL, 0, integer_type_node); + = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl), + RESULT_DECL, 0, integer_type_node); fnname = IDENTIFIER_POINTER (DECL_NAME (thunk_fndecl)); /* The back end expects DECL_INITIAL to contain a BLOCK, so we create one. */ diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 215750f..f6b22bb 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3491,7 +3491,7 @@ do_using_directive (tree name_space) gcc_assert (TREE_CODE (name_space) == NAMESPACE_DECL); if (building_stmt_tree ()) - add_stmt (build_stmt (USING_STMT, name_space)); + add_stmt (build_stmt (input_location, USING_STMT, name_space)); name_space = ORIGINAL_NAMESPACE (name_space); if (!toplevel_bindings_p ()) @@ -5415,7 +5415,7 @@ cp_emit_debug_info_for_using (tree t, tree context) if (TREE_CODE (t) != TEMPLATE_DECL) { if (building_stmt_tree ()) - add_stmt (build_stmt (USING_STMT, t)); + add_stmt (build_stmt (input_location, USING_STMT, t)); else (*debug_hooks->imported_module_or_decl) (t, NULL_TREE, context, false); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index b988850..07f0375 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6135,7 +6135,7 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p, return error_mark_node; /* Perform the cast. */ - expr = build_c_cast (type, expr); + expr = build_c_cast (input_location, type, expr); return expr; } else @@ -7093,7 +7093,7 @@ cp_parser_label_for_labeled_statement (cp_parser* parser) expr_hi = NULL_TREE; if (parser->in_switch_statement_p) - finish_case_label (expr, expr_hi); + finish_case_label (token->location, expr, expr_hi); else error ("%Hcase label %qE not within a switch statement", &token->location, expr); @@ -7105,7 +7105,7 @@ cp_parser_label_for_labeled_statement (cp_parser* parser) cp_lexer_consume_token (parser->lexer); if (parser->in_switch_statement_p) - finish_case_label (NULL_TREE, NULL_TREE); + finish_case_label (token->location, NULL_TREE, NULL_TREE); else error ("%Hcase label not within a switch statement", &token->location); break; @@ -7326,7 +7326,7 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p) if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { location_t loc = cp_lexer_peek_token (parser->lexer)->location; - add_stmt (build_empty_stmt ()); + add_stmt (build_empty_stmt (loc)); cp_lexer_consume_token (parser->lexer); if (!cp_lexer_next_token_is_keyword (parser->lexer, RID_ELSE)) warning_at (loc, OPT_Wempty_body, "suggest braces around " @@ -7349,10 +7349,12 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p) /* Parse the else-clause. */ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { - warning_at (cp_lexer_peek_token (parser->lexer)->location, + location_t loc; + loc = cp_lexer_peek_token (parser->lexer)->location; + warning_at (loc, OPT_Wempty_body, "suggest braces around " "empty body in an %<else%> statement"); - add_stmt (build_empty_stmt ()); + add_stmt (build_empty_stmt (loc)); cp_lexer_consume_token (parser->lexer); } else @@ -7860,8 +7862,9 @@ cp_parser_implicitly_scoped_statement (cp_parser* parser, bool *if_p) /* Mark if () ; with a special NOP_EXPR. */ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { + location_t loc = cp_lexer_peek_token (parser->lexer)->location; cp_lexer_consume_token (parser->lexer); - statement = add_stmt (build_empty_stmt ()); + statement = add_stmt (build_empty_stmt (loc)); } /* if a compound is opened, we simply parse the statement directly. */ else if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) @@ -9680,14 +9683,17 @@ cp_parser_template_parameter_list (cp_parser* parser) tree parameter; bool is_non_type; bool is_parameter_pack; + location_t parm_loc; /* Parse the template-parameter. */ + parm_loc = cp_lexer_peek_token (parser->lexer)->location; parameter = cp_parser_template_parameter (parser, &is_non_type, &is_parameter_pack); /* Add it to the list. */ if (parameter != error_mark_node) parameter_list = process_template_parm (parameter_list, + parm_loc, parameter, is_non_type, is_parameter_pack); @@ -15862,7 +15868,8 @@ cp_parser_member_declaration (cp_parser* parser) know it is an anonymous aggregate. */ fixup_anonymous_aggr (type); /* And make the corresponding data member. */ - decl = build_decl (FIELD_DECL, NULL_TREE, type); + decl = build_decl (decl_spec_token_start->location, + FIELD_DECL, NULL_TREE, type); /* Add it to the class. */ finish_member_declaration (decl); } @@ -19432,6 +19439,7 @@ cp_parser_objc_selector_expression (cp_parser* parser) tree sel_seq = NULL_TREE; bool maybe_unary_selector_p = true; cp_token *token; + location_t loc = cp_lexer_peek_token (parser->lexer)->location; cp_lexer_consume_token (parser->lexer); /* Eat '@selector'. */ cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"); @@ -19483,7 +19491,7 @@ cp_parser_objc_selector_expression (cp_parser* parser) finish_selector: cp_parser_require (parser, CPP_CLOSE_PAREN, "%<)%>"); - return objc_build_selector_expr (sel_seq); + return objc_build_selector_expr (loc, sel_seq); } /* Parse a list of identifiers. @@ -20256,6 +20264,7 @@ cp_parser_objc_synchronized_statement (cp_parser *parser) { static tree cp_parser_objc_throw_statement (cp_parser *parser) { tree expr = NULL_TREE; + location_t loc = cp_lexer_peek_token (parser->lexer)->location; cp_parser_require_keyword (parser, RID_AT_THROW, "%<@throw%>"); @@ -20264,7 +20273,7 @@ cp_parser_objc_throw_statement (cp_parser *parser) { cp_parser_consume_semicolon_at_end_of_statement (parser); - return objc_build_throw_stmt (expr); + return objc_build_throw_stmt (loc, expr); } /* Parse an Objective-C statement. */ @@ -20418,7 +20427,7 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind, cp_parser_name_lookup_error (parser, name, decl, NULL, token->location); else if (kind != 0) { - tree u = build_omp_clause (kind); + tree u = build_omp_clause (token->location, kind); OMP_CLAUSE_DECL (u) = decl; OMP_CLAUSE_CHAIN (u) = list; list = u; @@ -20496,7 +20505,7 @@ cp_parser_omp_clause_collapse (cp_parser *parser, tree list, location_t location } check_no_duplicate_clause (list, OMP_CLAUSE_COLLAPSE, "collapse", location); - c = build_omp_clause (OMP_CLAUSE_COLLAPSE); + c = build_omp_clause (loc, OMP_CLAUSE_COLLAPSE); OMP_CLAUSE_CHAIN (c) = list; OMP_CLAUSE_COLLAPSE_EXPR (c) = num; @@ -20554,7 +20563,7 @@ cp_parser_omp_clause_default (cp_parser *parser, tree list, location_t location) return list; check_no_duplicate_clause (list, OMP_CLAUSE_DEFAULT, "default", location); - c = build_omp_clause (OMP_CLAUSE_DEFAULT); + c = build_omp_clause (location, OMP_CLAUSE_DEFAULT); OMP_CLAUSE_CHAIN (c) = list; OMP_CLAUSE_DEFAULT_KIND (c) = kind; @@ -20582,7 +20591,7 @@ cp_parser_omp_clause_if (cp_parser *parser, tree list, location_t location) check_no_duplicate_clause (list, OMP_CLAUSE_IF, "if", location); - c = build_omp_clause (OMP_CLAUSE_IF); + c = build_omp_clause (location, OMP_CLAUSE_IF); OMP_CLAUSE_IF_EXPR (c) = t; OMP_CLAUSE_CHAIN (c) = list; @@ -20600,7 +20609,7 @@ cp_parser_omp_clause_nowait (cp_parser *parser ATTRIBUTE_UNUSED, check_no_duplicate_clause (list, OMP_CLAUSE_NOWAIT, "nowait", location); - c = build_omp_clause (OMP_CLAUSE_NOWAIT); + c = build_omp_clause (location, OMP_CLAUSE_NOWAIT); OMP_CLAUSE_CHAIN (c) = list; return c; } @@ -20628,7 +20637,7 @@ cp_parser_omp_clause_num_threads (cp_parser *parser, tree list, check_no_duplicate_clause (list, OMP_CLAUSE_NUM_THREADS, "num_threads", location); - c = build_omp_clause (OMP_CLAUSE_NUM_THREADS); + c = build_omp_clause (location, OMP_CLAUSE_NUM_THREADS); OMP_CLAUSE_NUM_THREADS_EXPR (c) = t; OMP_CLAUSE_CHAIN (c) = list; @@ -20647,7 +20656,7 @@ cp_parser_omp_clause_ordered (cp_parser *parser ATTRIBUTE_UNUSED, check_no_duplicate_clause (list, OMP_CLAUSE_ORDERED, "ordered", location); - c = build_omp_clause (OMP_CLAUSE_ORDERED); + c = build_omp_clause (location, OMP_CLAUSE_ORDERED); OMP_CLAUSE_CHAIN (c) = list; return c; } @@ -20729,7 +20738,7 @@ cp_parser_omp_clause_schedule (cp_parser *parser, tree list, location_t location if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>")) return list; - c = build_omp_clause (OMP_CLAUSE_SCHEDULE); + c = build_omp_clause (location, OMP_CLAUSE_SCHEDULE); if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)) { @@ -20817,7 +20826,7 @@ cp_parser_omp_clause_untied (cp_parser *parser ATTRIBUTE_UNUSED, check_no_duplicate_clause (list, OMP_CLAUSE_UNTIED, "untied", location); - c = build_omp_clause (OMP_CLAUSE_UNTIED); + c = build_omp_clause (location, OMP_CLAUSE_UNTIED); OMP_CLAUSE_CHAIN (c) = list; return c; } @@ -21110,7 +21119,7 @@ cp_parser_omp_critical (cp_parser *parser, cp_token *pragma_tok) cp_parser_require_pragma_eol (parser, pragma_tok); stmt = cp_parser_omp_structured_block (parser); - return c_finish_omp_critical (stmt, name); + return c_finish_omp_critical (input_location, stmt, name); } /* OpenMP 2.5: @@ -21487,7 +21496,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) { /* Add lastprivate (decl) clause to OMP_FOR_CLAUSES, change it to shared (decl) in OMP_PARALLEL_CLAUSES. */ - tree l = build_omp_clause (OMP_CLAUSE_LASTPRIVATE); + tree l = build_omp_clause (loc, OMP_CLAUSE_LASTPRIVATE); OMP_CLAUSE_DECL (l) = real_decl; OMP_CLAUSE_CHAIN (l) = clauses; CP_OMP_CLAUSE_INFO (l) = CP_OMP_CLAUSE_INFO (*c); @@ -21525,7 +21534,7 @@ cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses) } if (c == NULL) { - c = build_omp_clause (OMP_CLAUSE_PRIVATE); + c = build_omp_clause (loc, OMP_CLAUSE_PRIVATE); OMP_CLAUSE_DECL (c) = decl; c = finish_omp_clauses (c); if (c) @@ -21692,7 +21701,8 @@ static tree cp_parser_omp_master (cp_parser *parser, cp_token *pragma_tok) { cp_parser_require_pragma_eol (parser, pragma_tok); - return c_finish_omp_master (cp_parser_omp_structured_block (parser)); + return c_finish_omp_master (input_location, + cp_parser_omp_structured_block (parser)); } /* OpenMP 2.5: @@ -21702,8 +21712,9 @@ cp_parser_omp_master (cp_parser *parser, cp_token *pragma_tok) static tree cp_parser_omp_ordered (cp_parser *parser, cp_token *pragma_tok) { + location_t loc = cp_lexer_peek_token (parser->lexer)->location; cp_parser_require_pragma_eol (parser, pragma_tok); - return c_finish_omp_ordered (cp_parser_omp_structured_block (parser)); + return c_finish_omp_ordered (loc, cp_parser_omp_structured_block (parser)); } /* OpenMP 2.5: @@ -21838,6 +21849,7 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok) tree stmt, clauses, par_clause, ws_clause, block; unsigned int mask = OMP_PARALLEL_CLAUSE_MASK; unsigned int save; + location_t loc = cp_lexer_peek_token (parser->lexer)->location; if (cp_lexer_next_token_is_keyword (parser->lexer, RID_FOR)) { @@ -21873,12 +21885,12 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok) break; case PRAGMA_OMP_PARALLEL_FOR: - c_split_parallel_clauses (clauses, &par_clause, &ws_clause); + c_split_parallel_clauses (loc, clauses, &par_clause, &ws_clause); cp_parser_omp_for_loop (parser, ws_clause, &par_clause); break; case PRAGMA_OMP_PARALLEL_SECTIONS: - c_split_parallel_clauses (clauses, &par_clause, &ws_clause); + c_split_parallel_clauses (loc, clauses, &par_clause, &ws_clause); stmt = cp_parser_omp_sections_scope (parser); if (stmt) OMP_SECTIONS_CLAUSES (stmt) = ws_clause; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 91bd0d1..7fe4012 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -383,7 +383,8 @@ push_inline_template_parms_recursive (tree parmlist, int levels) It is ugly that we recreate this here; the original version built in process_template_parm is no longer available. */ - tree decl = build_decl (CONST_DECL, DECL_NAME (parm), + tree decl = build_decl (DECL_SOURCE_LOCATION (parm), + CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm)); DECL_ARTIFICIAL (decl) = 1; TREE_CONSTANT (decl) = 1; @@ -2931,7 +2932,8 @@ reduce_template_parm_level (tree index, tree type, int levels, tree args, tree orig_decl = TEMPLATE_PARM_DECL (index); tree decl, t; - decl = build_decl (TREE_CODE (orig_decl), DECL_NAME (orig_decl), type); + decl = build_decl (DECL_SOURCE_LOCATION (orig_decl), + TREE_CODE (orig_decl), DECL_NAME (orig_decl), type); TREE_CONSTANT (decl) = TREE_CONSTANT (orig_decl); TREE_READONLY (decl) = TREE_READONLY (orig_decl); DECL_ARTIFICIAL (decl) = 1; @@ -2958,10 +2960,11 @@ reduce_template_parm_level (tree index, tree type, int levels, tree args, /* Process information from new template parameter PARM and append it to the LIST being built. This new parameter is a non-type parameter iff IS_NON_TYPE is true. This new parameter is a parameter - pack iff IS_PARAMETER_PACK is true. */ + pack iff IS_PARAMETER_PACK is true. The location of PARM is in + PARM_LOC. */ tree -process_template_parm (tree list, tree parm, bool is_non_type, +process_template_parm (tree list, location_t parm_loc, tree parm, bool is_non_type, bool is_parameter_pack) { tree decl = 0; @@ -3030,7 +3033,8 @@ process_template_parm (tree list, tree parm, bool is_non_type, /* A template parameter is not modifiable. */ TREE_CONSTANT (parm) = 1; TREE_READONLY (parm) = 1; - decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm)); + decl = build_decl (parm_loc, + CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm)); TREE_CONSTANT (decl) = 1; TREE_READONLY (decl) = 1; DECL_INITIAL (parm) = DECL_INITIAL (decl) @@ -3059,7 +3063,8 @@ process_template_parm (tree list, tree parm, bool is_non_type, { t = cxx_make_type (TEMPLATE_TYPE_PARM); /* parm is either IDENTIFIER_NODE or NULL_TREE. */ - decl = build_decl (TYPE_DECL, parm, t); + decl = build_decl (parm_loc, + TYPE_DECL, parm, t); } TYPE_NAME (t) = decl; @@ -8112,7 +8117,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) TREE_CHAIN (r) = NULL_TREE; TREE_TYPE (r) = new_type; DECL_TEMPLATE_RESULT (r) - = build_decl (TYPE_DECL, DECL_NAME (decl), new_type); + = build_decl (DECL_SOURCE_LOCATION (decl), + TYPE_DECL, DECL_NAME (decl), new_type); DECL_TEMPLATE_PARMS (r) = tsubst_template_parms (DECL_TEMPLATE_PARMS (t), args, complain); @@ -10605,7 +10611,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv, } if (c == NULL) { - c = build_omp_clause (OMP_CLAUSE_PRIVATE); + c = build_omp_clause (input_location, OMP_CLAUSE_PRIVATE); OMP_CLAUSE_DECL (c) = decl; c = finish_omp_clauses (c); if (c) @@ -10890,7 +10896,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, break; case CASE_LABEL_EXPR: - finish_case_label (RECUR (CASE_LOW (t)), + finish_case_label (EXPR_LOCATION (t), + RECUR (CASE_LOW (t)), RECUR (CASE_HIGH (t))); break; @@ -17150,7 +17157,8 @@ make_auto (void) /* ??? Is it worth caching this for multiple autos at the same level? */ au = cxx_make_type (TEMPLATE_TYPE_PARM); - TYPE_NAME (au) = build_decl (TYPE_DECL, get_identifier ("auto"), au); + TYPE_NAME (au) = build_decl (BUILTINS_LOCATION, + TYPE_DECL, get_identifier ("auto"), au); TYPE_STUB_DECL (au) = TYPE_NAME (au); TEMPLATE_TYPE_PARM_INDEX (au) = build_template_parm_index (0, processing_template_decl + 1, processing_template_decl + 1, diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 9246fc2..c26caa9 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1161,7 +1161,8 @@ create_pseudo_type_info (int tk, const char *real_name, ...) sprintf (pseudo_name + strlen (pseudo_name), "%d", tk - TK_FIXED); /* First field is the pseudo type_info base class. */ - fields = build_decl (FIELD_DECL, NULL_TREE, + fields = build_decl (input_location, + FIELD_DECL, NULL_TREE, VEC_index (tinfo_s, tinfo_descs, TK_TYPE_INFO_TYPE)->type); @@ -1290,9 +1291,12 @@ get_pseudo_ti_index (tree type) push_abi_namespace (); create_pseudo_type_info (ix, "__vmi_class_type_info", - build_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_decl (FIELD_DECL, NULL_TREE, base_array), + build_decl (input_location, + FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (input_location, + FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (input_location, + FIELD_DECL, NULL_TREE, base_array), NULL); pop_abi_namespace (); break; @@ -1324,10 +1328,12 @@ create_tinfo_types (void) { tree field, fields; - field = build_decl (FIELD_DECL, NULL_TREE, const_ptr_type_node); + field = build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, const_ptr_type_node); fields = field; - field = build_decl (FIELD_DECL, NULL_TREE, const_string_type_node); + field = build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, const_string_type_node); TREE_CHAIN (field) = fields; fields = field; @@ -1353,7 +1359,8 @@ create_tinfo_types (void) /* Single public non-virtual base class. Add pointer to base class. This is really a descendant of __class_type_info. */ create_pseudo_type_info (TK_SI_CLASS_TYPE, "__si_class_type_info", - build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), + build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, type_info_ptr_type), NULL); /* Base class internal helper. Pointer to base type, offset to base, @@ -1361,10 +1368,12 @@ create_tinfo_types (void) { tree field, fields; - field = build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type); + field = build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, type_info_ptr_type); fields = field; - field = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]); + field = build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, integer_types[itk_long]); TREE_CHAIN (field) = fields; fields = field; @@ -1381,8 +1390,10 @@ create_tinfo_types (void) and pointer to the pointed to type. This is really a descendant of __pbase_type_info. */ create_pseudo_type_info (TK_POINTER_TYPE, "__pointer_type_info", - build_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), + build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, type_info_ptr_type), NULL); /* Pointer to member data type_info. Add qualifications flags, @@ -1390,9 +1401,12 @@ create_tinfo_types (void) This is really a descendant of __pbase_type_info. */ create_pseudo_type_info (TK_POINTER_MEMBER_TYPE, "__pointer_to_member_type_info", - build_decl (FIELD_DECL, NULL_TREE, integer_type_node), - build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), - build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type), + build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, integer_type_node), + build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, type_info_ptr_type), + build_decl (BUILTINS_LOCATION, + FIELD_DECL, NULL_TREE, type_info_ptr_type), NULL); pop_abi_namespace (); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index adb6023..bacb09a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -420,7 +420,7 @@ maybe_cleanup_point_expr_void (tree expr) void add_decl_expr (tree decl) { - tree r = build_stmt (DECL_EXPR, decl); + tree r = build_stmt (input_location, DECL_EXPR, decl); if (DECL_INITIAL (decl) || (DECL_SIZE (decl) && TREE_SIDE_EFFECTS (DECL_SIZE (decl)))) r = maybe_cleanup_point_expr_void (r); @@ -441,7 +441,7 @@ do_poplevel (tree stmt_list) if (!processing_template_decl) { - stmt_list = c_build_bind_expr (block, stmt_list); + stmt_list = c_build_bind_expr (input_location, block, stmt_list); /* ??? See c_end_compound_stmt re statement expressions. */ } @@ -466,7 +466,7 @@ do_pushlevel (scope_kind sk) void push_cleanup (tree decl, tree cleanup, bool eh_only) { - tree stmt = build_stmt (CLEANUP_STMT, NULL, cleanup, decl); + tree stmt = build_stmt (input_location, CLEANUP_STMT, NULL, cleanup, decl); CLEANUP_EH_ONLY (stmt) = eh_only; add_stmt (stmt); CLEANUP_BODY (stmt) = push_stmt_list (); @@ -561,7 +561,7 @@ finish_goto_stmt (tree destination) check_goto (destination); - return add_stmt (build_stmt (GOTO_EXPR, destination)); + return add_stmt (build_stmt (input_location, GOTO_EXPR, destination)); } /* COND is the condition-expression for an if, while, etc., @@ -624,7 +624,7 @@ finish_expr_stmt (tree expr) if (TREE_CODE (expr) != CLEANUP_POINT_EXPR) { if (TREE_CODE (expr) != EXPR_STMT) - expr = build_stmt (EXPR_STMT, expr); + expr = build_stmt (input_location, EXPR_STMT, expr); expr = maybe_cleanup_point_expr_void (expr); } @@ -645,7 +645,7 @@ begin_if_stmt (void) { tree r, scope; scope = do_pushlevel (sk_block); - r = build_stmt (IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE); + r = build_stmt (input_location, IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE); TREE_CHAIN (r) = scope; begin_cond (&IF_COND (r)); return r; @@ -707,7 +707,7 @@ tree begin_while_stmt (void) { tree r; - r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE); + r = build_stmt (input_location, WHILE_STMT, NULL_TREE, NULL_TREE); add_stmt (r); WHILE_BODY (r) = do_pushlevel (sk_block); begin_cond (&WHILE_COND (r)); @@ -739,7 +739,7 @@ finish_while_stmt (tree while_stmt) tree begin_do_stmt (void) { - tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE); + tree r = build_stmt (input_location, DO_STMT, NULL_TREE, NULL_TREE); add_stmt (r); DO_BODY (r) = push_stmt_list (); return r; @@ -801,7 +801,7 @@ finish_return_stmt (tree expr) } } - r = build_stmt (RETURN_EXPR, expr); + r = build_stmt (input_location, RETURN_EXPR, expr); TREE_NO_WARNING (r) |= no_warning; r = maybe_cleanup_point_expr_void (r); r = add_stmt (r); @@ -817,7 +817,7 @@ begin_for_stmt (void) { tree r; - r = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE, + r = build_stmt (input_location, FOR_STMT, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE); if (flag_new_for_scope > 0) @@ -908,7 +908,7 @@ finish_for_stmt (tree for_stmt) tree finish_break_stmt (void) { - return add_stmt (build_stmt (BREAK_STMT)); + return add_stmt (build_stmt (input_location, BREAK_STMT)); } /* Finish a continue-statement. */ @@ -916,7 +916,7 @@ finish_break_stmt (void) tree finish_continue_stmt (void) { - return add_stmt (build_stmt (CONTINUE_STMT)); + return add_stmt (build_stmt (input_location, CONTINUE_STMT)); } /* Begin a switch-statement. Returns a new SWITCH_STMT if @@ -927,7 +927,7 @@ begin_switch_stmt (void) { tree r, scope; - r = build_stmt (SWITCH_STMT, NULL_TREE, NULL_TREE, NULL_TREE); + r = build_stmt (input_location, SWITCH_STMT, NULL_TREE, NULL_TREE, NULL_TREE); scope = do_pushlevel (sk_block); TREE_CHAIN (r) = scope; @@ -997,7 +997,7 @@ finish_switch_stmt (tree switch_stmt) tree begin_try_block (void) { - tree r = build_stmt (TRY_BLOCK, NULL_TREE, NULL_TREE); + tree r = build_stmt (input_location, TRY_BLOCK, NULL_TREE, NULL_TREE); add_stmt (r); TRY_STMTS (r) = push_stmt_list (); return r; @@ -1087,7 +1087,7 @@ begin_handler (void) { tree r; - r = build_stmt (HANDLER, NULL_TREE, NULL_TREE); + r = build_stmt (input_location, HANDLER, NULL_TREE, NULL_TREE); add_stmt (r); /* Create a binding level for the eh_info and the exception object @@ -1307,7 +1307,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, } } - r = build_stmt (ASM_EXPR, string, + r = build_stmt (input_location, ASM_EXPR, string, output_operands, input_operands, clobbers); ASM_VOLATILE_P (r) = volatile_p || noutputs == 0; @@ -1325,7 +1325,7 @@ finish_label_stmt (tree name) if (decl == error_mark_node) return error_mark_node; - add_stmt (build_stmt (LABEL_EXPR, decl)); + add_stmt (build_stmt (input_location, LABEL_EXPR, decl)); return decl; } @@ -1718,7 +1718,7 @@ finish_stmt_expr_expr (tree expr, tree stmt_expr) if (processing_template_decl) { - expr = build_stmt (EXPR_STMT, expr); + expr = build_stmt (input_location, EXPR_STMT, expr); expr = add_stmt (expr); /* Mark the last statement so that we can recognize it as such at template-instantiation time. */ @@ -1990,7 +1990,7 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool disallow_virtual, if (TREE_CODE (fn) == FUNCTION_DECL && (DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL || DECL_BUILT_IN_CLASS (fn) == BUILT_IN_MD)) - result = resolve_overloaded_builtin (fn, *args); + result = resolve_overloaded_builtin (input_location, fn, *args); if (!result) /* A call to a namespace-scope function. */ @@ -2137,7 +2137,7 @@ finish_unary_op_expr (enum tree_code code, tree expr) TREE_NEGATED_INT (result) = 1; } if (TREE_OVERFLOW_P (result) && !TREE_OVERFLOW_P (expr)) - overflow_warning (result); + overflow_warning (input_location, result); return result; } @@ -2250,7 +2250,8 @@ finish_template_type_parm (tree aggr, tree identifier) tree finish_template_template_parm (tree aggr, tree identifier) { - tree decl = build_decl (TYPE_DECL, identifier, NULL_TREE); + tree decl = build_decl (input_location, + TYPE_DECL, identifier, NULL_TREE); tree tmpl = build_lang_decl (TEMPLATE_DECL, identifier, NULL_TREE); DECL_TEMPLATE_PARMS (tmpl) = current_template_parms; DECL_TEMPLATE_RESULT (tmpl) = decl; @@ -3330,7 +3331,7 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data) init = build2 (INIT_EXPR, void_type_node, dp->result, DECL_INITIAL (dp->var)); else - init = build_empty_stmt (); + init = build_empty_stmt (EXPR_LOCATION (*tp)); DECL_INITIAL (dp->var) = NULL_TREE; SET_EXPR_LOCUS (init, EXPR_LOCUS (*tp)); *tp = init; @@ -4136,7 +4137,7 @@ handle_omp_for_class_iterator (int i, location_t locus, tree declv, tree initv, TREE_CODE (cond), decl, diff, tf_warning_or_error); incr = build_modify_expr (elocus, decl, NULL_TREE, PLUS_EXPR, - incr, NULL_TREE); + elocus, incr, NULL_TREE); orig_body = *body; *body = push_stmt_list (); @@ -4427,7 +4428,7 @@ finish_omp_atomic (enum tree_code code, tree lhs, tree rhs) } if (!dependent_p) { - stmt = c_finish_omp_atomic (code, lhs, rhs); + stmt = c_finish_omp_atomic (input_location, code, lhs, rhs); if (stmt == error_mark_node) return; } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index b40ef10..7c48a32 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -302,7 +302,8 @@ build_target_expr (tree decl, tree value) static tree build_local_temp (tree type) { - tree slot = build_decl (VAR_DECL, NULL_TREE, type); + tree slot = build_decl (input_location, + VAR_DECL, NULL_TREE, type); DECL_ARTIFICIAL (slot) = 1; DECL_IGNORED_P (slot) = 1; DECL_CONTEXT (slot) = current_function_decl; @@ -1421,7 +1422,8 @@ bind_template_template_parm (tree t, tree newargs) tree t2; t2 = cxx_make_type (BOUND_TEMPLATE_TEMPLATE_PARM); - decl = build_decl (TYPE_DECL, DECL_NAME (decl), NULL_TREE); + decl = build_decl (input_location, + TYPE_DECL, DECL_NAME (decl), NULL_TREE); /* These nodes have to be created to reflect new TYPE_DECL and template arguments. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b384fea..1ad7506 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1349,7 +1349,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain) return value; } - return c_sizeof_or_alignof_type (complete_type (type), + return c_sizeof_or_alignof_type (input_location, complete_type (type), op == SIZEOF_EXPR, complain); } @@ -2573,7 +2573,7 @@ cp_build_indirect_ref (tree ptr, const char *errorstring, LOC is the location to use in building the array reference. */ tree -build_array_ref (tree array, tree idx, location_t loc) +build_array_ref (location_t loc, tree array, tree idx) { tree ret; @@ -2593,7 +2593,7 @@ build_array_ref (tree array, tree idx, location_t loc) { case COMPOUND_EXPR: { - tree value = build_array_ref (TREE_OPERAND (array, 1), idx, loc); + tree value = build_array_ref (loc, TREE_OPERAND (array, 1), idx); ret = build2 (COMPOUND_EXPR, TREE_TYPE (value), TREE_OPERAND (array, 0), value); SET_EXPR_LOCATION (ret, loc); @@ -2603,9 +2603,9 @@ build_array_ref (tree array, tree idx, location_t loc) case COND_EXPR: ret = build_conditional_expr (TREE_OPERAND (array, 0), - build_array_ref (TREE_OPERAND (array, 1), idx, loc), - build_array_ref (TREE_OPERAND (array, 2), idx, loc), - tf_warning_or_error); + build_array_ref (loc, TREE_OPERAND (array, 1), idx), + build_array_ref (loc, TREE_OPERAND (array, 2), idx), + tf_warning_or_error); protected_set_expr_location (ret, loc); return ret; @@ -2864,14 +2864,16 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) /* Used by the C-common bits. */ tree -build_function_call (tree function, tree params) +build_function_call (location_t loc ATTRIBUTE_UNUSED, + tree function, tree params) { return cp_build_function_call (function, params, tf_warning_or_error); } /* Used by the C-common bits. */ tree -build_function_call_vec (tree function, VEC(tree,gc) *params, +build_function_call_vec (location_t loc ATTRIBUTE_UNUSED, + tree function, VEC(tree,gc) *params, VEC(tree,gc) *origtypes ATTRIBUTE_UNUSED) { VEC(tree,gc) *orig_params = params; @@ -4067,7 +4069,7 @@ cp_build_binary_op (location_t location, if (TREE_OVERFLOW_P (result) && !TREE_OVERFLOW_P (op0) && !TREE_OVERFLOW_P (op1)) - overflow_warning (result); + overflow_warning (location, result); return result; } @@ -5079,7 +5081,7 @@ build_x_compound_expr (tree op1, tree op2, tsubst_flags_t complain) /* Like cp_build_compound_expr, but for the c-common bits. */ tree -build_compound_expr (tree lhs, tree rhs) +build_compound_expr (location_t loc ATTRIBUTE_UNUSED, tree lhs, tree rhs) { return cp_build_compound_expr (lhs, rhs, tf_warning_or_error); } @@ -5836,7 +5838,7 @@ build_const_cast (tree type, tree expr, tsubst_flags_t complain) /* Like cp_build_c_cast, but for the c-common bits. */ tree -build_c_cast (tree type, tree expr) +build_c_cast (location_t loc ATTRIBUTE_UNUSED, tree type, tree expr) { return cp_build_c_cast (type, expr, tf_warning_or_error); } @@ -5953,7 +5955,8 @@ cp_build_c_cast (tree type, tree expr, tsubst_flags_t complain) tree build_modify_expr (location_t location ATTRIBUTE_UNUSED, tree lhs, tree lhs_origtype ATTRIBUTE_UNUSED, - enum tree_code modifycode, tree rhs, + enum tree_code modifycode, + location_t rhs_location ATTRIBUTE_UNUSED, tree rhs, tree rhs_origtype ATTRIBUTE_UNUSED) { return cp_build_modify_expr (lhs, modifycode, rhs, tf_warning_or_error); @@ -6501,7 +6504,7 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p) /* Handle null pointer to member function conversions. */ if (integer_zerop (pfn)) { - pfn = build_c_cast (type, integer_zero_node); + pfn = build_c_cast (input_location, type, integer_zero_node); return build_ptrmemfunc1 (to_type, integer_zero_node, pfn); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index e668427..8bec221 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -516,7 +516,7 @@ split_nonconstant_init_1 (tree dest, tree init) NULL_TREE); code = build2 (INIT_EXPR, inner_type, sub, value); - code = build_stmt (EXPR_STMT, code); + code = build_stmt (input_location, EXPR_STMT, code); add_stmt (code); continue; } @@ -530,7 +530,7 @@ split_nonconstant_init_1 (tree dest, tree init) tree cons = copy_node (init); CONSTRUCTOR_ELTS (init) = NULL; code = build2 (MODIFY_EXPR, type, dest, cons); - code = build_stmt (EXPR_STMT, code); + code = build_stmt (input_location, EXPR_STMT, code); add_stmt (code); } break; |