How to distinguish "int *p" and "int p[]" in function parameters?


I started to use clang a few days ago, trying to develop an automated binding tool that can parse C/C++ header files and generate wrapping codes. Now one problem I have is to handle parameter forms “int *p” and “int p[]” differently. But it appears that clang generates pointer type for both. Is there a simple way to distinguish them from their type objects? I really hope I don’t have to extract the source codes and parse it myself.
Thanks a lot,


You want the type as written, i.e. the TypeLoc, which you can get with getTypeSourceInfo()->getTypeLoc().


This works, thank you very much.
Nice to see it is so simple, and just a matter of looking into the right classes.