OSDN Git Service

* call.c (tourney, build_field_call, equal_functions, joust)
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-tree.h
index 97b7177..121aaba 100644 (file)
@@ -20,14 +20,14 @@ along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+#ifndef GCC_CP_TREE_H
+#define GCC_CP_TREE_H
+
 #include "function.h"
 #include "hashtab.h"
 #include "splay-tree.h"
 #include "varray.h"
 
-#ifndef GCC_CP_TREE_H
-#define GCC_CP_TREE_H
-
 #ifndef __GNUC__
 #error "You should be using 'make bootstrap' -- see installation instructions"
 #endif
@@ -47,7 +47,6 @@ struct diagnostic_context;
       ICS_USER_FLAG (in _CONV)
       CLEANUP_P (in TRY_BLOCK)
       AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
-      BV_USE_VCALL_INDEX_P (in the BINFO_VIRTUALS TREE_LIST)
       PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
       PARMLIST_ELLIPSIS_P (in PARMLIST)
    1: IDENTIFIER_VIRTUAL_P.
@@ -101,6 +100,7 @@ struct diagnostic_context;
       DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
    3: DECL_IN_AGGR_P.
    4: DECL_C_BIT_FIELD (in a FIELD_DECL)
+      DECL_MAYBE_TEMPLATE (in a FUNCTION_DECL)
    5: DECL_INTERFACE_KNOWN.
    6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
    7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
@@ -121,16 +121,18 @@ struct diagnostic_context;
      For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
 
   BINFO_VIRTUALS
-     For a binfo, this is a TREE_LIST.  The BV_DELTA of each node
-     gives the amount by which to adjust the `this' pointer when
-     calling the function.  If the method is an overriden version of a
-     base class method, then it is assumed that, prior to adjustment,
-     the this pointer points to an object of the base class.
+     For a binfo, this is a TREE_LIST.  There is an entry for each
+     virtual function declared either in BINFO or its direct and
+     indirect primary bases.
+
+     The BV_DELTA of each node gives the amount by which to adjust the
+     `this' pointer when calling the function.  If the method is an
+     overridden version of a base class method, then it is assumed
+     that, prior to adjustment, the this pointer points to an object
+     of the base class.
 
      The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
-     index of the vcall offset for this entry.  If
-     BV_USE_VCALL_INDEX_P then the corresponding vtable entry should
-     use a virtual thunk, as opposed to an ordinary thunk.
+     index of the vcall offset for this entry.  
 
      The BV_FN is the declaration for the virtual function itself.
 
@@ -147,7 +149,7 @@ struct diagnostic_context;
      function, it is eventually set to an INTEGER_CST indicating the
      index in the vtable at which this function can be found.  When
      a virtual function is declared, but before it is known what
-     function is overriden, this field is the error_mark_node.
+     function is overridden, this field is the error_mark_node.
 
      Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
      the virtual function this one overrides, and whose TREE_CHAIN is
@@ -397,13 +399,15 @@ struct tree_wrapper GTY(())
   struct z_candidate *z_c;
 };
 
-#define SRCLOC_FILE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->filename)
-#define SRCLOC_LINE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->linenum)
+#define SOURCE_LOCUS(NODE) \
+   (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->locus)
+#define SRCLOC_FILE(NODE) SOURCE_LOCUS (NODE).file
+#define SRCLOC_LINE(NODE) SOURCE_LOCUS (NODE).line
+
 struct tree_srcloc GTY(())
 {
   struct tree_common common;
-  const char *filename;
-  int linenum;
+  location_t locus;
 };
 
 /* Macros for access to language-specific slots in an identifier.  */
@@ -610,6 +614,8 @@ enum cp_tree_index
     CPTI_DSO_HANDLE,
     CPTI_DCAST,
 
+    CPTI_DYNAMIC_CLASSES,
+
     CPTI_MAX
 };
 
@@ -740,6 +746,10 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
    destructors.  */
 #define vtt_parm_type                   cp_global_trees[CPTI_VTT_PARM_TYPE]
 
