[cfe-dev] Adding a FieldDecl
Dimitrij Kotrev
dimitrij.kotrev at googlemail.com
Sun Feb 13 05:35:41 PST 2011
Hello,
i want to add a FieldDecl to a class/struct. For example an integer variable.
So far my code looks like this:
clang::CXXRecordDecl* d;
...
clang::ASTContext& astContext = d->getASTContext();
clang::FieldDecl* fd = clang::FieldDecl::Create(
astContext,
d,
clang::SourceLocation(),
0 /*identifierinfo*/,
astContext.IntTy,
0 /*typesourceinfo*/,
0 /*bitwidth*/,
0 /*mutable*/
);
But i'm missing some pieces. Where do i get the IdentifierInfo for my
new field? The field
should be called 'foo' for example. Where do i get the TypeSourceInfo?
Is it enough
to specify the SourceLocation like this? Am i missing anything else?
Thanks
More information about the cfe-dev
mailing list