How can I create a variable in AST?

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

How can I create a variable in AST?

This post has NOT been accepted by the mailing list yet.
Hi there.

I'm new in Clang, I'm trying to create a new variable but I'm getting some erros, could u help me?

I'm trying whit this:

IdentifierTable *itable = new IdentifierTable(CGM.getLangOpts());
IdentifierInfo* tname = &(itable->get("__nth"));
QualType qt = getContext().IntTy;
VarDecl *x;
x = VarDecl::Create(getContext(), declCTX, SourceLocation(), SourceLocation(), tname, qt, nullptr, StorageClass::SC_None);