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

Stefan Seefeld seefeld at sympatico.ca
Mon Jan 24 12:47:35 PST 2011


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.)


Thanks,
         Stefan

-- 

       ...ich hab' noch einen Koffer in Berlin...




More information about the cfe-dev mailing list