[cfe-dev] how to get info from Decl
Douglas Gregor
dgregor at apple.com
Thu Feb 4 08:24:08 PST 2010
On Feb 3, 2010, at 8:42 AM, Jochen Wilhelmy wrote:
> Hi!
>
> I have implemented HandleTopLevelDecl in an own ASTConsumer
> and want to get some Info from the declarations.
>
> I already get the function names and the names of the
> parameters, but how can I get the type of the arguments out of
> ParamVarDecl?
The getType() function on ParmVarDecl returns the type of the parameter. getOriginalType() returns the type as it was written in the source code.
> If a function is extern "C", I get a LinkageSpecDecl, but how
> do I get the function inside this declaration?
A LinkageSpecDecl is a DeclContext, which you can traverse using its member functions decls_begin()/decls_end(), which return DeclContext::decl_iterator iterators. This is how you traverse anything that has nested declarations, including namespaces and classes.
- Doug
More information about the cfe-dev
mailing list