| 109 | } |
| 110 | |
| 111 | Identifier makeId(CXCursor cursor) |
| 112 | { |
| 113 | if (CursorKindTraits::isClassTemplate(cursor.kind)) { |
| 114 | // TODO: how to handle functions here? We don't want to add the "real" function arguments here |
| 115 | // and there does not seem to be an API to get the template arguments for non-specializations easily |
| 116 | // NOTE: using the QString overload of the Identifier ctor here, so that the template name gets parsed |
| 117 | return Identifier(ClangString(clang_getCursorDisplayName(cursor)).toString()); |
| 118 | } |
| 119 | |
| 120 | const ClangString spelling(clang_getCursorSpelling(cursor)); |
| 121 | if (!spelling.isEmpty() && spelling.c_str()[0] == '[') { |
| 122 | // skip unexposed DecompositionDecl, we want to get hold of the BindingsDecl inside instead |
| 123 | return Identifier(); |
| 124 | } |
| 125 | |
| 126 | auto name = spelling.toIndexed(); |
| 127 | if (name.isEmpty() && CursorKindTraits::isClass(cursor.kind)) { |
| 128 | // try to use the type name for typedef'ed anon structs etc. as a fallback |
| 129 | auto type = ClangString(clang_getTypeSpelling(clang_getCursorType(cursor))).toString(); |
| 130 | // but don't associate a super long name for anon structs without a typedef |
| 131 | if (!type.startsWith(QLatin1String("(anonymous "))) { |
| 132 | name = IndexedString(type); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | return Identifier(name); |
| 137 | } |
| 138 | |
| 139 | #if CINDEX_VERSION_MINOR >= 100 // FIXME https://bugs.llvm.org/show_bug.cgi?id=35333 |
| 140 | QByteArray makeComment(CXComment comment) |
no test coverage detected