+/* A TREE_LIST of all of the dynamic classes in the program.  */
+
+#define dynamic_classes                 cp_global_trees[CPTI_DYNAMIC_CLASSES]
+
 /* Global state.  */
 
 struct saved_scope GTY(())
@@ -993,9 +1003,6 @@ enum languages { lang_c, lang_cplusplus, lang_java };
   (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && IS_AGGR_TYPE (T))
 
 #define IS_AGGR_TYPE_CODE(T)   ((T) == RECORD_TYPE || (T) == UNION_TYPE)
-#define IS_AGGR_TYPE_2(TYPE1, TYPE2) \
-  (TREE_CODE (TYPE1) == TREE_CODE (TYPE2)      \
-   && IS_AGGR_TYPE (TYPE1) && IS_AGGR_TYPE (TYPE2))
 #define TAGGED_TYPE_P(T) \
   (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
 #define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
@@ -1109,7 +1116,6 @@ struct lang_type_class GTY(())
   unsigned has_arrow_overloaded : 1;
   unsigned interface_only : 1;
   unsigned interface_unknown : 1;
-  unsigned needs_virtual_reinit : 1;
 
   unsigned marks: 6;
   unsigned vec_new_uses_cookie : 1;
@@ -1134,6 +1140,8 @@ struct lang_type_class GTY(())
 
   unsigned anon_aggr : 1;
   unsigned non_zero_init : 1;
+  unsigned empty_p : 1;
+  unsigned contains_empty_class_p : 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
@@ -1142,19 +1150,20 @@ struct lang_type_class GTY(())
   /* 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 : 6;
-
-  int vsize;
+  unsigned dummy : 5;
 
   tree primary_base;
   tree vfields;
+  tree vcall_indices;
+  tree vtables;
+  tree typeinfo_var;
   tree vbases;
   tree tags;
   tree as_base;
   tree pure_virtuals;
   tree friend_classes;
-  tree rtti;
   tree methods;
+  tree decl_list;
   tree template_info;
   tree befriending_classes;
 };
@@ -1251,9 +1260,6 @@ struct lang_type GTY(())
    convenient, don't reprocess any methods that appear in its redefinition.  */
 #define TYPE_REDEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->redefined)
 
-/* The is the basetype that contains NODE's rtti.  */
-#define CLASSTYPE_RTTI(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->rtti)
-
 /* Nonzero means that this _CLASSTYPE node overloads operator().  */
 #define TYPE_OVERLOADS_CALL_EXPR(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->has_call_overloaded)
@@ -1291,6 +1297,12 @@ struct lang_type GTY(())
    functions are sorted, once the class is complete.  */
 #define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
 
+/* For class templates, this is a TREE_LIST of all member data,
+   functions, types, and friends in the order of declaration.
+   The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend,
+   and the RECORD_TYPE for the class template otherwise.  */
+#define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list)
+
 /* The slot in the CLASSTYPE_METHOD_VEC where constructors go.  */
 #define CLASSTYPE_CONSTRUCTOR_SLOT 0
 
@@ -1369,10 +1381,6 @@ struct lang_type GTY(())
 #define CLASSTYPE_PRIMARY_BINFO(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
 
-/* The number of virtual functions present in this class' virtual
-   function table.  */
-#define CLASSTYPE_VSIZE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vsize)
-
 /* A chain of BINFOs for the direct and indirect virtual base classes
    that this type uses in a post-order depth-first left-to-right
    order.  (In other words, these bases appear in the order that they
@@ -1423,13 +1431,6 @@ struct lang_type GTY(())
 /* Nonzero means that this aggr type has been `closed' by a semicolon.  */
 #define CLASSTYPE_GOT_SEMICOLON(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->got_semicolon)
 
-/* Nonzero means that the main virtual function table pointer needs to be
-   set because base constructors have placed the wrong value there.
-   If this is zero, it means that they placed the right value there,
-   and there is no need to change it.  */
-#define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) \
-  (LANG_TYPE_CLASS_CHECK (NODE)->needs_virtual_reinit)
-
 /* Nonzero means that this type has an X() constructor.  */
 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
@@ -1447,11 +1448,19 @@ struct lang_type GTY(())
 #define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
 
+/* Nonzero if this class is "empty" in the sense of the C++ ABI.  */
+#define CLASSTYPE_EMPTY_P(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
+
 /* Nonzero if this class is "nearly empty", i.e., contains only a
    virtual function table pointer.  */
 #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
 
+/* Nonzero if this class contains an empty subobject.  */
+#define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p)
+
 /* A list of class types of which this type is a friend.  The
    TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
    case of a template friend.  */
@@ -1466,13 +1475,21 @@ struct lang_type GTY(())
 #define CLASSTYPE_DECLARED_CLASS(NODE) \
   (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
 
-/* Nonzero if this class has const members which have no specified initialization.  */
-#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
-  (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init)
-
-/* Nonzero if this class has ref members which have no specified initialization.  */
-#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
-  (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init)
+/* Nonzero if this class has const members
+   which have no specified initialization.  */
+#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE)      \
+  (TYPE_LANG_SPECIFIC (NODE)                           \
+   ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
+#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
+
+/* Nonzero if this class has ref members
+   which have no specified initialization.  */
+#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE)           \
+  (TYPE_LANG_SPECIFIC (NODE)                           \
+   ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
+#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
 
 /* Nonzero if this class is included from a header file which employs
    `#pragma interface', and it is not included in its implementation file.  */
@@ -1605,6 +1622,25 @@ struct lang_type GTY(())
 /* Used by various search routines.  */
 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
 \f
+/* A TREE_LIST of the vcall indices associated with the class NODE.
+   The TREE_PURPOSE of each node is a FUNCTION_DECL for a virtual
+   function.  The TREE_VALUE is the index into the virtual table where
+   the vcall offset for that function is stored, when NODE is a
+   virtual base.  */
+#define CLASSTYPE_VCALL_INDICES(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
+
+/* The various vtables for the class NODE.  The primary vtable will be
+   first, followed by the construction vtables and VTT, if any.  */
+#define CLASSTYPE_VTABLES(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->vtables)
+
+/* The std::type_info variable representing this class, or NULL if no
+   such variable has been created.  This field is only set for the
+   TYPE_MAIN_VARIANT of the class.  */
+#define CLASSTYPE_TYPEINFO_VAR(NODE) \
+  (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var)
+
 /* Accessor macros for the vfield slots in structures.  */
 
 /* List of virtual table fields that this type contains (both the primary
@@ -1640,8 +1676,6 @@ struct lang_type GTY(())
 /* The function to call.  */
 #define BV_FN(NODE) (TREE_VALUE (NODE))
 
-/* Nonzero if we should use a virtual thunk for this entry.  */
-#define BV_USE_VCALL_INDEX_P(NODE) (TREE_LANG_FLAG_0 (NODE))
 \f
 /* Nonzero for TREE_LIST node means that this list of things
    is a list of parameters, as opposed to a list of expressions.  */
@@ -1706,7 +1740,7 @@ struct lang_decl_flags GTY(())
   unsigned u1sel : 1;
   unsigned u2sel : 1;
   unsigned can_be_full : 1;
-  unsigned unused : 1; /* One unused bit.  */
+  unsigned this_thunk_p : 1;
 
   union lang_decl_u {
     /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
@@ -1724,13 +1758,9 @@ struct lang_decl_flags GTY(())
     /* For VAR_DECL in function, this is DECL_DISCRIMINATOR.  */
     int discriminator;
 
-    /* In a namespace-scope FUNCTION_DECL, this is
-       GLOBAL_INIT_PRIORITY.  */
-    int init_priority;
-
     /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
-       THUNK_VCALL_OFFSET.  */
-    tree GTY((tag ("2"))) vcall_offset;
+       THUNK_VIRTUAL_OFFSET.  */
+    tree GTY((tag ("2"))) virtual_offset;
   } GTY ((desc ("%1.u2sel"))) u2;
 };
 
@@ -1744,13 +1774,21 @@ struct lang_decl GTY(())
       {
        tree befriending_classes;
        
-       /* For a virtual FUNCTION_DECL, this is DECL_VIRTUAL_CONTEXT.  For a
-          non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT.  */
+       /* For a non-virtual FUNCTION_DECL, this is
+          DECL_FRIEND_CONTEXT.  For a virtual FUNCTION_DECL for which
+          DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
+          this pointer and result pointer adjusting thunks are
+          chained here.  This pointer thunks to return pointer thunks
+          will be chained on the return pointer thunk. */
        tree context;
-       
+
        /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION.  */
        tree cloned_function;
        
+       /* In a FUNCTION_DECL for which THUNK_P holds, this is
+          THUNK_FIXED_OFFSET.  */
+       HOST_WIDE_INT fixed_offset;
+
        /* In an overloaded operator, this is the value of
           DECL_OVERLOADED_OPERATOR_P.  */
        enum tree_code operator_code;
@@ -2031,11 +2069,23 @@ struct lang_decl GTY(())
 #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) \
   (DECL_LANG_SPECIFIC (NODE)->decl_flags.needs_final_overrider)
 
+/* The thunks associated with NODE, a FUNCTION_DECL.  */
+#define DECL_THUNKS(NODE) \
+  (DECL_LANG_SPECIFIC (NODE)->u.f.context)
+
 /* Nonzero if NODE is a thunk, rather than an ordinary function.  */
 #define DECL_THUNK_P(NODE)                     \
   (TREE_CODE (NODE) == FUNCTION_DECL           \
    && DECL_LANG_FLAG_7 (NODE))
 
+/* Nonzero if NODE is a this pointer adjusting thunk.  */
+#define DECL_THIS_THUNK_P(NODE)                        \
+  (DECL_THUNK_P (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
+
+/* Nonzero if NODE is a result pointer adjusting thunk.  */
+#define DECL_RESULT_THUNK_P(NODE)                      \
+  (DECL_THUNK_P (NODE) && !DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
+
 /* Nonzero if NODE is a FUNCTION_DECL, but not a thunk.  */
 #define DECL_NON_THUNK_FUNCTION_P(NODE)                                \
   (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
@@ -2049,9 +2099,10 @@ struct lang_decl GTY(())
   (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
 
 /* Set DECL_THUNK_P for node.  */
-#define SET_DECL_THUNK_P(NODE)                                 \
+#define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING)                 \
   (DECL_LANG_FLAG_7 (NODE) = 1,                                \
-   DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1)
+   DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1,                   \
+   DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p = (THIS_ADJUSTING))
 
 /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
    template function.  */
@@ -2083,11 +2134,6 @@ struct lang_decl GTY(())
   (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
 #define FROB_CONTEXT(NODE)   ((NODE) == global_namespace ? NULL_TREE : (NODE))
 
-/* For a virtual function, the base where we find its vtable entry.
-   For a non-virtual function, the base where it is defined.  */
-#define DECL_VIRTUAL_CONTEXT(NODE) \
-  (DECL_LANG_SPECIFIC (NODE)->u.f.context)
-
 /* 1 iff NODE has namespace scope, including the global namespace.  */
 #define DECL_NAMESPACE_SCOPE_P(NODE)                           \
   (!DECL_TEMPLATE_PARM_P (NODE)                                        \
@@ -2152,7 +2198,7 @@ struct lang_decl GTY(())
 #define DECL_PENDING_INLINE_INFO(NODE) \
   (DECL_LANG_SPECIFIC (NODE)->u.f.u.pending_inline_info)
 
-/* For a TYPE_DECL: if this function has many fields, we'll sort them
+/* For a TYPE_DECL: if this structure has many fields, we'll sort them
    and put them into a TREE_VEC.  */
 #define DECL_SORTED_FIELDS(NODE) \
   (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.f.u.sorted_fields)
@@ -2665,13 +2711,6 @@ struct lang_decl GTY(())
 #define DECL_GLOBAL_DTOR_P(NODE) \
   (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p)
 
-/* If DECL_GLOBAL_CTOR_P or DECL_GLOBAL_DTOR_P holds, this macro
-   returns the initialization priority for the function.  Constructors
-   with lower numbers should be run first.  Destructors should be run
-   in the reverse order of constructors.  */
-#define GLOBAL_INIT_PRIORITY(NODE) \
-  (LANG_DECL_U2_CHECK (NODE, 1)->init_priority)
-
 /* Accessor macros for C++ template decl nodes.  */
 
 /* The DECL_TEMPLATE_PARMS are a list.  The TREE_PURPOSE of each node
@@ -2893,32 +2932,42 @@ struct lang_decl GTY(())
    A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
    The address of the ordinary FUNCTION_DECL is given by the
    DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
-   FUNCTION_DECL.  The job of the thunk is to adjust the `this'
-   pointer before transferring control to the FUNCTION_DECL.
-
+   FUNCTION_DECL.  The job of the thunk is to either adjust the this
+   pointer before transferring control to the FUNCTION_DECL, or call
+   FUNCTION_DECL and then adjust the result value. Note, the result
+   pointer adjusting thunk must perform a call to the thunked
+   function, (or be implemented via passing some invisible parameter
+   to the thunked function, which is modified to perform the
+   adjustment just before returning).
+   
    A thunk may perform either, or both, of the following operations:
 
-   o Adjust the `this' pointer by a constant offset.
-   o Adjust the `this' pointer by looking up a vcall-offset
+   o Adjust the this or result pointer by a constant offset.
+   o Adjust the this or result pointer by looking up a vcall or vbase offset
      in the vtable.
 
-   If both operations are performed, then the constant adjument to
-   `this' is performed first.
+   A this pointer adjusting thunk converts from a base to a derived
+   class, and hence adds the offsets. A result pointer adjusting thunk
+   converts from a derived class to a base, and hence subtracts the
+   offsets.  If both operations are performed, then the constant
+   adjument is performed first for this pointer adjustment and last
+   for the result pointer adjustment.
 
-   The constant adjustment is given by THUNK_DELTA.  If the
-   vcall-offset is required, the index into the vtable is given by
-   THUNK_VCALL_OFFSET.  */
+   The constant adjustment is given by THUNK_FIXED_OFFSET.  If the
+   vcall or vbase offset is required, the index into the vtable is given by
+   THUNK_VIRTUAL_OFFSET.  */
 
 /* An integer indicating how many bytes should be subtracted from the
-   `this' pointer when this function is called.  */
-#define THUNK_DELTA(DECL) (DECL_CHECK (DECL)->decl.u1.i)
+   this or result pointer when this function is called.  */
+#define THUNK_FIXED_OFFSET(DECL) \
+  (DECL_LANG_SPECIFIC (DECL)->u.f.fixed_offset)
 
-/* A tree indicating how many bytes should be subtracted from the
-   vtable for the `this' pointer to find the vcall offset.  (The vptr
-   is always located at offset zero from the f `this' pointer.)  If
-   NULL, then there is no vcall offset.  */
-#define THUNK_VCALL_OFFSET(DECL) \
-  (LANG_DECL_U2_CHECK (DECL, 0)->vcall_offset)
+/* A tree indicating how many bytes should be added to the
+   vtable for the this or result pointer to find the vcall or vbase
+   offset.  (The vptr is always located at offset zero from the
+   this or result pointer.)  If NULL, then there is no virtual adjust.  */
+#define THUNK_VIRTUAL_OFFSET(DECL) \
+  (LANG_DECL_U2_CHECK (DECL, 0)->virtual_offset)
 
 /* These macros provide convenient access to the various _STMT nodes
    created when parsing template declarations.  */
@@ -3476,6 +3525,8 @@ typedef struct operator_name_info_t
   const char *name;
   /* The mangled name of the operator.  */
   const char *mangled_name;
+  /* The arity of the operator.  */
+  int arity;
 } operator_name_info_t;
 
 /* A mapping from tree codes to operator name information.  */
@@ -3484,44 +3535,44 @@ extern operator_name_info_t operator_name_info[];
 extern operator_name_info_t assignment_operator_name_info[];
 
 /* in call.c */
-extern int check_dtor_name                     PARAMS ((tree, tree));
+extern bool check_dtor_name (tree, tree);
 extern int get_arglist_len_in_bytes            PARAMS ((tree));
 
 extern tree build_vfield_ref                   PARAMS ((tree, tree));
-extern tree build_scoped_method_call           PARAMS ((tree, tree, tree, tree));
+extern tree build_scoped_method_call (tree, tree, tree, tree);
 extern tree build_conditional_expr             PARAMS ((tree, tree, tree));
-extern tree build_addr_func                    PARAMS ((tree));
-extern tree build_call                         PARAMS ((tree, tree));
-extern tree build_method_call                  PARAMS ((tree, tree, tree, tree, int));
-extern int null_ptr_cst_p                      PARAMS ((tree));
-extern int sufficient_parms_p                   PARAMS ((tree));
-extern tree type_decays_to                     PARAMS ((tree));
-extern tree build_user_type_conversion         PARAMS ((tree, tree, int));
-extern tree build_new_function_call            PARAMS ((tree, tree));
-extern tree build_new_method_call               (tree, tree, tree, tree, int);
-extern tree build_special_member_call           (tree, tree, tree, tree, int);
-extern tree build_new_op                       PARAMS ((enum tree_code, int, tree, tree, tree));
-extern tree build_op_delete_call               PARAMS ((enum tree_code, tree, tree, int, tree));
-extern int can_convert                         PARAMS ((tree, tree));
-extern int can_convert_arg                     PARAMS ((tree, tree, tree));
-extern int can_convert_arg_bad                 PARAMS ((tree, tree, tree));
-extern int enforce_access                       PARAMS ((tree, tree));
-extern tree convert_default_arg                 PARAMS ((tree, tree, tree, int));
-extern tree convert_arg_to_ellipsis             PARAMS ((tree));
-extern tree build_x_va_arg                      PARAMS ((tree, tree));
-extern tree cxx_type_promotes_to               PARAMS ((tree));
-extern tree type_passed_as                      PARAMS ((tree));
-extern tree convert_for_arg_passing             PARAMS ((tree, tree));
+extern tree build_addr_func (tree);
+extern tree build_call (tree, tree);
+extern tree build_method_call (tree, tree, tree, tree, int);
+extern bool null_ptr_cst_p (tree);
+extern bool sufficient_parms_p (tree);
+extern tree type_decays_to (tree);
+extern tree build_user_type_conversion (tree, tree, int);
+extern tree build_new_function_call (tree, tree);
+extern tree build_new_method_call (tree, tree, tree, tree, int);
+extern tree build_special_member_call (tree, tree, tree, tree, int);
+extern tree build_new_op (enum tree_code, int, tree, tree, tree);
+extern tree build_op_delete_call (enum tree_code, tree, tree, int, tree);
+extern bool can_convert (tree, tree);
+extern bool can_convert_arg (tree, tree, tree);
+extern bool can_convert_arg_bad (tree, tree, tree);
+extern bool enforce_access (tree, tree);
+extern tree convert_default_arg (tree, tree, tree, int);
+extern tree convert_arg_to_ellipsis (tree);
+extern tree build_x_va_arg (tree, tree);
+extern tree cxx_type_promotes_to (tree);
+extern tree type_passed_as (tree);
+extern tree convert_for_arg_passing (tree, tree);
 extern tree cp_convert_parm_for_inlining        PARAMS ((tree, tree, tree));
-extern int is_properly_derived_from             PARAMS ((tree, tree));
-extern tree initialize_reference                PARAMS ((tree, tree));
-extern tree strip_top_quals                     PARAMS ((tree));
-extern tree perform_implicit_conversion         PARAMS ((tree, tree));
+extern bool is_properly_derived_from (tree, tree);
+extern tree initialize_reference (tree, tree);
+extern tree strip_top_quals (tree);
+extern tree perform_implicit_conversion (tree, tree);
+extern tree in_charge_arg_for_name (tree);
 
 /* in class.c */
 extern tree build_base_path                    PARAMS ((enum tree_code, tree, tree, int));
 extern tree convert_to_base                     (tree, tree, bool);
-extern tree build_vbase_path                   PARAMS ((enum tree_code, tree, tree, tree, int));
 extern tree build_vtbl_ref                     PARAMS ((tree, tree));
 extern tree build_vfn_ref                      PARAMS ((tree, tree));
 extern tree get_vtable_decl                     PARAMS ((tree, int));
@@ -3553,6 +3604,7 @@ extern void cxx_print_error_function      PARAMS ((struct diagnostic_context *,
 extern void build_self_reference               PARAMS ((void));
 extern int same_signature_p                    PARAMS ((tree, tree));
 extern void warn_hidden                                PARAMS ((tree));
+extern void maybe_add_class_template_decl_list PARAMS ((tree, tree, int));
 extern tree get_enclosing_class                        PARAMS ((tree));
 int is_base_of_enclosing_class                 PARAMS ((tree, tree));
 extern void unreverse_member_declarations       PARAMS ((tree));
@@ -3560,7 +3612,6 @@ extern void invalidate_class_lookup_cache       PARAMS ((void));
 extern void maybe_note_name_used_in_class       PARAMS ((tree, tree));
 extern void note_name_declared_in_class         PARAMS ((tree, tree));
 extern tree get_vtbl_decl_for_binfo             PARAMS ((tree));
-extern tree in_charge_arg_for_name              PARAMS ((tree));
 extern tree get_vtt_name                        PARAMS ((tree));
 extern tree get_primary_binfo                   PARAMS ((tree));
 
@@ -3648,7 +3699,7 @@ extern void set_namespace_binding               PARAMS ((tree, tree, tree));
 extern tree lookup_namespace_name              PARAMS ((tree, tree));
 extern tree build_typename_type                 PARAMS ((tree, tree, tree, tree));
 extern tree make_typename_type                 PARAMS ((tree, tree, tsubst_flags_t));
-extern tree make_unbound_class_template                PARAMS ((tree, tree, int));
+extern tree make_unbound_class_template                PARAMS ((tree, tree, tsubst_flags_t));
 extern tree lookup_name_nonclass               PARAMS ((tree));
 extern tree lookup_function_nonclass            PARAMS ((tree, tree));
 extern tree lookup_name                                PARAMS ((tree, int));
@@ -3755,7 +3806,7 @@ extern void check_member_template               PARAMS ((tree));
 extern tree grokfield                          PARAMS ((tree, tree, tree, tree, tree));
 extern tree grokbitfield                       PARAMS ((tree, tree, tree));
 extern tree groktypefield                      PARAMS ((tree, tree));
-extern tree grokoptypename                     PARAMS ((tree, tree));
+extern tree grokoptypename                     PARAMS ((tree, tree, tree));
 extern void cplus_decl_attributes              PARAMS ((tree *, tree, int));
 extern tree constructor_name_full              PARAMS ((tree));
 extern tree constructor_name                   PARAMS ((tree));
@@ -3763,8 +3814,6 @@ extern bool constructor_name_p                  (tree, tree);
 extern void defer_fn                           PARAMS ((tree));
 extern void finish_anon_union                  PARAMS ((tree));
 extern tree finish_table                       PARAMS ((tree, tree, tree, int));
-extern void finish_builtin_type                        PARAMS ((tree, const char *,
-                                                      tree *, int, tree));
 extern tree coerce_new_type                    PARAMS ((tree));
 extern tree coerce_delete_type                 PARAMS ((tree));
 extern void comdat_linkage                     PARAMS ((tree));
@@ -3915,20 +3964,21 @@ extern void cxx_finish PARAMS ((void));
 extern void cxx_init_options PARAMS ((void));
 
 /* in method.c */
-extern void init_method                                PARAMS ((void));
-extern void set_mangled_name_for_decl           PARAMS ((tree));
-extern tree build_opfncall                     PARAMS ((enum tree_code, int, tree, tree, tree));
-extern tree hack_identifier                    PARAMS ((tree, tree));
-extern tree make_thunk                         PARAMS ((tree, tree, tree));
-extern void use_thunk                          PARAMS ((tree, int));
-extern void synthesize_method                  PARAMS ((tree));
-extern tree implicitly_declare_fn               PARAMS ((special_function_kind, tree, int));
-extern tree skip_artificial_parms_for          PARAMS ((tree, tree));
+extern void init_method        (void);
+extern void set_mangled_name_for_decl (tree);
+extern tree build_opfncall (enum tree_code, int, tree, tree, tree);
+extern tree hack_identifier (tree, tree);
+extern tree make_thunk (tree, bool, tree, tree);
+extern void finish_thunk (tree, tree, tree);
+extern void use_thunk (tree, bool);
+extern void synthesize_method (tree);
+extern tree implicitly_declare_fn (special_function_kind, tree, bool);
+extern tree skip_artificial_parms_for (tree, tree);
 
 /* In optimize.c */
-extern void optimize_function                   PARAMS ((tree));
-extern int calls_setjmp_p                       PARAMS ((tree));
-extern int maybe_clone_body                     PARAMS ((tree));
+extern void optimize_function (tree);
+extern bool calls_setjmp_p (tree);
+extern bool maybe_clone_body (tree);
 
 /* in pt.c */
 extern void check_template_shadow              PARAMS ((tree));
@@ -3971,7 +4021,6 @@ extern int push_tinst_level                       PARAMS ((tree));
 extern void pop_tinst_level                    PARAMS ((void));
 extern int more_specialized_class              PARAMS ((tree, tree));
 extern int is_member_template                   PARAMS ((tree));
-extern int template_parms_equal                 PARAMS ((tree, tree));
 extern int comp_template_parms                  PARAMS ((tree, tree));
 extern int template_class_depth                 PARAMS ((tree));
 extern int is_specialization_of                 PARAMS ((tree, tree));
@@ -3983,7 +4032,7 @@ extern void print_candidates                    PARAMS ((tree));
 extern int instantiate_pending_templates        PARAMS ((void));
 extern tree tsubst_default_argument             PARAMS ((tree, tree, tree));
 extern tree most_general_template              PARAMS ((tree));
-extern tree get_mostly_instantiated_function_type PARAMS ((tree, tree *, tree *));
+extern tree get_mostly_instantiated_function_type PARAMS ((tree));
 extern int problematic_instantiation_changed    PARAMS ((void));
 extern void record_last_problematic_instantiation PARAMS ((void));
 extern tree current_instantiation               PARAMS ((void));
@@ -4251,7 +4300,7 @@ extern tree cp_add_pending_fn_decls PARAMS ((void*,tree));
 extern int cp_is_overload_p PARAMS ((tree));
 extern int cp_auto_var_in_fn_p PARAMS ((tree,tree));
 extern tree cp_copy_res_decl_for_inlining PARAMS ((tree, tree, tree, void*,
-                                                  int*, void*));
+                                                  int*, tree));
 extern int cp_start_inlining                   PARAMS ((tree));
 extern void cp_end_inlining                    PARAMS ((tree));
 
@@ -4354,7 +4403,7 @@ extern tree mangle_typeinfo_string_for_type     PARAMS ((tree));
 extern tree mangle_vtbl_for_type                PARAMS ((tree));
 extern tree mangle_vtt_for_type                 PARAMS ((tree));
 extern tree mangle_ctor_vtbl_for_type           PARAMS ((tree, tree));
-extern tree mangle_thunk                        PARAMS ((tree, tree, tree));
+extern tree mangle_thunk                        PARAMS ((tree, int, tree, tree));
 extern tree mangle_conv_op_name_for_type        PARAMS ((tree));
 extern tree mangle_guard_variable               PARAMS ((tree));
 extern tree mangle_ref_init_variable            PARAMS ((tree));