This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Traversing typedef hierarchy in C/C++ tree


Hi,

I am trying to figure out how to get a typedef hierarchy from the C/C++
tree in GCC. Consider the following declarations:

struct s {};

typedef s s_t;
typedef s_t my_s_t;

my_s_t x;

Giveb 'x' VAR_DECL I can have this traversal using TYPE_MAIN_VARIANT():

x -> my_s_t -> s;

What I am trying to achieve is this:

x -> my_s_t -> s_t -> s

I looked at TYPE_NEXT_VARIANT(), but this is a list while what I need
is a tree (hierarchy).

Some background on why I need this: I would like to determine if a
member of a class is size_t so that I can always map it to a 64-bit
integer in another system (RDBMS). In other words:

struct s
{
  unsigned int i;    // -> 32-bit int
  size_t s;          // -> 64-bit int
}

Even though size_t might be typedef'ed as unsigned int. In the above
example I can do it. However, adding a level or indirections causes
problems:

typedef size_t my_size;

struct s
{
  my_size s;         // TYPE_MAIN_VARIANT(my_size) == unsigned int
}

Any ideas will be much appreciated.

Boris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]