[cfe-dev] HOWTO: use a CXCursor referring a Typedef

Douglas Gregor dgregor at apple.com
Mon Jan 24 17:23:17 PST 2011

On Jan 24, 2011, at 12:47 PM, Stefan Seefeld wrote:

> On 2011-01-24 13:49, Douglas Gregor wrote:
>> On Jan 21, 2011, at 1:06 PM, Stefan Seefeld wrote:
>>> I'm trying to access the newly defined type (CXType), as well as the
>>> aliased type, starting from a CXCursor of kind CXCursor_TypedefDecl.
>> There isn't an API to access just the aliased type as it was written. You can use clang_getCanonicalType() to get down to the canonical form of the type. I'd be fine with adding some kind of clang_getDesugaredType() operation to desugar a given type by one step.
> That might be useful indeed.
> Given
>   typedef int const * const &RPInt;
> How can I access the details of the aliased type ? Right now I'm seeing 
> an LValueReference, which I can "unwrap" using clang_getPointeeType 
> multiple times. Is there a way to learn about any involved cv-qualifiers ?
> On a somewhat related note: I can't see any type representing arrays, 
> and no way to retrieve the array size(s).
> (Array parameters seem to decay to pointer types, which also looks wrong.)

CXType doesn't fully expose the Clang type system, although it could. I'd support the addition of APIs to extract more information from CXTypes.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110124/afd9b084/attachment.html>

More information about the cfe-dev mailing list