* Find the cursor that cursor @p cursor references * * First tries to get the referenced cursor via clang_getCursorReferenced, * and if that fails, tries to get them via clang_getOverloadedDecl * (which returns the referenced cursor for CXCursor_OverloadedDeclRef, for example) * * @return Valid cursor on success, else null cursor */
| 89 | * @return Valid cursor on success, else null cursor |
| 90 | */ |
| 91 | CXCursor referencedCursor(CXCursor cursor) |
| 92 | { |
| 93 | auto referenced = clang_getCursorReferenced(cursor); |
| 94 | // HACK: see notes at getEmbeddedTypeAlias() |
| 95 | if (clang_getCursorKind(referenced) == CXCursor_TypeAliasTemplateDecl) { |
| 96 | return findEmbeddedTypeAlias(referenced); |
| 97 | } |
| 98 | |
| 99 | if (!clang_equalCursors(cursor, referenced)) { |
| 100 | return referenced; |
| 101 | } |
| 102 | |
| 103 | // get the first result for now |
| 104 | referenced = clang_getOverloadedDecl(cursor, 0); |
| 105 | if (!clang_Cursor_isNull(referenced)) { |
| 106 | return referenced; |
| 107 | } |
| 108 | return clang_getNullCursor(); |
| 109 | } |
| 110 | |
| 111 | Identifier makeId(CXCursor cursor) |
| 112 | { |
no test coverage detected