Replacing (a subset of) gccxml by a clang plugin

(Please CC me as I am not subscribed to this list)

Hello. I have a few questions on how I could replace gccxml by a clang
plugin in some tooling I have.

What I need is:
  1. discovery of all the types. I need only the fields (don't care
about members), their visibility and whether classes have virtual
methods / base classes
  2. binary layout of the fields (i.e. offsets from beginning of the
class/struct/union)

Where I got so far:
  * the information in 1. are given by RecordDecl, which can be
discovered by registering an ASTConsumer (method HandleTagDecl)

What I miss:
  * how can I get the information from 2 ?

Thanks in advance for comments / pointers

Sylvain Joyeux

Please *do* subscribe to the list.

  2. binary layout of the fields (i.e. offsets from beginning of the
class/struct/union)

Look at the class ASTRecordLayout.

--Sean Silva

I’ve been changing a project from GCC XML to Clang, but I’m using the API directly instead of a plugin, so might give you a starting point. You can look at the code at: https://github.com/tritao/cxxi/blob/master/src/Parser/Parser.cpp

Hope it helps.