This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Multiple inheritance
- To: allen at eecs dot tulane dot edu
- Subject: Re: Multiple inheritance
- From: mrs at wrs dot com (Mike Stump)
- Date: Wed, 10 Dec 1997 16:00:22 -0800
- Cc: egcs at cygnus dot com
- Reply-To: egcs at cygnus dot com
> From: "Joshua S. Allen" <allen@eecs.tulane.edu>
> To: mrs@wrs.com (Mike Stump)
> Date: Wed, 10 Dec 1997 09:21:57 -0600 (CST)
> I've been trying to look at the data in BINFO_BASETYPES using TREE_VALUE
Please refer to the code and the .h files:
/* A vector of additional binfos [...]
#define BINFO_BASETYPES(NODE)
This:
/* In a TREE_LIST node. */
#define TREE_VALUE(NODE) ((NODE)->list.value)
means that this works for a TREE_LIST (only). A vector isn't a TREE_LIST.
> but it just gives me an integer, which I assume it an offset maybe.
Now, it means nothing because it isn't valid.
> Is there a way to get a string value of the class name?
TYPE_NAME_STRING(TYPE), it's meant to be readable. From a sample use:
cp_error ("`%D' is already defined in class %s", fndecl,
TYPE_NAME_STRING (DECL_CONTEXT (fndecl)));
We can see that it should give us a %s type name of a type. The trick
then it to get the type from the binfo. Guess what:
TYPE_BINFO (BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo_h), i)))
kinda sums up how to do that. You can find these snippets in the
code. In fact, looking further, we see:
/* Accessor macro to get to the Nth basetype of this basetype. */
#define TYPE_BINFO_BASETYPE(NODE,N) BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (NODE)), (N)))
which even matches closer to what you wanted.