summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/qdocindexfiles.cpp
diff options
context:
space:
mode:
authorTopi Reinio <[email protected]>2015-08-12 11:00:19 +0200
committerTopi Reiniƶ <[email protected]>2015-08-19 11:30:23 +0000
commitd558100aa71f714342526c072005ad3bcef88d0f (patch)
tree100824281ff956d4495541cbb42537a605003057 /src/tools/qdoc/qdocindexfiles.cpp
parent53762b102bc656c1f9b294b164f9b494a6d78da7 (diff)
qdoc: Improve resolving related non-members and their overload numbers
There were several problems related to resolving related non-member (RNM) functions for classes. This commit does the following changes: - Overload numbers for RNMs are now calculated at the time the \relates command is processed, instead of a separate step. - If a \relates refers to an entity outside the module boundary, write the argument passed to it as-is into the index file. - Delay the destruction of QDocIndexFiles singleton, to resolve the RNMs read from the index files prior to generating docs. - Remove the redundant call to normalizeOverloads() for single- exec mode as unnecessary. These changes ensure that all RNMs are listed in the documentation for the node that they belong to. A remaining issue is that if a function relates to a class outside the module boundary, that function documentation will be empty because the doc content is not stored into the index file (for obvious reasons). Single-exec mode does not have this problem. Change-Id: I33f038120728932cd9fd70da28d9090023068bd6 Task-number: QTBUG-47589 Reviewed-by: Topi Reiniƶ <[email protected]>
Diffstat (limited to 'src/tools/qdoc/qdocindexfiles.cpp')
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index 8db901bbc78..fc262d98346 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -100,6 +100,7 @@ void QDocIndexFiles::destroyQDocIndexFiles()
*/
void QDocIndexFiles::readIndexes(const QStringList& indexFiles)
{
+ relatedList_.clear();
foreach (const QString& indexFile, indexFiles) {
QString msg = "Loading index file: " + indexFile;
Location::logToStdErr(msg);
@@ -146,9 +147,7 @@ void QDocIndexFiles::readIndexFile(const QString& path)
indexUrl = installDir.relativeFilePath(path).section('/', 0, -2);
}
project_ = attrs.value(QLatin1String("project")).toString();
-
basesList_.clear();
- relatedList_.clear();
NamespaceNode* root = qdb_->newIndexTree(project_);
@@ -730,17 +729,37 @@ void QDocIndexFiles::resolveIndex()
pair.first->addUnresolvedBaseClass(Node::Public, basePath, QString());
}
}
+ // No longer needed.
+ basesList_.clear();
+}
+
+/*
+ Goes though the list of nodes that are related to other aggregates
+ that were read from all index files, and tries to find the aggregate
+ nodes from the database. Calls the node's setRelates() for each
+ aggregate that is found in the local module (primary tree).
+
+ This function is meant to be called before starting the doc generation,
+ after all the index files are read.
+ */
+void QDocIndexFiles::resolveRelates()
+{
+ if (relatedList_.isEmpty())
+ return;
+
+ // Restrict searching only to the local (primary) tree
+ QVector<Tree*> searchOrder = qdb_->searchOrder();
+ qdb_->setLocalSearch();
QPair<FunctionNode*,QString> relatedPair;
foreach (relatedPair, relatedList_) {
QStringList path = relatedPair.second.split("::");
Node* n = qdb_->findRelatesNode(path);
if (n)
- relatedPair.first->setRelates(static_cast<ClassNode*>(n));
+ relatedPair.first->setRelates(static_cast<Aggregate*>(n));
}
-
- // No longer needed.
- basesList_.clear();
+ // Restore original search order
+ qdb_->setSearchOrder(searchOrder);
relatedList_.clear();
}