How to know written var type with Clang using C API

I’m trying to use Clang via C API, indexing to be detailed. The problem is that some types are returned not as they are written, but as they are for compiler. For example “Stream &” becomes “int &” and “byte” becomes "int.

Some test lib:

// TODO make it a subclass of a generic Serial/Stream base class
class FirmataClass
    FirmataClass(Stream &s);

    void setFirmwareNameAndVersion(const char *name, byte major, byte minor);

I’m using the code to get method information:

void showMethodInfo(const CXIdxDeclInfo *info) {
    int numArgs = clang_Cursor_getNumArguments(info->cursor);
    fprintf(stderr, "  %i args:\n", numArgs);

    for (int i=0; i<numArgs; i++) {
        CXCursor argCursor = clang_Cursor_getArgument(info->cursor, i);
        CXString name = clang_getCursorDisplayName(argCursor);
        CXString spelling = clang_getCursorSpelling(argCursor);

        CXType type = clang_getCursorType(argCursor);
        CXString typeSpelling = clang_getTypeSpelling(type);

        CXCursorKind kind = clang_getCursorKind(argCursor);

        fprintf(stderr, "  kind=[%s (%i)], type=[%s], spelling=[%s]\n",
            cursor_kinds[kind], kind, clang_getCString(typeSpelling),


    // return type
    CXType returnType = clang_getCursorResultType(info->cursor);
    CXString returnTypeSpelling = clang_getTypeSpelling(returnType);

    fprintf(stderr, " returns %s\n", clang_getCString(returnTypeSpelling));


[105:10 4689] access=[CX_CXXPublic] kind=[CXIdxEntity_CXXInstanceMethod] (21) name=[setFirmwareNameAndVersion] is_container=[0] 3 args:
kind=[CXCursor_ParmDecl (10)], type=[const char *], spelling=[name]
kind=[CXCursor_ParmDecl (10)], type=[int], spelling=[major]
kind=[CXCursor_ParmDecl (10)], type=[int], spelling=[minor] returns void

So you can see that byte function arguments are described as int. How can i get actual spelling?

Thanks, Anton.