tree.h (TYPE_FINAL_P, [...]): New macros.
authorJan Hubicka <jh@suse.cz>
Sun, 25 Aug 2013 09:43:34 +0000 (11:43 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 25 Aug 2013 09:43:34 +0000 (09:43 +0000)
* tree.h (TYPE_FINAL_P, DECL_FINAL_P): New macros.
(tree_decl_with_vis): Add FINAL field.

* cp-tree.h (struct lang_type_class): Free is_final bit.
(CLASSTYPE_FINAL): Define using TYPE_FINAL_P.
(DECL_FINAL_P): Remove.
* pt.c (instantiate_class_template_1): Guard that CLASSTYPE_FINAL
is called on CLASS_TYPE_P.

From-SVN: r201975

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/tree.h

index cd8b3f6a1de4d47e086a128cd81bbfddc074a0f6..d576a447350313aade7e20645c72a1450d2a3ee3 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-23  Jan Hubicka  <jh@suse.cz>
+
+       * tree.h (TYPE_FINAL_P, DECL_FINAL_P): New macros.
+       (tree_decl_with_vis): Add FINAL field.
+
 2013-08-23  Jeff Law  <law@redhat.com>
 
        * tree-ssa-pre.c (do_regular_insertion): Include the expression in
index d746f53f31319e6a24b015f1fcce34f8b3bc04a6..f7aefc787ceda6957b60f36642aa55ecf65b78ff 100644 (file)
@@ -1,3 +1,11 @@
+2013-08-23  Jan Hubicka  <jh@suse.cz>
+
+       * cp-tree.h (struct lang_type_class): Free is_final bit.
+       (CLASSTYPE_FINAL): Define using TYPE_FINAL_P.
+       (DECL_FINAL_P): Remove.
+       * pt.c (instantiate_class_template_1): Guard that CLASSTYPE_FINAL
+       is called on CLASS_TYPE_P.
+
 2013-08-25  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        * cxx-pretty-print.c (M_): Remove.
index 3c5201f38fb5d4168ad80935615b45b1222aa292..248c645eb6819589870784217576d67e5bc936c8 100644 (file)
@@ -1416,7 +1416,6 @@ struct GTY(()) lang_type_class {
   unsigned has_complex_move_ctor : 1;
   unsigned has_complex_move_assign : 1;
   unsigned has_constexpr_ctor : 1;
-  unsigned is_final : 1;
 
   /* When adding a flag here, consider whether or not it ought to
      apply to a template instance if it applies to the template.  If
@@ -1425,7 +1424,7 @@ struct GTY(()) lang_type_class {
   /* There are some bits left to fill out a 32-bit word.  Keep track
      of this by updating the size of this bitfield whenever you add or
      remove a flag.  */
-  unsigned dummy : 2;
+  unsigned dummy : 3;
 
   tree primary_base;
   vec<tree_pair_s, va_gc> *vcall_indices;
@@ -1535,7 +1534,7 @@ struct GTY((variable_size)) lang_type {
 
 /* Nonzero means that NODE (a class type) is final */
 #define CLASSTYPE_FINAL(NODE) \
-  (LANG_TYPE_CLASS_CHECK (NODE)->is_final)
+  TYPE_FINAL_P (NODE)
 
 
 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&).  */
@@ -2400,10 +2399,6 @@ struct GTY((variable_size)) lang_decl {
    an override virt-specifier */
 #define DECL_OVERRIDE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
 
-/* True (in a FUNCTION_DECL) if NODE is a function declared with
-   a final virt-specifier */
-#define DECL_FINAL_P(NODE) (TREE_LANG_FLAG_1 (NODE))
-
 /* The thunks associated with NODE, a FUNCTION_DECL.  */
 #define DECL_THUNKS(NODE) \
   (DECL_VIRTUAL_P (NODE) ? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE)
index 85224fc9a5881872bd042bedf17086c69c11fd1d..e937318d22756008a585b37e64382c3d385be62e 100644 (file)
@@ -8730,7 +8730,8 @@ instantiate_class_template_1 (tree type)
       /* Adjust visibility for template arguments.  */
       determine_visibility (TYPE_MAIN_DECL (type));
     }
-  CLASSTYPE_FINAL (type) = CLASSTYPE_FINAL (pattern);
+  if (CLASS_TYPE_P (type))
+    CLASSTYPE_FINAL (type) = CLASSTYPE_FINAL (pattern);
 
   pbinfo = TYPE_BINFO (pattern);
 
index 84bd69932d2db8ee0506a62d1876d3815967cfb3..60921281438f5f2f9deb89a78ad3c88b181fb0c4 100644 (file)
@@ -715,6 +715,9 @@ struct GTY(()) tree_base {
 
        DECL_NONLOCAL_FRAME in
           VAR_DECL
+
+       TYPE_FINAL_P in
+          RECORD_TYPE, UNION_TYPE and QUAL_UNION_TYPE
 */
 
 struct GTY(()) tree_typed {
@@ -2314,6 +2317,10 @@ enum cv_qualifier
 #define TYPE_CONTAINS_PLACEHOLDER_INTERNAL(NODE) \
   (TYPE_CHECK (NODE)->type_common.contains_placeholder_bits)
 
+/* Nonzero if RECORD_TYPE represents a final derivation of class.  */
+#define TYPE_FINAL_P(NODE) \
+  (RECORD_OR_UNION_CHECK (NODE)->base.default_def_flag)
+
 /* The debug output functions use the symtab union field to store
    information specific to the debugging format.  The different debug
    output hooks store different types in the union field.  These three
@@ -3224,7 +3231,9 @@ struct GTY(()) tree_decl_with_vis {
  unsigned init_priority_p : 1;
  /* Used by C++ only.  Might become a generic decl flag.  */
  unsigned shadowed_for_var_p : 1;
- /* 14 unused bits. */
+ /* Belong to FUNCTION_DECL exclusively.  */
+ unsigned final : 1;
+ /* 13 unused bits. */
 };
 
 extern tree decl_debug_expr_lookup (tree);
@@ -3474,6 +3483,11 @@ extern vec<tree, va_gc> **decl_debug_args_insert (tree);
 #define DECL_FUNCTION_VERSIONED(NODE)\
    (FUNCTION_DECL_CHECK (NODE)->function_decl.versioned_function)
 
+/* In FUNCTION_DECL that represent an virtual method this is set when
+   the method is final.  */
+#define DECL_FINAL_P(NODE)\
+   (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.final)
+
 /* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the
    arguments/result/saved_tree fields by front ends.   It was either inherit
    FUNCTION_DECL from non_common, or inherit non_common from FUNCTION_DECL,