[cfe-dev] Extracting Struct Decl From Typedef
John Leidel via cfe-dev
cfe-dev at lists.llvm.org
Tue Oct 13 05:58:17 PDT 2020
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?
More information about the cfe-dev
mailing list