[cfe-dev] How to identify pointer variable declarations in C source while traversing with ASTConsumer?

Douglas Gregor dgregor at apple.com
Fri Mar 11 08:48:05 PST 2011


On Mar 11, 2011, at 2:19 AM, jignesh vasoya wrote:

> Hi,
> how can i differentiate between normal variable declaration and pointer variable declaration?
> 
> For example,
> int i;
> int *p;
> 
> is there any flag in VarDecl class that will be set to true if declaration is of pointer kind?

Look at the type of the variable (accessible via getType(), which will be PointerType vs. (in this case) BuiltinType.

	- Doug



More information about the cfe-dev mailing list