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

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Sep 13 17:30:05 PDT 2011


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

Regards,

Vinay Sajip




More information about the cfe-dev mailing list