From 1b155d83801a3a893dee9445d57f244f2a61ca40 Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 3 Mar 2010 19:01:46 +0000 Subject: PR c++/12909 * method.c (make_alias_for): Handle VAR_DECL, too. * decl2.c (vague_linkage_p): Rename from vague_linkage_fn_p. * tree.c (no_linkage_check): Adjust. * decl.c (maybe_commonize_var): Adjust. * mangle.c (mangle_decl): Adjust. * cp-tree.h: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157202 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/method.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'gcc/cp/method.c') diff --git a/gcc/cp/method.c b/gcc/cp/method.c index c25cedba178..a93ad068e52 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -207,34 +207,38 @@ finish_thunk (tree thunk) static GTY (()) int thunk_labelno; -/* Create a static alias to function. */ +/* Create a static alias to target. */ tree -make_alias_for (tree function, tree newid) +make_alias_for (tree target, tree newid) { - tree alias = build_decl (DECL_SOURCE_LOCATION (function), - FUNCTION_DECL, newid, TREE_TYPE (function)); - DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function); + tree alias = build_decl (DECL_SOURCE_LOCATION (target), + TREE_CODE (target), newid, TREE_TYPE (target)); + DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (target); cxx_dup_lang_specific_decl (alias); DECL_CONTEXT (alias) = NULL; - TREE_READONLY (alias) = TREE_READONLY (function); - TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function); + TREE_READONLY (alias) = TREE_READONLY (target); + TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target); TREE_PUBLIC (alias) = 0; DECL_INTERFACE_KNOWN (alias) = 1; DECL_NOT_REALLY_EXTERN (alias) = 1; - DECL_THIS_STATIC (alias) = 1; - DECL_SAVED_FUNCTION_DATA (alias) = NULL; - DECL_DESTRUCTOR_P (alias) = 0; - DECL_CONSTRUCTOR_P (alias) = 0; DECL_EXTERNAL (alias) = 0; DECL_ARTIFICIAL (alias) = 1; - DECL_PENDING_INLINE_P (alias) = 0; - DECL_DECLARED_INLINE_P (alias) = 0; DECL_USE_TEMPLATE (alias) = 0; DECL_TEMPLATE_INSTANTIATED (alias) = 0; DECL_TEMPLATE_INFO (alias) = NULL; - DECL_INITIAL (alias) = error_mark_node; - DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target)); + if (TREE_CODE (alias) == FUNCTION_DECL) + { + DECL_SAVED_FUNCTION_DATA (alias) = NULL; + DECL_DESTRUCTOR_P (alias) = 0; + DECL_CONSTRUCTOR_P (alias) = 0; + DECL_PENDING_INLINE_P (alias) = 0; + DECL_DECLARED_INLINE_P (alias) = 0; + DECL_INITIAL (alias) = error_mark_node; + DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target)); + } + else + TREE_STATIC (alias) = 1; TREE_ADDRESSABLE (alias) = 1; TREE_USED (alias) = 1; SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias)); -- cgit v1.2.1