This section describes some of the macros used on trees. The list should be alphabetical. Eventually all macros should be documented here. There are some postscript drawings that can be used to better understand from of the more complex data structures, contact Mike Stump (mrs@cygnus.com
) for information about them.
BINFO_BASETYPES
If this basetype describes type D as inherited in C, and if the basetypes of D are E anf F, then this vector contains binfos for inheritance of E and F by C.
Has values of:
TREE_VECs
BINFO_INHERITANCE_CHAIN
Z ZbY least derived | Y YbX | X Xb most derived TYPE_BINFO (X) == Xb BINFO_INHERITANCE_CHAIN (Xb) == YbX BINFO_INHERITANCE_CHAIN (Yb) == ZbY BINFO_INHERITANCE_CHAIN (Zb) == 0
Not sure is the above is really true, get_base_distance has is point towards the most derived type, opposite from above.
Set by build_vbase_path, recursive_bounded_basetype_p, get_base_distance, lookup_field, lookup_fnfields, and reverse_path.
What things can this be used on:
TREE_VECs that are binfos
BINFO_OFFSET
Used on TREE_VEC_ELTs of the binfos BINFO_BASETYPES (...) for example.
BINFO_VIRTUALS
What things can this be used on:
TREE_VECs that are binfos
BINFO_VTABLE
What things can this be used on:
TREE_VECs that are binfos
Has values of:
VAR_DECLs that are virtual function tables
BLOCK_SUPERCONTEXT
CLASSTYPE_TAGS
finish_struct scans these to produce TYPE_DECLs to add to the TYPE_FIELDS of the type.
It is expected that name found in the TREE_PURPOSE slot is unique, resolve_scope_to_name is one such place that depends upon this uniqueness.
CLASSTYPE_METHOD_VEC
friends are kept in TREE_LISTs, so that there's no need to use their TREE_CHAIN slot for anything.
Has values of:
TREE_VECs
CLASSTYPE_VFIELD
Has values of:
FIELD_DECLs that are virtual function table pointers
What things can this be used on:
RECORD_TYPEs
DECL_CLASS_CONTEXT
The difference between this and DECL_CONTEXT, is that for virtuals functions like:
struct A { virtual int f (); }; struct B : A { int f (); }; DECL_CONTEXT (A::f) == A DECL_CLASS_CONTEXT (A::f) == A DECL_CONTEXT (B::f) == A DECL_CLASS_CONTEXT (B::f) == B
Has values of:
RECORD_TYPEs, or UNION_TYPEs
What things can this be used on:
TYPE_DECLs, _DECLs
DECL_CONTEXT
Has values of:
RECORD_TYPEs
What things can this be used on:
VAR_DECLs that are virtual function tables
_DECLs
DECL_FIELD_CONTEXT
Has values of:
RECORD_TYPEs
What things can this be used on:
FIELD_DECLs that are virtual function pointers
FIELD_DECLs
DECL_NESTED_TYPENAME
Has values of:
IDENTIFIER_NODEs
What things can this be used on:
TYPE_DECLs
DECL_NAME
Has values of:
0 for things that don't have names
IDENTIFIER_NODEs for TYPE_DECLs
DECL_IGNORED_P
Used in cases where it is known that the debugging information will be output in another file, or where a sub-type is known not to be needed because the enclosing type is not needed.
A compiler constructed virtual destructor in derived classes that do not define an explicit destructor that was defined explicit in a base class has this bit set as well. Also used on __FUNCTION__ and __PRETTY_FUNCTION__ to mark they are ``compiler generated.'' c-decl and c-lex.c both want DECL_IGNORED_P set for ``internally generated vars,'' and ``user-invisible variable.''
Functions built by the C++ front-end such as default destructors, virtual destructors and default constructors want to be marked that they are compiler generated, but unsure why.
Currently, it is used in an absolute way in the C++ front-end, as an optimization, to tell the debug information output routines to not generate debugging information that will be output by another separately compiled file.
DECL_VIRTUAL_P
What things can this be used on:
FIELD_DECLs and VAR_DECLs
DECL_VPARENT
What things can this be used on:
VAR_DECLs that are virtual function tables
Has values of:
RECORD_TYPEs maybe UNION_TYPEs
DECL_FCONTEXT
How it is used:
Used when writing out debugging information about vfield and vbase decls.
What things can this be used on:
FIELD_DECLs that are virtual function pointers FIELD_DECLs
DECL_REFERENCE_SLOT
What things can this be used on:
PARM_DECLs and VAR_DECLs that have a reference type
DECL_VINDEX
DECL_VINDEX may be a TREE_LIST, that would seem to be a list of overridden FUNCTION_DECLs. add_virtual_function has code to deal with this when it uses the variable base_fndecl_list, but it would seem that somehow, it is possible for the TREE_LIST to pursist until method_call, and it should not.
What things can this be used on:
FUNCTION_DECLs
DECL_SOURCE_FILE
Has values of:
"<built-in>" on TYPE_DECLs to mean the typedef is built in
DECL_SOURCE_LINE
Has values of:
0 for an undefined label
0 for TYPE_DECLs that are internally generated
0 for FUNCTION_DECLs for functions generated by the compiler
(not yet, but should be)
0 for ``magic'' arguments to functions, that the user has no
control over
TREE_USED
Has values of:
0 for unused labels
TREE_ADDRESSABLE
TREE_COMPLEXITY
TREE_PRIVATE
The following routines do something with PRIVATE access: build_method_call, alter_access, finish_struct_methods, finish_struct, convert_to_aggr, CWriteLanguageDecl, CWriteLanguageType, CWriteUseObject, compute_access, lookup_field, dfs_pushdecl, GNU_xref_member, dbxout_type_fields, dbxout_type_method_1
TREE_PROTECTED
TYPE_BINFO
Has values of:
TREE_VECs that are binfos
What things can this be used on:
RECORD_TYPEs
TYPE_BINFO_BASETYPES
TYPE_BINFO_VIRTUALS
What things can this be used on:
RECORD_TYPEs
TYPE_BINFO_VTABLE
What things can this be used on:
RECORD_TYPEs
Has values of:
VAR_DECLs that are virtual function tables
TYPE_NAME
Has values of:
0 for things that don't have names.
should be IDENTIFIER_NODE for RECORD_TYPEs UNION_TYPEs and
ENUM_TYPEs.
TYPE_DECL for RECORD_TYPEs, UNION_TYPEs and ENUM_TYPEs, but
shouldn't be.
TYPE_DECL for typedefs, unsure why.
What things can one use this on:
TYPE_DECLs
RECORD_TYPEs
UNION_TYPEs
ENUM_TYPEs
History:
It currently points to the TYPE_DECL for RECORD_TYPEs, UNION_TYPEs and ENUM_TYPEs, but it should be history soon.
TYPE_METHODS
CLASSTYPE_METHOD_VEC
. Chained together with TREE_CHAIN
. `dbxout.c' uses this to get at the methods of a class.
TYPE_DECL
Components:
DECL_NAME is the name of the typedef. For example, foo would be found in the DECL_NAME slot when typedef int foo;
is seen.
DECL_SOURCE_LINE identifies what source line number in the source file the declaration was found at. A value of 0 indicates that this TYPE_DECL is just an internal binding layer marker, and does not correspond to a user supplied typedef.
DECL_SOURCE_FILE
TYPE_FIELDS
TREE_CHAIN
) of member types of a class. The list can contain TYPE_DECL
s, but there can also be other things in the list apparently. See also CLASSTYPE_TAGS
.
TYPE_VIRTUAL_P
FIELD_DECL
or a VAR_DECL
, indicates it is a virtual function table or a pointer to one. When used on a FUNCTION_DECL
, indicates that it is a virtual function. When used on an IDENTIFIER_NODE
, indicates that a function with this same name exists and has been declared virtual. When used on types, it indicates that the type has virtual functions, or is derived from one that does.
Not sure if the above about virtual function tables is still true. See also info on DECL_VIRTUAL_P
.
What things can this be used on:
FIELD_DECLs, VAR_DECLs, FUNCTION_DECLs, IDENTIFIER_NODEs
VF_BASETYPE_VALUE
Set at finish_base_struct
time.
What things can this be used on:
TREE_LISTs that are vfields
History:
This field was used to determine if a virtual function table's slot should be filled in with a certain virtual function, by checking to see if the type returned by VF_BASETYPE_VALUE was a parent of the context in which the old virtual function existed. This incorrectly assumes that a given type _could_ not appear as a parent twice in a given inheritance lattice. For single inheritance, this would in fact work, because a type could not possibly appear more than once in an inheritance lattice, but with multiple inheritance, a type can appear more than once.
VF_BINFO_VALUE
TREE_VIA_VIRTUAL
on result to find out if it is a virtual base class. Related to the binfo found by
get_binfo (VF_BASETYPE_VALUE (vfield), t, 0)
where `t' is the type that has the given vfield.
get_binfo (VF_BASETYPE_VALUE (vfield), t, 0)
will return the binfo for the the given vfield.
May or may not be set at modify_vtable_entries
time. Set at finish_base_struct
time.
What things can this be used on:
TREE_LISTs that are vfields
VF_DERIVED_VALUE
Set at finish_base_struct
time.
What things can this be used on:
TREE_LISTs that are vfields
VF_NORMAL_VALUE
Set at finish_base_struct
time.
What things can this be used on:
TREE_LISTs that are vfields
WRITABLE_VTABLES