summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5ae3ee4)
PR java/40867
* decl.c (java_replace_references): Set EXPR_LOCATION on all
generated expressions.
(binding_level.loc): new field.
(clear_binding_level): Initialize loc.
(set_input_location): New function.
(pushlevel): Set new binding_level.loc.
(poplevel): Set EXPR_LOCATION on the new BIND_EXPR_BODY.
(start_java_method): Set DECL_SOURCE_LOCATION of this new method.
(java_add_stmt): Set the EXPR_LOCATION on all subtrees of new_stmt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150376
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-07-31 Andrew Haley <aph@redhat.com>
+
+ PR java/40867
+ * decl.c (java_replace_references): Set EXPR_LOCATION on all
+ generated expressions.
+ (binding_level.loc): new field.
+ (clear_binding_level): Initialize loc.
+ (set_input_location): New function.
+ (pushlevel): Set new binding_level.loc.
+ (poplevel): Set EXPR_LOCATION on the new BIND_EXPR_BODY.
+ (start_java_method): Set DECL_SOURCE_LOCATION of this new method.
+ (java_add_stmt): Set the EXPR_LOCATION on all subtrees of new_stmt.
+
2009-07-17 Richard Guenther <rguenther@suse.de>
PR c/40401
2009-07-17 Richard Guenther <rguenther@suse.de>
PR c/40401
{
if (TREE_CODE (*tp) == MODIFY_EXPR)
{
{
if (TREE_CODE (*tp) == MODIFY_EXPR)
{
+ source_location loc = EXPR_LOCATION (*tp);
tree lhs = TREE_OPERAND (*tp, 0);
/* This is specific to the bytecode compiler. If a variable has
LOCAL_SLOT_P set, replace an assignment to it with an assignment
tree lhs = TREE_OPERAND (*tp, 0);
/* This is specific to the bytecode compiler. If a variable has
LOCAL_SLOT_P set, replace an assignment to it with an assignment
tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs),
TREE_OPERAND (*tp, 1));
tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs),
TREE_OPERAND (*tp, 1));
- *tp = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
- new_lhs, new_rhs);
- *tp = build1 (NOP_EXPR, TREE_TYPE (lhs), *tp);
+ tree tem = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
+ new_lhs, new_rhs);
+ *tp = build1 (NOP_EXPR, TREE_TYPE (lhs), tem);
+ SET_EXPR_LOCATION (tem, loc);
+ SET_EXPR_LOCATION (new_rhs, loc);
+ SET_EXPR_LOCATION (*tp, loc);
}
}
if (TREE_CODE (*tp) == VAR_DECL)
}
}
if (TREE_CODE (*tp) == VAR_DECL)
/* Binding depth at which this level began. Used only for debugging. */
unsigned binding_depth;
/* Binding depth at which this level began. Used only for debugging. */
unsigned binding_depth;
+
+ /* The location at which this level began. */
+ source_location loc;
};
#define NULL_BINDING_LEVEL (struct binding_level *) NULL
};
#define NULL_BINDING_LEVEL (struct binding_level *) NULL
NULL, /* stmts */
NULL, /* exception_range */
0, /* binding_depth */
NULL, /* stmts */
NULL, /* exception_range */
0, /* binding_depth */
};
tree java_global_trees[JTI_MAX];
};
tree java_global_trees[JTI_MAX];
/* Build (and pushdecl) a "promoted type" for all standard
types shorter than int. */
/* Build (and pushdecl) a "promoted type" for all standard
types shorter than int. */
*newlevel = clear_binding_level;
newlevel->level_chain = current_binding_level;
*newlevel = clear_binding_level;
newlevel->level_chain = current_binding_level;
- current_binding_level = newlevel;
+ newlevel->loc = input_location;
+ current_binding_level = newlevel;
#if defined(DEBUG_JAVA_BINDING_LEVELS)
newlevel->binding_depth = binding_depth;
indent ();
#if defined(DEBUG_JAVA_BINDING_LEVELS)
newlevel->binding_depth = binding_depth;
indent ();
if (BIND_EXPR_BODY (bind) == NULL)
BIND_EXPR_BODY (bind) = build_java_empty_stmt ();
if (BIND_EXPR_BODY (bind) == NULL)
BIND_EXPR_BODY (bind) = build_java_empty_stmt ();
+ SET_EXPR_LOCATION (bind, current_binding_level->loc);
+
current_binding_level->stmts = NULL;
}
else
current_binding_level->stmts = NULL;
}
else
type_map[i++] = NULL_TREE;
build_result_decl (fndecl);
type_map[i++] = NULL_TREE;
build_result_decl (fndecl);
+ DECL_SOURCE_LOCATION (fndecl) = input_location;
/* Push local variables. */
pushlevel (2);
/* Push local variables. */
pushlevel (2);
+/* If this node is an expr, mark its input location. Called from
+ walk_tree(). */
+
+static tree
+set_input_location (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ tree t = *tp;
+
+ if (CAN_HAVE_LOCATION_P (t))
+ {
+ if (EXPR_HAS_LOCATION(t))
+ return t; /* Don't walk any further into this expr. */
+ else
+ SET_EXPR_LOCATION (t, input_location);
+ }
+
+ return NULL_TREE; /* Continue walking this expr. */
+}
+
/* Add a statement to the statement_list currently being constructed.
If the statement_list is null, we don't create a singleton list.
This is necessary because poplevel() assumes that adding a
/* Add a statement to the statement_list currently being constructed.
If the statement_list is null, we don't create a singleton list.
This is necessary because poplevel() assumes that adding a
tree_stmt_iterator i;
if (input_filename)
tree_stmt_iterator i;
if (input_filename)
- SET_EXPR_LOCATION (new_stmt, input_location);
-
+ walk_tree (&new_stmt, set_input_location, NULL, NULL);
+
if (stmts == NULL)
return current_binding_level->stmts = new_stmt;
if (stmts == NULL)
return current_binding_level->stmts = new_stmt;