[cfe-dev] libclang - access to function parameter types

Argyrios Kyrtzidis kyrtzidis at apple.com
Wed Sep 14 10:02:04 PDT 2011


On Sep 13, 2011, at 5:30 PM, Vinay Sajip wrote:

> Argyrios Kyrtzidis <kyrtzidis at ...> writes:
> 
>> 
>> There is no way currently; there should be something like 'unsigned
>> clang_getFunctionTypeNumParams(CXType)' and 'CXType
> clang_getFunctionTypeParam(CXType,
>> unsigned index)' 
> 
> I've already implemented this in my branch at https://github.com/vsajip/clang/
> as follows:
> 
> int    clang_getFunctionArgumentCount(CXType);
> CXType clang_getFunctionArgumentType(CXType, unsigned);
> 
> The reasoning for the int return from the former is as an error return of -1 in
> case the type passed in is not a function with prototype.
> 
> I've also implemented exposing constant arrays (as mentioned on issue 9348) using
> 
> int clang_getArraySize(CXType); // returns -1 for invalid type
> CXType clang_getArrayElementType(CXType);
> 
> as well as exposing the type using a new constant CXType_ConstantArray.
> 
> Furthermore, I've implemented accessing EnumConstantDecl values as well as
> declaration attributes (such as inline) using a function
> 
> int clang_getCursorValue(CXCursor);
> 
> Might any of these be of any interest for merging into trunk ... ?

Definitely; please post in cfe-commits with a patch for review.

> 
> Regards,
> 
> Vinay Sajip
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list