From dc5e52161fe493db7c467ab5d2bca209ee1ae883 Mon Sep 17 00:00:00 2001 From: rth Date: Wed, 25 May 2005 22:08:31 +0000 Subject: PR libgcj/21692 cp/ * cp-tree.h (make_alias_for): Declare. * decl2.c (build_java_method_aliases): New. (cp_finish_file): Call it. * method.c (make_alias_for): Split out from ... (make_alias_for_thunk): ... here. java/ * Make-lang.in (java/mangle.o): Depend on LANGHOOKS_DEF_H. * class.c (build_class_ref): Set DECL_CLASS_FIELD_P and DECL_CONTEXT; avoid pushdecl_top_level. (build_dtable_decl): Set DECL_VTABLE_P and DECL_CONTEXT. (layout_class): Don't SET_DECL_ASSEMBLER_NAME. (layout_class_method): Likewise. * decl.c (java_mark_cni_decl_local): New. (java_mark_class_local): Use it. * java-tree.h (DECL_LOCAL_CNI_METHOD_P): New. (DECL_CLASS_FIELD_P, DECL_VTABLE_P): New. (struct lang_decl_func): Add local_cni; (struct lang_decl_var): Add class_field, vtable. (java_mangle_decl): Declare. * lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New. * mangle.c: Remove dup obstack.h; include langhooks-def.h. (mangle_obstack_1): New. (java_mangle_decl): Remove obstack argument. Call mangle_class_field, mangle_vtable, and mangle_local_cni_method_decl. Fall back to lhd_set_decl_assembler_name for things that don't need mangling. (mangle_class_field): Rename from java_mangle_class_field, make static, don't call init_mangling or finish_mangling. (mangle_vtable): Similarly. (mangle_local_cni_method_decl): New. (init_mangling): Remove obstack argument. Use &mangle_obstack_1, gcc_assert, and MANGLE_RAW_STRING. (finish_mangling): Use gcc_assert, remove if 0 debugging code. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100171 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/method.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'gcc/cp/method.c') diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 9470cd5997d..37822bea78e 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -258,16 +258,10 @@ static GTY (()) int thunk_labelno; /* Create a static alias to function. */ -static tree -make_alias_for_thunk (tree function) +tree +make_alias_for (tree function, tree newid) { - tree alias; - char buf[256]; - - ASM_GENERATE_INTERNAL_LABEL (buf, "LTHUNK", thunk_labelno); - thunk_labelno++; - alias = build_decl (FUNCTION_DECL, get_identifier (buf), - TREE_TYPE (function)); + tree alias = build_decl (FUNCTION_DECL, newid, TREE_TYPE (function)); DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function); cxx_dup_lang_specific_decl (alias); DECL_CONTEXT (alias) = NULL; @@ -296,8 +290,23 @@ make_alias_for_thunk (tree function) TREE_USED (alias) = 1; SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias)); TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1; + return alias; +} + +static tree +make_alias_for_thunk (tree function) +{ + tree alias; + char buf[256]; + + ASM_GENERATE_INTERNAL_LABEL (buf, "LTHUNK", thunk_labelno); + thunk_labelno++; + + alias = make_alias_for (function, get_identifier (buf)); + if (!flag_syntax_only) assemble_alias (alias, DECL_ASSEMBLER_NAME (function)); + return alias; } -- cgit v1.2.1