You can use clang_getCursorSemanticParent
to retrieve the "semantic parent" of a cursor. As quoted from the documentation:
The semantic parent of a cursor is the cursor that semantically contains the given cursor. [...] In the out-of-line definition of
C::f
, the semantic parent is the the classC
, of which this function is a member.
In your example, something like the following should work:
// Retrieve the semantic parent (the class in this case)
CXCursor parent = clang_getCursorSemanticParent (cr);
clang_getCString (clang_getCursorDisplayName (parent));
// Should yield "ParseObjectFace"