Changeset View
Changeset View
Standalone View
Standalone View
plugins/clang/util/clangutils.cpp
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Line(s) | |||||
199 | 199 | | |||
200 | bool ClangUtils::isScopeKind(CXCursorKind kind) | 200 | bool ClangUtils::isScopeKind(CXCursorKind kind) | ||
201 | { | 201 | { | ||
202 | return kind == CXCursor_Namespace || kind == CXCursor_StructDecl || | 202 | return kind == CXCursor_Namespace || kind == CXCursor_StructDecl || | ||
203 | kind == CXCursor_UnionDecl || kind == CXCursor_ClassDecl || | 203 | kind == CXCursor_UnionDecl || kind == CXCursor_ClassDecl || | ||
204 | kind == CXCursor_ClassTemplate || kind == CXCursor_ClassTemplatePartialSpecialization; | 204 | kind == CXCursor_ClassTemplate || kind == CXCursor_ClassTemplatePartialSpecialization; | ||
205 | } | 205 | } | ||
206 | 206 | | |||
207 | QString ClangUtils::getScope(CXCursor cursor, CXCursor context) | 207 | QString ClangUtils::getScope(CXCursor cursor, CXCursor context, const QVector<CXCursor>& qualified) | ||
208 | { | 208 | { | ||
209 | QStringList scope; | 209 | QStringList scope; | ||
210 | if (clang_Cursor_isNull(context)) { | 210 | if (clang_Cursor_isNull(context)) { | ||
211 | context = clang_getCursorLexicalParent(cursor); | 211 | context = clang_getCursorLexicalParent(cursor); | ||
212 | } | 212 | } | ||
213 | context = clang_getCanonicalCursor(context); | 213 | context = clang_getCanonicalCursor(context); | ||
214 | CXCursor search = clang_getCursorSemanticParent(cursor); | 214 | CXCursor search = clang_getCursorSemanticParent(cursor); | ||
215 | while (isScopeKind(clang_getCursorKind(search)) && !clang_equalCursors(search, context)) { | 215 | while (isScopeKind(clang_getCursorKind(search)) && !clang_equalCursors(search, context) | ||
216 | && std::none_of(qualified.begin(), qualified.end(), [search](CXCursor ns) { return clang_equalCursors(search, ns); })) { | ||||
216 | scope.prepend(ClangString(clang_getCursorDisplayName(search)).toString()); | 217 | scope.prepend(ClangString(clang_getCursorDisplayName(search)).toString()); | ||
217 | search = clang_getCursorSemanticParent(search); | 218 | search = clang_getCursorSemanticParent(search); | ||
218 | } | 219 | } | ||
219 | return scope.join(QStringLiteral("::")); | 220 | return scope.join(QStringLiteral("::")); | ||
220 | } | 221 | } | ||
221 | 222 | | |||
222 | QString ClangUtils::getCursorSignature(CXCursor cursor, const QString& scope, const QVector<QString>& defaultArgs) | 223 | QString ClangUtils::getCursorSignature(CXCursor cursor, const QString& scope, const QVector<QString>& defaultArgs) | ||
223 | { | 224 | { | ||
▲ Show 20 Lines • Show All 237 Lines • Show Last 20 Lines |