summaryrefslogtreecommitdiff
path: root/src/qdoc/tree.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2018-11-15 00:13:58 +0100
committerTopi Reiniƶ <topi.reinio@qt.io>2018-11-15 23:01:47 +0000
commit5a678ec9a8ae5159456e4af7b81968e4ea027d6b (patch)
tree7dcacccb5202e938eb82f9c8b3ebedc3e0750e8b /src/qdoc/tree.cpp
parentbcc2ba45d316c01b0ce4827092bd8b2c28f3f2c3 (diff)
downloadqttools-5a678ec9a8ae5159456e4af7b81968e4ea027d6b.tar.gz
qdoc: Fix link resolution for types under namespaces
When QDoc tries to resolve a link to a type from a function parameter, it sets a 'TypesOnly' find flag. For types that contain a scope resolution operator(s), i.e. double-colons, QDoc first looks for the scope (namespace), and then the type under that scope. The problem was that the TypesOnly flag was passed to also the function call to find the namespace. This failed as namespaces are not types. Another problematic corner case happened with name clashes between a C++ module and a namespace, as is the case with e.g. 'Qt3DCore'. Here, QDoc tried to resolve the module node as the scope, and subsequently failed to find anything under that scope as module nodes have no children. Task-number: QTBUG-69484 Change-Id: Ia3c8fa96263a24176a11cf23a3469a374de7973a Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/qdoc/tree.cpp')
-rw-r--r--src/qdoc/tree.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp
index b51f3dc50..abd89d7d5 100644
--- a/src/qdoc/tree.cpp
+++ b/src/qdoc/tree.cpp
@@ -885,7 +885,11 @@ const Node* Tree::findNode(const QStringList& path,
if (node == 0 || !node->isAggregate())
break;
- const Node* next = static_cast<const Aggregate*>(node)->findChildNode(path.at(i), genus, findFlags);
+ // Clear the TypesOnly flag until the last path segment, as e.g. namespaces are not types.
+ // We also ignore module nodes as they are not aggregates and thus have no children.
+ int tmpFlags = (i < path.size() - 1) ? (findFlags & ~TypesOnly) | IgnoreModules : findFlags;
+
+ const Node* next = static_cast<const Aggregate*>(node)->findChildNode(path.at(i), genus, tmpFlags);
if (!next && (findFlags & SearchEnumValues) && i == path.size()-1) {
next = static_cast<const Aggregate*>(node)->findEnumNodeForValue(path.at(i));
}
@@ -893,7 +897,7 @@ const Node* Tree::findNode(const QStringList& path,
node->isClass() && (findFlags & SearchBaseClasses)) {
NodeList baseClasses = allBaseClasses(static_cast<const ClassNode*>(node));
foreach (const Node* baseClass, baseClasses) {
- next = static_cast<const Aggregate*>(baseClass)->findChildNode(path.at(i), genus, findFlags);
+ next = static_cast<const Aggregate*>(baseClass)->findChildNode(path.at(i), genus, tmpFlags);
if (!next && (findFlags & SearchEnumValues) && i == path.size() - 1)
next = static_cast<const Aggregate*>(baseClass)->findEnumNodeForValue(path.at(i));
if (next) {