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

Limin FU phoolimin at gmail.com
Mon Jun 20 11:49:42 PDT 2011


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

Limin


On Mon, Jun 20, 2011 at 11:24 AM, John McCall <rjmccall at apple.com> wrote:

> On Jun 20, 2011, at 10:54 AM, Limin FU wrote:
> > 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().
>
> John.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110620/426fb513/attachment.html>


More information about the cfe-dev mailing list