Pregunta

world! I am trying to use libclang to determine the superclass that an Objective-C method belongs to. I have a cursor representing an instance method (CXCursor_ObjCInstanceMethodDecl). When I get the cursor's parent, I get a cursor of kind CXCursor_ObjCImplementationDecl. I need to be able to get the interface cursor from this last cursor in order to determine the method's superclass. Is there a way to do this?

¿Fue útil?

Solución

Calling clang_getCanonicalCursor() on the cursor for the @implementation declaration will return the cursor for the @interface declaration. Visiting the children of this cursor will provide access to its superclass reference.

You can also use clang_getOverriddenCursors() on the cursor for the method to determine if it is overriding another from a superclass, protocol, or category.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top