I am parsing Objective-C code and have a construct like:
@interface SomeClass (MyCategory)
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.
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.