[cfe-dev] libclang: Getting interface from CXCursor_ObjCCategoryDecl

Allan Odgaard lists+cfe-dev at simplit.com
Mon Nov 17 04:01:56 PST 2014


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?



More information about the cfe-dev mailing list