A given type_t object is actually a tree (or subtree). For example,
the type
int (*)(float, char**) looks like the following: pointer_type_t
|
|pointed_to
V
function_type_t
/ \ \
return_type/ \args[0] \args[1]
V V V
scalar_type_t scalar_type_t pointer_type_t
| | |
|name |name |pointed_to
| | |
"int" "float" pointer_type_t
|
|pointed_to
|
scalar_type_t
|
|name
|
"char"
scalar_type_t is a leaf type.The class_type_t and union_type_t classes are also
leaf types of a sort. Since all recursive types (such as the type of a linked list) must
go through a class or struct or union in order to recurse, you can think of them as
leaves — so that types really are trees, rather than arbitrary graphs. However, this
"leafness" is a property of the code that uses the type_t
structure. It's merely a convenient convention. This convention is used by
type_recursive_visitor_t
, among others.