From 505970fc3324e2a0c00f5d82d66f62bae133e282 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 1 Sep 2004 03:45:30 +0000 Subject: target-def.h (TARGET_CXX): Add TARGET_CXX_EXPORT_CLASS_DATA. * target-def.h (TARGET_CXX): Add TARGET_CXX_EXPORT_CLASS_DATA. * target.h (cxx): Add export_class_data. * config/arm/arm.c (arm_cxx_export_class_data): New function. (TARGET_CXX_EXPORT_CLASS_DATA): Use it. * testsuite/g++.dg/ext/visibility/arm1.C: New test. * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): New macro. * class.c (build_ctor_vtbl_group): Set DECL_CONSTRUCTION_VTABLE_P. * decl2.c (determine_visibility): Honor TARGET_CXX_EXPORT_CLASS_DATA. * g++.dg/ext/visibility/arm1.C: New test. From-SVN: r86867 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/class.c | 1 + gcc/cp/cp-tree.h | 7 +++++++ gcc/cp/decl2.c | 21 ++++++++++++++------- 4 files changed, 27 insertions(+), 7 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0a0fdfd..929bde0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2004-08-31 Mark Mitchell + * cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): New macro. + * class.c (build_ctor_vtbl_group): Set DECL_CONSTRUCTION_VTABLE_P. + * decl2.c (determine_visibility): Honor + TARGET_CXX_EXPORT_CLASS_DATA. + * class.c (key_method): Rename to ... (determine_key_method): ... this. (finish_struct_1): Adjust accordingly. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 84c7587..957151d 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6996,6 +6996,7 @@ build_ctor_vtbl_group (tree binfo, tree t) constructing the addresses of secondary vtables in the construction vtable group. */ vtbl = build_vtable (t, id, ptr_type_node); + DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1; list = build_tree_list (vtbl, NULL_TREE); accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)), binfo, t, list); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a6db553..35eb3a7 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -74,6 +74,7 @@ struct diagnostic_context; 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE) DECL_VTABLE_OR_VTT_P (in VAR_DECL) 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE) + DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL) Usage of TYPE_LANG_FLAG_?: 0: TYPE_DEPENDENT_P @@ -1992,6 +1993,12 @@ struct lang_decl GTY(()) /* 1 iff VAR_DECL node NODE is virtual table or VTT. */ #define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE)) +/* Returns 1 iff VAR_DECL is a construction virtual table. + DECL_VTABLE_OR_VTT_P will be true in this case and must be checked + before using this macro. */ +#define DECL_CONSTRUCTION_VTABLE_P(NODE) \ + TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE)) + /* 1 iff NODE is function-local, but for types. */ #define LOCAL_CLASS_P(NODE) \ (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE) diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d02180a..c26d48f 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1655,17 +1655,24 @@ determine_visibility (tree decl) the visibility of their containing class. */ if (class_type) { - if (TARGET_DLLIMPORT_DECL_ATTRIBUTES - && lookup_attribute ("dllexport", TYPE_ATTRIBUTES (class_type))) + if (targetm.cxx.export_class_data () + && (DECL_TINFO_P (decl) + || (DECL_VTABLE_OR_VTT_P (decl) + /* Construction virtual tables are not emitted + because they cannot be referred to from other + object files; their name is not standardized by + the ABI. */ + && !DECL_CONSTRUCTION_VTABLE_P (decl)))) + DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; + else if (TARGET_DLLIMPORT_DECL_ATTRIBUTES + && lookup_attribute ("dllexport", TYPE_ATTRIBUTES (class_type))) { DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; DECL_VISIBILITY_SPECIFIED (decl) = 1; - return; } - - if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_DECLARED_INLINE_P (decl) - && visibility_options.inlines_hidden) + else if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_DECLARED_INLINE_P (decl) + && visibility_options.inlines_hidden) { DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN; DECL_VISIBILITY_SPECIFIED (decl) = 1; -- cgit v1.1