aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2004-09-30 16:23:52 -0700
committerPer Bothner <bothner@gcc.gnu.org>2004-09-30 16:23:52 -0700
commit6744f40032f27c47186a71c87342efbb07663f5b (patch)
tree79f94a67e76920084496be1c8982996a4fea29d5 /gcc/java/expr.c
parentde1041046f5bbd7ec8156777b3977d87113ef1db (diff)
downloadgcc-6744f40032f27c47186a71c87342efbb07663f5b.zip
gcc-6744f40032f27c47186a71c87342efbb07663f5b.tar.gz
gcc-6744f40032f27c47186a71c87342efbb07663f5b.tar.bz2
More cleanup for --enable-mapped-location.
* class.c (push_class): If USE_MAPPED_LOCATION don't set input_location here. Instead do it in give_name_to_class. (build_class_ref): Set DECL_ARTIFICIAL, for the sake of dwarf2out. * expr.c (expand_byte_code): Call linemap_line_start. * expr.c (build_expr_wfl): If USE_MAPPED_LOCATION, change final parameters to a source_location. Don't need EXPR_WFL_FILENAME_NODE. (expr_add_location): New function, if USE_MAPPED_LOCATION. * class.c (maybe_layout_super_class): Adjust build_expr_wfl call to USE_MAPPED_LOCATION case. From-SVN: r88365
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c63
1 files changed, 58 insertions, 5 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 7cfc874..3d878b5 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -2695,7 +2695,12 @@ expand_byte_code (JCF *jcf, tree method)
linenumber_pointer += 4;
if (pc == PC)
{
- input_location.line = GET_u2 (linenumber_pointer - 2);
+ int line = GET_u2 (linenumber_pointer - 2);
+#ifdef USE_MAPPED_LOCATION
+ input_location = linemap_line_start (&line_table, line, 1);
+#else
+ input_location.line = line;
+#endif
if (!(instruction_bits[PC] & BCODE_HAS_MULTI_LINENUMBERS))
break;
}
@@ -3225,21 +3230,33 @@ force_evaluation_order (tree node)
recursively more than one file (Java is one of them). */
tree
-build_expr_wfl (tree node, const char *file, int line, int col)
+build_expr_wfl (tree node,
+#ifdef USE_MAPPED_LOCATION
+ source_location location
+#else
+ const char *file, int line, int col
+#endif
+)
{
+ tree wfl;
+#ifdef USE_MAPPED_LOCATION
+ wfl = make_node (EXPR_WITH_FILE_LOCATION);
+ SET_EXPR_LOCATION (wfl, location);
+#else
+ wfl = make_node (EXPR_WITH_FILE_LOCATION);
+
static const char *last_file = 0;
static tree last_filenode = NULL_TREE;
- tree wfl = make_node (EXPR_WITH_FILE_LOCATION);
- EXPR_WFL_NODE (wfl) = node;
EXPR_WFL_SET_LINECOL (wfl, line, col);
if (file != last_file)
{
last_file = file;
last_filenode = file ? get_identifier (file) : NULL_TREE;
}
-
EXPR_WFL_FILENAME_NODE (wfl) = last_filenode;
+#endif
+ EXPR_WFL_NODE (wfl) = node;
if (node)
{
if (IS_NON_TYPE_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (node))))
@@ -3250,6 +3267,42 @@ build_expr_wfl (tree node, const char *file, int line, int col)
return wfl;
}
+#ifdef USE_MAPPED_LOCATION
+tree
+expr_add_location (tree node, source_location location, bool statement)
+{
+ tree wfl;
+#if 0
+ /* FIXME. This optimization causes failures in code that expects an
+ EXPR_WITH_FILE_LOCATION. E.g. in resolve_qualified_expression_name. */
+ if (node && ! (statement && flag_emit_class_files))
+ {
+ source_location node_loc = EXPR_LOCATION (node);
+ if (node_loc == location || location == UNKNOWN_LOCATION)
+ return node;
+ if (node_loc == UNKNOWN_LOCATION
+ && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (node))))
+ {
+ SET_EXPR_LOCATION (node, location);
+ return node;
+ }
+ }
+#endif
+ wfl = make_node (EXPR_WITH_FILE_LOCATION);
+ SET_EXPR_LOCATION (wfl, location);
+ EXPR_WFL_NODE (wfl) = node;
+ if (statement && debug_info_level != DINFO_LEVEL_NONE)
+ EXPR_WFL_EMIT_LINE_NOTE (wfl) = 1;
+ if (node)
+ {
+ if (IS_NON_TYPE_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (node))))
+ TREE_SIDE_EFFECTS (wfl) = TREE_SIDE_EFFECTS (node);
+ TREE_TYPE (wfl) = TREE_TYPE (node);
+ }
+
+ return wfl;
+}
+#endif
/* Build a node to represent empty statements and blocks. */