diff options
author | Martin Smith <martin.smith@qt.io> | 2016-09-15 14:42:14 +0200 |
---|---|---|
committer | Martin Smith <martin.smith@qt.io> | 2017-08-10 07:33:01 +0000 |
commit | 0c79d9b16b150a7457caa998fd304af35e407b2d (patch) | |
tree | 13855144b1f9b7e9fa56dbee2ae0ff63dd15bbf5 /src/qdoc/clangcodeparser.cpp | |
parent | 02de17eae61496e3b9ba78de5b8868ad94d21294 (diff) | |
download | qttools-0c79d9b16b150a7457caa998fd304af35e407b2d.tar.gz |
qdoc: Identify special constructors and assignment ops
This change enables clangqdoc to identify copy constructors,
move-copy constructors, copy-assignment operators and
move-assignment operators. Identifying these special member
functions allows clangqdoc to document them automatically
if the documentation is missing, which also means fewer qdoc
error reports.
Change-Id: Ic50822c2939f0a84e707a1b3ff946bc731a0bd85
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index ccab4a08d..ef9483a00 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -462,8 +462,21 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l QVector<Parameter> pvect; pvect.reserve(numArg); for (int i = 0; i < numArg; ++i) { - auto typeName = fromCXString(clang_getTypeSpelling(clang_getArgType(funcType, i))); - pvect.append(Parameter(adjustTypeName(typeName))); + CXType argType = clang_getArgType(funcType, i); + if (fn->isCtor()) { + if (fromCXString(clang_getTypeSpelling(clang_getPointeeType(argType))) == name) { + if (argType.kind == CXType_RValueReference) + fn->setMetaness(FunctionNode::MCtor); + else if (argType.kind == CXType_LValueReference) + fn->setMetaness(FunctionNode::CCtor); + } + } else if ((kind == CXCursor_CXXMethod) && (name == QLatin1String("operator="))) { + if (argType.kind == CXType_RValueReference) + fn->setMetaness(FunctionNode::MAssign); + else if (argType.kind == CXType_LValueReference) + fn->setMetaness(FunctionNode::CAssign); + } + pvect.append(Parameter(adjustTypeName(fromCXString(clang_getTypeSpelling(argType))))); } if (pvect.size() > 0 && pvect.last().dataType().endsWith(QLatin1String("::QPrivateSignal"))) { pvect.pop_back(); // remove the QPrivateSignal argument |