Commit c172df28 by Aldy Hernandez Committed by Aldy Hernandez

utils.c (record_builtin_type): Pass location argument to build_decl.

        * gcc-interface/utils.c (record_builtin_type): Pass location
        argument to build_decl.
        (create_type_stub_decl): Same.
        (create_type_decl): Same.
        (create_var_decl_1): Same.
        (create_field_decl): Same.
        (create_param_decl): Same.
        (create_label_decl): Same.
        (build_decl): Same.
        (create_subprog_decl): Same.
        * gcc-interface/decl.c (gnat_to_gnu_entity): Same.
        * gcc-interface/trans.c (Case_Statement_to_gnu): Pass location
        argument to create_artificial_label.
        (Case_Statement_to_gnu): Same.
        (Loop_Statement_to_gnu): Same.
        (Subprogram_Body_to_gnu): Same.
        (gnat_gimplify_stmt): Same.

From-SVN: r148459
parent e1e6dc73
2009-06-13 Aldy Hernandez <aldyh@redhat.com>
* gcc-interface/utils.c (record_builtin_type): Pass location
argument to build_decl.
(create_type_stub_decl): Same.
(create_type_decl): Same.
(create_var_decl_1): Same.
(create_field_decl): Same.
(create_param_decl): Same.
(create_label_decl): Same.
(build_decl): Same.
(create_subprog_decl): Same.
* gcc-interface/decl.c (gnat_to_gnu_entity): Same.
* gcc-interface/trans.c (Case_Statement_to_gnu): Pass location
argument to create_artificial_label.
(Case_Statement_to_gnu): Same.
(Loop_Statement_to_gnu): Same.
(Subprogram_Body_to_gnu): Same.
(gnat_gimplify_stmt): Same.
2009-06-11 Richard Henderson <rth@redhat.com> 2009-06-11 Richard Henderson <rth@redhat.com>
* gcc-interface/misc.c (gnat_handle_option): Rename * gcc-interface/misc.c (gnat_handle_option): Rename
......
...@@ -574,7 +574,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -574,7 +574,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (Present (Debug_Renaming_Link (gnat_entity))) if (Present (Debug_Renaming_Link (gnat_entity)))
{ {
rtx addr; rtx addr;
gnu_decl = build_decl (VAR_DECL, gnu_entity_name, gnu_type); gnu_decl = build_decl (input_location,
VAR_DECL, gnu_entity_name, gnu_type);
/* The (MEM (CONST (0))) pattern is prescribed by STABS. */ /* The (MEM (CONST (0))) pattern is prescribed by STABS. */
if (global_bindings_p ()) if (global_bindings_p ())
addr = gen_rtx_CONST (VOIDmode, const0_rtx); addr = gen_rtx_CONST (VOIDmode, const0_rtx);
...@@ -2833,7 +2834,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2833,7 +2834,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
base type of the parent subtype. */ base type of the parent subtype. */
gnu_get_parent = build3 (COMPONENT_REF, void_type_node, gnu_get_parent = build3 (COMPONENT_REF, void_type_node,
build0 (PLACEHOLDER_EXPR, gnu_type), build0 (PLACEHOLDER_EXPR, gnu_type),
build_decl (FIELD_DECL, NULL_TREE, build_decl (input_location,
FIELD_DECL, NULL_TREE,
void_type_node), void_type_node),
NULL_TREE); NULL_TREE);
......
...@@ -1843,7 +1843,8 @@ Case_Statement_to_gnu (Node_Id gnat_node) ...@@ -1843,7 +1843,8 @@ Case_Statement_to_gnu (Node_Id gnat_node)
/* We build a SWITCH_EXPR that contains the code with interspersed /* We build a SWITCH_EXPR that contains the code with interspersed
CASE_LABEL_EXPRs for each label. */ CASE_LABEL_EXPRs for each label. */
push_stack (&gnu_switch_label_stack, NULL_TREE, create_artificial_label ()); push_stack (&gnu_switch_label_stack, NULL_TREE,
create_artificial_label (input_location));
start_stmt_group (); start_stmt_group ();
for (gnat_when = First_Non_Pragma (Alternatives (gnat_node)); for (gnat_when = First_Non_Pragma (Alternatives (gnat_node));
Present (gnat_when); Present (gnat_when);
...@@ -1908,9 +1909,10 @@ Case_Statement_to_gnu (Node_Id gnat_node) ...@@ -1908,9 +1909,10 @@ Case_Statement_to_gnu (Node_Id gnat_node)
if ((!gnu_low || TREE_CODE (gnu_low) == INTEGER_CST) if ((!gnu_low || TREE_CODE (gnu_low) == INTEGER_CST)
&& (!gnu_high || TREE_CODE (gnu_high) == INTEGER_CST)) && (!gnu_high || TREE_CODE (gnu_high) == INTEGER_CST))
{ {
add_stmt_with_node (build3 (CASE_LABEL_EXPR, void_type_node, add_stmt_with_node (build3
gnu_low, gnu_high, (CASE_LABEL_EXPR, void_type_node,
create_artificial_label ()), gnu_low, gnu_high,
create_artificial_label (input_location)),
gnat_choice); gnat_choice);
choices_added++; choices_added++;
} }
...@@ -1953,7 +1955,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node) ...@@ -1953,7 +1955,7 @@ Loop_Statement_to_gnu (Node_Id gnat_node)
TREE_TYPE (gnu_loop_stmt) = void_type_node; TREE_TYPE (gnu_loop_stmt) = void_type_node;
TREE_SIDE_EFFECTS (gnu_loop_stmt) = 1; TREE_SIDE_EFFECTS (gnu_loop_stmt) = 1;
LOOP_STMT_LABEL (gnu_loop_stmt) = create_artificial_label (); LOOP_STMT_LABEL (gnu_loop_stmt) = create_artificial_label (input_location);
set_expr_location_from_node (gnu_loop_stmt, gnat_node); set_expr_location_from_node (gnu_loop_stmt, gnat_node);
Sloc_to_locus (Sloc (End_Label (gnat_node)), Sloc_to_locus (Sloc (End_Label (gnat_node)),
&DECL_SOURCE_LOCATION (LOOP_STMT_LABEL (gnu_loop_stmt))); &DECL_SOURCE_LOCATION (LOOP_STMT_LABEL (gnu_loop_stmt)));
...@@ -2213,7 +2215,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) ...@@ -2213,7 +2215,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
properly copies them out. We do this by making a new block and converting properly copies them out. We do this by making a new block and converting
any inner return into a goto to a label at the end of the block. */ any inner return into a goto to a label at the end of the block. */
push_stack (&gnu_return_label_stack, NULL_TREE, push_stack (&gnu_return_label_stack, NULL_TREE,
gnu_cico_list ? create_artificial_label () : NULL_TREE); gnu_cico_list ? create_artificial_label (input_location)
: NULL_TREE);
/* Get a tree corresponding to the code for the subprogram. */ /* Get a tree corresponding to the code for the subprogram. */
start_stmt_group (); start_stmt_group ();
...@@ -5875,7 +5878,7 @@ gnat_gimplify_stmt (tree *stmt_p) ...@@ -5875,7 +5878,7 @@ gnat_gimplify_stmt (tree *stmt_p)
case LOOP_STMT: case LOOP_STMT:
{ {
tree gnu_start_label = create_artificial_label (); tree gnu_start_label = create_artificial_label (input_location);
tree gnu_end_label = LOOP_STMT_LABEL (stmt); tree gnu_end_label = LOOP_STMT_LABEL (stmt);
tree t; tree t;
......
...@@ -547,7 +547,8 @@ gnat_init_decl_processing (void) ...@@ -547,7 +547,8 @@ gnat_init_decl_processing (void)
void void
record_builtin_type (const char *name, tree type) record_builtin_type (const char *name, tree type)
{ {
tree type_decl = build_decl (TYPE_DECL, get_identifier (name), type); tree type_decl = build_decl (input_location,
TYPE_DECL, get_identifier (name), type);
gnat_pushdecl (type_decl, Empty); gnat_pushdecl (type_decl, Empty);
...@@ -1244,7 +1245,8 @@ create_type_stub_decl (tree type_name, tree type) ...@@ -1244,7 +1245,8 @@ create_type_stub_decl (tree type_name, tree type)
/* Using a named TYPE_DECL ensures that a type name marker is emitted in /* Using a named TYPE_DECL ensures that a type name marker is emitted in
STABS while setting DECL_ARTIFICIAL ensures that no DW_TAG_typedef is STABS while setting DECL_ARTIFICIAL ensures that no DW_TAG_typedef is
emitted in DWARF. */ emitted in DWARF. */
tree type_decl = build_decl (TYPE_DECL, type_name, type); tree type_decl = build_decl (input_location,
TYPE_DECL, type_name, type);
DECL_ARTIFICIAL (type_decl) = 1; DECL_ARTIFICIAL (type_decl) = 1;
return type_decl; return type_decl;
} }
...@@ -1274,7 +1276,8 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list, ...@@ -1274,7 +1276,8 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list,
DECL_NAME (type_decl) = type_name; DECL_NAME (type_decl) = type_name;
} }
else else
type_decl = build_decl (TYPE_DECL, type_name, type); type_decl = build_decl (input_location,
TYPE_DECL, type_name, type);
DECL_ARTIFICIAL (type_decl) = artificial_p; DECL_ARTIFICIAL (type_decl) = artificial_p;
gnat_pushdecl (type_decl, gnat_node); gnat_pushdecl (type_decl, gnat_node);
...@@ -1352,7 +1355,8 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, ...@@ -1352,7 +1355,8 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
/* The actual DECL node. CONST_DECL was initially intended for enumerals /* The actual DECL node. CONST_DECL was initially intended for enumerals
and may be used for scalars in general but not for aggregates. */ and may be used for scalars in general but not for aggregates. */
tree var_decl tree var_decl
= build_decl ((constant_p && const_decl_allowed_p = build_decl (input_location,
(constant_p && const_decl_allowed_p
&& !AGGREGATE_TYPE_P (type)) ? CONST_DECL : VAR_DECL, && !AGGREGATE_TYPE_P (type)) ? CONST_DECL : VAR_DECL,
var_name, type); var_name, type);
...@@ -1465,7 +1469,8 @@ tree ...@@ -1465,7 +1469,8 @@ tree
create_field_decl (tree field_name, tree field_type, tree record_type, create_field_decl (tree field_name, tree field_type, tree record_type,
int packed, tree size, tree pos, int addressable) int packed, tree size, tree pos, int addressable)
{ {
tree field_decl = build_decl (FIELD_DECL, field_name, field_type); tree field_decl = build_decl (input_location,
FIELD_DECL, field_name, field_type);
DECL_CONTEXT (field_decl) = record_type; DECL_CONTEXT (field_decl) = record_type;
TREE_READONLY (field_decl) = TYPE_READONLY (field_type); TREE_READONLY (field_decl) = TYPE_READONLY (field_type);
...@@ -1606,7 +1611,8 @@ create_field_decl (tree field_name, tree field_type, tree record_type, ...@@ -1606,7 +1611,8 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
tree tree
create_param_decl (tree param_name, tree param_type, bool readonly) create_param_decl (tree param_name, tree param_type, bool readonly)
{ {
tree param_decl = build_decl (PARM_DECL, param_name, param_type); tree param_decl = build_decl (input_location,
PARM_DECL, param_name, param_type);
/* Honor TARGET_PROMOTE_PROTOTYPES like the C compiler, as not doing so /* Honor TARGET_PROMOTE_PROTOTYPES like the C compiler, as not doing so
can lead to various ABI violations. */ can lead to various ABI violations. */
...@@ -1786,7 +1792,8 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) ...@@ -1786,7 +1792,8 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset)
tree tree
create_label_decl (tree label_name) create_label_decl (tree label_name)
{ {
tree label_decl = build_decl (LABEL_DECL, label_name, void_type_node); tree label_decl = build_decl (input_location,
LABEL_DECL, label_name, void_type_node);
DECL_CONTEXT (label_decl) = current_function_decl; DECL_CONTEXT (label_decl) = current_function_decl;
DECL_MODE (label_decl) = VOIDmode; DECL_MODE (label_decl) = VOIDmode;
...@@ -1810,7 +1817,8 @@ create_subprog_decl (tree subprog_name, tree asm_name, ...@@ -1810,7 +1817,8 @@ create_subprog_decl (tree subprog_name, tree asm_name,
struct attrib *attr_list, Node_Id gnat_node) struct attrib *attr_list, Node_Id gnat_node)
{ {
tree return_type = TREE_TYPE (subprog_type); tree return_type = TREE_TYPE (subprog_type);
tree subprog_decl = build_decl (FUNCTION_DECL, subprog_name, subprog_type); tree subprog_decl = build_decl (input_location,
FUNCTION_DECL, subprog_name, subprog_type);
/* If this is a non-inline function nested inside an inlined external /* If this is a non-inline function nested inside an inlined external
function, we cannot honor both requests without cloning the nested function, we cannot honor both requests without cloning the nested
...@@ -1831,7 +1839,8 @@ create_subprog_decl (tree subprog_name, tree asm_name, ...@@ -1831,7 +1839,8 @@ create_subprog_decl (tree subprog_name, tree asm_name,
TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type); TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type);
DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag; DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag;
DECL_ARGUMENTS (subprog_decl) = param_decl_list; DECL_ARGUMENTS (subprog_decl) = param_decl_list;
DECL_RESULT (subprog_decl) = build_decl (RESULT_DECL, 0, return_type); DECL_RESULT (subprog_decl) = build_decl (input_location,
RESULT_DECL, 0, return_type);
DECL_ARTIFICIAL (DECL_RESULT (subprog_decl)) = 1; DECL_ARTIFICIAL (DECL_RESULT (subprog_decl)) = 1;
DECL_IGNORED_P (DECL_RESULT (subprog_decl)) = 1; DECL_IGNORED_P (DECL_RESULT (subprog_decl)) = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment