Extracting Struct Decl From Typedef

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Extracting Struct Decl From Typedef

Manas via cfe-dev
All, how does one go about extracting the struct declaration
(RecordDecl) from a combined typedef + struct clause in the Clang AST
using a TypedefDecl?

EX:
typedef struct FOO{
  int f0;
  int f1;
  int f2;
};

In visiting a TypedefDecl node, I use:

[snipped]
TypedefDecl *TD = dyn_cast<TypedefDecl>(D);


I would like to retrieve the RecordDecl of the corresponding struct
such that when I clone a new TypedefDecl AST node, I can copy over the
struct linkage with it.  Otherwise, the struct ends up with an
anonymous type.

Any thoughts?
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev