diff mbox series

[C++] Reserve a decl_lang bit

Message ID 89c07380-5f84-e324-8f5b-e580f921bbbb@acm.org
State New
Headers show
Series [C++] Reserve a decl_lang bit | expand

Commit Message

Nathan Sidwell Sept. 6, 2019, 11:21 a.m. UTC
This patch
1) deletes DECL_CONSTRUCTION_VTABLE_P.  It is checked in exactly one 
place, but that place is unreachable.  When we set D_C_V_P, we also set 
the visibility to internal.  When we check it, we've already bailed out 
if the visibility was set.

2) Move  DECL_NON_TRIVIALLY_INITIALIZED_P to the now unused bit 6 for 
VAR_DECLS.

3) Reserves the now vacant bit 3 for DECL_* nodes, for use with C++ 
modules.  Hands off!

I am not merging modules at this point, but preparing the ground.  part 
#1 of this patch is good in its own right and #2 is neutral.  I expect 
to begin merging proper later this year, and that'll of course involve 
other maintainers' reviews.

nathan

Comments

Jason Merrill Sept. 6, 2019, 3:29 p.m. UTC | #1
On Fri, Sep 6, 2019 at 7:21 AM Nathan Sidwell <nathan@acm.org> wrote:
> I expect to begin merging proper later this year

Yay!

Jason
diff mbox series

Patch

2019-09-06  Nathan Sidwell  <nathan@acm.org>

	Reserve TREE_LANG_FLAG_3 for modules.
	gcc/cp/
	* cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
	(DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
	* class.c (build_ctor_vtbl_group): Don't set
	DECL_CONSTRUCTION_VTABLE_P.
	* decl2.c (determine_visibility_from_class): Don't check
	DECL_CONSTRUCTION_VTABLE_P anymore.

Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c	(revision 275454)
+++ gcc/cp/class.c	(working copy)
@@ -9176,5 +9176,5 @@  build_ctor_vtbl_group (tree binfo, tree
      construction vtable group.  */
   vtbl = build_vtable (t, id, ptr_type_node);
-  DECL_CONSTRUCTION_VTABLE_P (vtbl) = 1;
+
   /* Don't export construction vtables from shared libraries.  Even on
      targets that don't support hidden visibility, this tells
Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 275454)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -449,5 +449,4 @@  extern GTY(()) tree cp_global_trees[CPTI
       FN_TRY_BLOCK_P (in TRY_BLOCK)
       BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
-      DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL)
       CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
       DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE)
@@ -455,4 +454,5 @@  extern GTY(()) tree cp_global_trees[CPTI
       OVL_NESTED_P (in OVERLOAD)
       LAMBDA_EXPR_INSTANTIATED (in LAMBDA_EXPR)
+      Reserved for DECL_MODULE_EXPORT (in DECL_)
    4: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
       TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
@@ -467,6 +467,6 @@  extern GTY(()) tree cp_global_trees[CPTI
       CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR)
    6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE)
-      DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL)
       TYPE_MARKED_P (in _TYPE)
+      DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL)
       RANGE_FOR_IVDEP (in RANGE_FOR_STMT)
       CALL_EXPR_OPERATOR_SYNTAX (in CALL_EXPR, AGGR_INIT_EXPR)
@@ -3002,5 +3002,5 @@  struct GTY(()) lang_decl {
    or a non-trivial constructor is called.  */
 #define DECL_NONTRIVIALLY_INITIALIZED_P(NODE)	\
-   (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE)))
+   (TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE)))
 
 /* Nonzero for a VAR_DECL that was initialized with a
@@ -3271,10 +3271,4 @@  struct GTY(()) lang_decl {
   TREE_LANG_FLAG_5 (FUNC_OR_METHOD_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)				\
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c	(revision 275454)
+++ gcc/cp/decl2.c	(working copy)
@@ -2714,11 +2714,6 @@  determine_visibility_from_class (tree de
      with DECL.  */
   if (VAR_P (decl)
-      && (DECL_TINFO_P (decl)
-	  || (DECL_VTABLE_OR_VTT_P (decl)
-	      /* Construction virtual tables are not exported because
-		 they cannot be referred to from other object files;
-		 their name is not standardized by the ABI.  */
-	      && !DECL_CONSTRUCTION_VTABLE_P (decl)))
       && TREE_PUBLIC (decl)
+      && (DECL_TINFO_P (decl) || DECL_VTABLE_OR_VTT_P (decl))
       && !DECL_REALLY_EXTERN (decl)
       && !CLASSTYPE_VISIBILITY_SPECIFIED (class_type))