Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think I found a solution- </p> <ul> <li>Get the definition of the cursor (in the above case it was <code>CXCursor_ParmDecl</code> but it could be anything, like <code>CXCursor_VarDecl</code>, etc.</li> <li>Get the first child of this cursor</li> </ul> <p>Here is my updated code- it's hacky and needs some cleanup/clarification, but posting here for posterity.</p> <pre><code>- (void)processMethodDeclaration:(const CXIdxDeclInfo *)declaration { clang_visitChildrenWithBlock(declaration-&gt;cursor, ^enum CXChildVisitResult(CXCursor cursor, CXCursor parent) { if (cursor.kind == CXCursor_ObjCMessageExpr) { __block NSString* memberName = nil; __block NSString* referencedObjectName = nil; clang_visitChildrenWithBlock(cursor, ^enum CXChildVisitResult(CXCursor cursor, CXCursor parent) { if (cursor.kind == CXCursor_MemberRefExpr) { memberName = [NSString stringWithUTF8String:clang_getCString(clang_getCursorDisplayName(cursor))]; referencedObjectName = [NSString stringWithUTF8String:clang_getCString(clang_getCursorDisplayName(clang_getCursorSemanticParent(clang_getCursorReferenced(cursor))))]; } else { if (memberName) { __block NSString* passedClassName = nil; clang_visitChildrenWithBlock(cursor, ^enum CXChildVisitResult(CXCursor cursor, CXCursor parent) { if (cursor.kind == CXCursor_DeclRefExpr) { CXCursor def = clang_getCursorDefinition(cursor); clang_visitChildrenWithBlock(def, ^enum CXChildVisitResult(CXCursor cursor, CXCursor parent) { passedClassName = [NSString stringWithUTF8String:clang_getCString(clang_getCursorDisplayName(cursor))]; return CXChildVisit_Break; }); } return CXChildVisit_Recurse; }); return CXChildVisit_Break; } } return CXChildVisit_Continue; }); } return CXChildVisit_Recurse; }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload