summaryrefslogtreecommitdiff
path: root/src/qdoc/cppcodeparser.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2017-05-08 10:48:15 +0200
committerMartin Smith <martin.smith@qt.io>2017-08-10 07:35:38 +0000
commitfd3976142ca2ec4fb555917cad92135a2070eb0b (patch)
tree9b19ca7caa966ff69aa45ab42ca410b5af2b7af5 /src/qdoc/cppcodeparser.cpp
parentda183316a39979f42070759eecb9062fcf240ac5 (diff)
downloadqttools-fd3976142ca2ec4fb555917cad92135a2070eb0b.tar.gz
qdoc: Better support for multi-\fn documentation blocks
This change is a partial fix for the multi-\fn documentation concept. It outputs the documentation once but listing all the function signatures from the \fn commands found in the qdoc comment. Multiple \since commands are not implemented; the \until command is not implemented, and providing text applicable to a specific \fn signature is not implemented. This change requires clang, which means it requires a sequence of other updates as well, so you can't test it unless you have all that stuff. Task-number: QTBUG-60420 Change-Id: Ib316b6f97fa427ef730c4badfc785101bff55dce Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r--src/qdoc/cppcodeparser.cpp109
1 files changed, 58 insertions, 51 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 219b39fbb..07d0f8d4a 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -201,65 +201,72 @@ const QSet<QString>& CppCodeParser::topicCommands()
}
/*!
- Process the topic \a command found in the \a doc with argument \a arg.
+
*/
-Node* CppCodeParser::processTopicCommand(const Doc& doc,
- const QString& command,
- const ArgLocPair& arg)
+Node* CppCodeParser::processFnCommand(const ArgLocPair& arg, const Doc& doc)
{
ExtraFuncData extra;
- if (command == COMMAND_FN) {
- QStringList parentPath;
- FunctionNode *func = 0;
- FunctionNode *clone = 0;
+ QStringList parentPath;
+ FunctionNode *func = 0;
+ FunctionNode *clone = 0;
- if (!makeFunctionNode(arg.first, &parentPath, &clone, extra) &&
- !makeFunctionNode("void " + arg.first, &parentPath, &clone, extra)) {
- doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN));
+ if (!makeFunctionNode(arg.first, &parentPath, &clone, extra) &&
+ !makeFunctionNode("void " + arg.first, &parentPath, &clone, extra)) {
+ doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN));
+ }
+ else {
+ func = qdb_->findFunctionNode(parentPath, clone);
+ if (func == 0) {
+ if (parentPath.isEmpty() && !lastPath_.isEmpty())
+ func = qdb_->findFunctionNode(lastPath_, clone);
}
- else {
- func = qdb_->findFunctionNode(parentPath, clone);
- if (func == 0) {
- if (parentPath.isEmpty() && !lastPath_.isEmpty())
- func = qdb_->findFunctionNode(lastPath_, clone);
- }
-
- /*
- If the node was not found, then search for it in the
- open C++ namespaces. We don't expect this search to
- be necessary often. Nor do we expect it to succeed
- very often.
- */
- if (func == 0)
- func = qdb_->findNodeInOpenNamespace(parentPath, clone);
-
- 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;
- }
+ /*
+ If the node was not found, then search for it in the
+ open C++ namespaces. We don't expect this search to
+ be necessary often. Nor do we expect it to succeed
+ very often.
+ */
+ if (func == 0)
+ func = qdb_->findNodeInOpenNamespace(parentPath, clone);
+ 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)
- .arg(arg.first),
- tr("I cannot find any function of that name with the "
- "specified signature. Make sure that the signature "
- "is identical to the declaration, including 'const' "
- "qualifiers."));
- }
- if (func) {
- func->borrowParameterNames(clone);
- func->setParentPath(clone->parentPath());
}
- delete clone;
+ doc.location().warning(tr("Cannot find '%1' in '\\%2' %3")
+ .arg(clone->name() + "(...)")
+ .arg(COMMAND_FN)
+ .arg(arg.first),
+ tr("I cannot find any function of that name with the "
+ "specified signature. Make sure that the signature "
+ "is identical to the declaration, including 'const' "
+ "qualifiers."));
}
- return func;
+ if (func) {
+ func->borrowParameterNames(clone);
+ func->setParentPath(clone->parentPath());
+ }
+ delete clone;
+ }
+ return func;
+}
+
+/*!
+ Process the topic \a command found in the \a doc with argument \a arg.
+ */
+Node* CppCodeParser::processTopicCommand(const Doc& doc,
+ const QString& command,
+ const ArgLocPair& arg)
+{
+ ExtraFuncData extra;
+ if (command == COMMAND_FN) {
+ return processFnCommand(arg, doc);
}
else if (command == COMMAND_MACRO) {
QStringList parentPath;