summaryrefslogtreecommitdiff
path: root/src/qdoc/cppcodeparser.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2017-02-23 13:02:27 +0100
committerMartin Smith <martin.smith@qt.io>2017-08-10 07:34:30 +0000
commit61d6c6c6f6fba869781ec05c787606f7a72d6314 (patch)
tree1c7def0b07492655a1ff8ecdf662d53a55835a9a /src/qdoc/cppcodeparser.cpp
parent7414d80fb8b1e7ea895456d2dbaee6b811aa297f (diff)
downloadqttools-61d6c6c6f6fba869781ec05c787606f7a72d6314.tar.gz
qdoc: Use documentation for implicit special functions
Allow implicitly declared special member functions to be explicitly documented. For example, in class QFuture, the destructor, copy constructor and assignment operatore are implicitly declared, but they are explicitly documented in qfuture.qdoc. clangqdoc no longer complains that it can't find these functions in any header file. It creates them for documentation purposes, and they are documented as expected. Where these function signatures appear on the class reference page, " = default" is appended to the end to indicate that the function is implicitly declared. Change-Id: I7bcf16c31099439f424b438eb41589435d7254b6 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r--src/qdoc/cppcodeparser.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 04e06783e..8a149dec2 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -236,6 +236,14 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
if (func) {
lastPath_ = parentPath;
} else if (isWorthWarningAbout(doc)) {
+ if (clone && clone->isSpecialMemberFunction()) {
+ ClassNode* cn = qdb_->findClassNode(parentPath);
+ if (cn) {
+ cn->addChild(clone);
+ clone->setImplicit(true);
+ return clone;
+ }
+ }
doc.location().warning(tr("Cannot find '%1' in '\\%2' %3")
.arg(clone->name() + "(...)")
.arg(COMMAND_FN)
@@ -1572,7 +1580,8 @@ bool CppCodeParser::matchFunctionDecl(Aggregate *parent,
func->setParameters(pvect);
}
func->setMetaness(metaness_);
- if (parent && (name == parent->name())) {
+ if ((parent && (name == parent->name())) ||
+ (!parentPath.isEmpty() && name == parentPath.at(parentPath.size()-1))) {
FunctionNode::Metaness m = FunctionNode::Ctor;
if (!pvect.isEmpty()) {
for (int i=0; i<pvect.size(); i++) {
@@ -1595,14 +1604,25 @@ bool CppCodeParser::matchFunctionDecl(Aggregate *parent,
func->setMetaness(FunctionNode::Dtor);
else if (name == QLatin1String("operator=")) {
FunctionNode::Metaness m = FunctionNode::Plain;
- if (parent && pvect.size() == 1) {
- const Parameter& p = pvect.at(0);
- if (p.dataType().contains(parent->name())) {
- if (p.dataType().endsWith(QLatin1String("&&"))) {
- m = FunctionNode::MAssign;
+ if (pvect.size() == 1) {
+ if (parent) {
+ if (pvect.at(0).dataType().contains(parent->name())) {
+ if (pvect.at(0).dataType().endsWith(QLatin1String("&&"))) {
+ m = FunctionNode::MAssign;
+ }
+ else if (pvect.at(0).dataType().endsWith(QLatin1String("&"))) {
+ m = FunctionNode::CAssign;
+ }
}
- else if (p.dataType().endsWith(QLatin1String("&"))) {
- m = FunctionNode::CAssign;
+ }
+ else if (!parentPath.isEmpty()) {
+ if (pvect.at(0).dataType().contains(parentPath.at(parentPath.size()-1))) {
+ if (pvect.at(0).dataType().endsWith(QLatin1String("&&"))) {
+ m = FunctionNode::MAssign;
+ }
+ else if (pvect.at(0).dataType().endsWith(QLatin1String("&"))) {
+ m = FunctionNode::CAssign;
+ }
}
}
}