aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/class.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-05-25 18:19:11 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-05-25 18:19:11 +0200
commit6bb0a66a9932e8f03e43edb007cb407ac45dbcbd (patch)
treec5d52ec0a97fd0f5d2874395be7e0a89136c2a9a /gcc/java/class.c
parent9602a7a9c8f9ab271f4672a080c17c8b21d0dc14 (diff)
downloadgcc-6bb0a66a9932e8f03e43edb007cb407ac45dbcbd.zip
gcc-6bb0a66a9932e8f03e43edb007cb407ac45dbcbd.tar.gz
gcc-6bb0a66a9932e8f03e43edb007cb407ac45dbcbd.tar.bz2
re PR debug/43260 (Java static class members lack DWARF location info)
PR debug/43260 * java-tree.h (pending_static_fields): New extern declaration. (java_write_globals): New prototype. * lang.c (LANG_HOOKS_WRITE_GLOBALS): Define. * decl.c (java_mark_class_local): When clearing DECL_EXTERNAL of a static field push it into pending_static_fields vector. * class.c (pending_static_fields): New variable. (add_field): If static field is not DECL_EXTERNAL, push it into pending_static_fields vector. (java_write_globals): New function. From-SVN: r159828
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r--gcc/java/class.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 83759a5..919d698 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1,6 +1,6 @@
/* Functions related to building classes and their related objects.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -109,6 +109,10 @@ static GTY(()) VEC(tree,gc) *registered_class;
currently being compiled. */
static GTY(()) tree this_classdollar;
+/* A list of static class fields. This is to emit proper debug
+ info for them. */
+VEC(tree,gc) *pending_static_fields;
+
/* Return the node that most closely represents the class whose name
is IDENT. Start the search from NODE (followed by its siblings).
Return NULL if an appropriate node does not exist. */
@@ -873,6 +877,8 @@ add_field (tree klass, tree name, tree field_type, int flags)
/* Considered external unless we are compiling it into this
object file. */
DECL_EXTERNAL (field) = (is_compiled_class (klass) != 2);
+ if (!DECL_EXTERNAL (field))
+ VEC_safe_push (tree, gc, pending_static_fields, field);
}
return field;
@@ -3224,4 +3230,17 @@ in_same_package (tree name1, tree name2)
return (pkg1 == pkg2);
}
+/* lang_hooks.decls.final_write_globals: perform final processing on
+ global variables. */
+
+void
+java_write_globals (void)
+{
+ tree *vec = VEC_address (tree, pending_static_fields);
+ int len = VEC_length (tree, pending_static_fields);
+ write_global_declarations ();
+ emit_debug_global_declarations (vec, len);
+ VEC_free (tree, gc, pending_static_fields);
+}
+
#include "gt-java-class.h"