libclang: Getting interface from CXCursor_ObjCCategoryDecl

I am parsing Objective-C code and have a construct like:

    @interface SomeClass (MyCategory)
    …
    @end

When visiting the AST I see a `CXCursor_ObjCCategoryDecl` cursor.

I would like to get the interface name of the cursor (i.e. `SomeClass`).

Using `clang_getCursorSpelling` I get back `MyCategory`.

Using `clang_getCursorType` I get a type of `CXType_Invalid`.

How can I get the interface that the category is associated with?

I'm not sure if there's a better way, but this is what I did:

Visit the CXCursor_ObjCCategoryDecl cursor's children and pick the first cursor that has the CXCursor_ObjCClassRef kind.

https://github.com/jacob-carlborg/dstep/blob/master/clang/Cursor.d#L142-L150

https://github.com/jacob-carlborg/dstep/blob/master/clang/Visitor.d#L119-L127

Thanks, I ended up using that solution.

Re-reading the clang header file I see there is CXIdxObjCCategoryDeclInfo with more info, but that is only available when using the callback-based indexing API, so I did not experiment with that.