[c++ patch] comment some macros

Nathan Sidwell nathan@codesourcery.com
Mon Jul 29 23:00:00 GMT 2002


Hi,
I've installed the attached obvious (after you've figured it out)
patch to some vtable accessor macros

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
-------------- next part --------------
2002-07-30  Nathan Sidwell  <nathan@codesourcery.com>

	* cp-tree.h (CLASSTYPE_VFIELDS, VF_*, BV_*): Add more
	documentation.

Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.736
diff -c -3 -p -r1.736 cp-tree.h
*** cp/cp-tree.h	29 Jul 2002 11:45:33 -0000	1.736
--- cp/cp-tree.h	30 Jul 2002 04:52:26 -0000
*************** struct lang_type GTY(())
*** 1734,1762 ****
  
  /* Accessor macros for the vfield slots in structures.  */
  
! /* The virtual function pointer fields that this type contains.  For a
!    vfield defined just for this class, or from a primary base, the
!    TREE_PURPOSE is NULL.  Otherwise, the TREE_PURPOSE is the BINFO for
!    the class containing the vfield.  The TREE_VALUE is the class where
!    the vfield was first defined.  */
  #define CLASSTYPE_VFIELDS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vfields)
  
! /* Get the assoc info that caused this vfield to exist.  */
  #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
  
! /* Get that same information as a _TYPE.  */
  #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
  
! /* Get the value of the top-most type dominating the non-`normal' vfields.  */
! #define VF_DERIVED_VALUE(NODE) \
!   (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
  
  /* The number of bytes by which to adjust the `this' pointer when
!    calling this virtual function.  */
  #define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
  
  /* If non-NULL, the vtable index at which to find the vcall offset
!    when calling this virtual function.  */
  #define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
  
  /* The function to call.  */
--- 1734,1767 ----
  
  /* Accessor macros for the vfield slots in structures.  */
  
! /* List of virtual table fields that this type contains (both the primary
!    and secondaries). The TREE_VALUE is the class type where the vtable
!    field was introduced. For a vtable field inherited from the primary
!    base, or introduced by this class, the TREE_PURPOSE is NULL. For
!    other vtable fields (those from non-primary bases), the
!    TREE_PURPOSE is the BINFO of the base through which the vtable was
!    inherited.  */
  #define CLASSTYPE_VFIELDS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vfields)
  
! /* Get the BINFO that introduced this vtable into the hierarchy (will
!    be NULL for those created at this level, or from a primary
!    hierarchy).  */
  #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
  
! /* Get the TYPE that introduced this vtable into the hierarchy (always
!    non-NULL).  */
  #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
  
! /* Accessor macros for the BINFO_VIRTUALS list. */
  
  /* The number of bytes by which to adjust the `this' pointer when
!    calling this virtual function.  Subtract this value from the this
!    pointer. Always non-NULL, might be constant zero though. */
  #define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
  
  /* If non-NULL, the vtable index at which to find the vcall offset
!    when calling this virtual function.  Add the value at that vtable
!    index to the this pointer.  */
  #define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
  
  /* The function to call.  */


More information about the Gcc-patches mailing list