diff options
author | Martin Smith <martin.smith@qt.io> | 2017-01-17 11:44:41 +0100 |
---|---|---|
committer | Martin Smith <martin.smith@qt.io> | 2017-08-10 07:33:53 +0000 |
commit | 816b967374aa714139ddc59676dd32702bed9f49 (patch) | |
tree | e7e664d94acb2fcbe55d405df6fdc8e761db6d56 /src/qdoc/clangcodeparser.cpp | |
parent | 54425fbd3de2911bf98a934423ec22e495e8424c (diff) | |
download | qttools-816b967374aa714139ddc59676dd32702bed9f49.tar.gz |
qdoc: Enable documentation of type alias as typedef
clangqdoc now handles the type alias declaraction and provides
the \typealias command for documenting it. It is documented as
a typedef.
Task-number: QTBUG-58158
Change-Id: Iee0c8dea66026a89b3625b40b92b056cada893c1
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index c7bb37120..db3461c7f 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -378,6 +378,22 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l { auto kind = clang_getCursorKind(cursor); switch (kind) { + case CXCursor_TypeAliasDecl: { + QString spelling = getSpelling(clang_getCursorExtent(cursor)); + QStringList typeAlias = spelling.split(QChar('=')); + if (typeAlias.size() == 2) { + typeAlias[0] = typeAlias[0].trimmed(); + typeAlias[1] = typeAlias[1].trimmed(); + int lastBlank = typeAlias[0].lastIndexOf(QChar(' ')); + if (lastBlank > 0) { + typeAlias[0] = typeAlias[0].right(typeAlias[0].size() - (lastBlank + 1)); + TypeAliasNode* ta = new TypeAliasNode(parent_, typeAlias[0], typeAlias[1]); + ta->setAccess(fromCX_CXXAccessSpecifier(clang_getCXXAccessSpecifier(cursor))); + ta->setLocation(fromCXSourceLocation(clang_getCursorLocation(cursor))); + } + } + return CXChildVisit_Continue; + } case CXCursor_StructDecl: case CXCursor_UnionDecl: case CXCursor_ClassDecl: |