diff mbox series

[C++] vtable decl marking

Message ID 98bee8cf-3a06-2db8-8bb7-0e4f75869398@acm.org
State New
Headers show
Series [C++] vtable decl marking | expand

Commit Message

Nathan Sidwell Aug. 30, 2019, 11:16 a.m. UTC
I noticed that DECL_VTABLE_OR_VTT_P and DECL_VIRTUAL_P have the same 
semantics for VAR_DECLs.  We set them both at the same time, and the C++ 
FE tests the former, but (I presume) the optimizers test the latter.

It doesn't seem to matter that we set DECL_VIRTUAL_P for the VTT.

The attached patch survives bootstraping, so I'll install it next week, 
if there's no objections.

nathan
diff mbox series

Patch

2019-08-30  Nathan Sidwell  <nathan@acm.org>

	* cp-tree.h (DECL_VTABLE_OR_VTT_P): Forward to DECL_VIRTUAL_P.

Index: gcc/cp/cp-tree.h
===================================================================
--- gcc/cp/cp-tree.h	(revision 275032)
+++ gcc/cp/cp-tree.h	(working copy)
@@ -463,5 +463,4 @@  extern GTY(()) tree cp_global_trees[CPTI
       LOOKUP_FOUND_P (in RECORD_TYPE, UNION_TYPE, NAMESPACE_DECL)
    5: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
-      DECL_VTABLE_OR_VTT_P (in VAR_DECL)
       FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
       CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
@@ -3255,6 +3254,8 @@  struct GTY(()) lang_decl {
 #define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
 
-/* 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))
+/* 1 iff VAR_DECL node NODE is virtual table or VTT.  We forward to
+   DECL_VIRTUAL_P from the common code, as that has the semantics we
+   need.  But we want a more descriptive name.  */
+#define DECL_VTABLE_OR_VTT_P(NODE) DECL_VIRTUAL_P (VAR_DECL_CHECK (NODE))
 
 /* 1 iff FUNCTION_TYPE or METHOD_TYPE has a ref-qualifier (either & or &&). */