From 99120ca3cf2a22f89fd7ec46ff483882fc3a2bbe Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 26 Feb 2015 10:34:47 +0100 Subject: qdoc: Correct parsing of the using clause MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qdoc could only parse the using clause where the 'using' keyword was followed by 'namespace'. Now it can parse using clauses with or without 'namespace'. Change-Id: Ic4aad025c00b3bda2bc1cbd52d0ba8dbbad653e5 Task-number: QTBUG-44553 Reviewed-by: Alex Blasche Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/tree.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/tools/qdoc/tree.cpp') diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index ed4b4e3979f..6393ad4e6f6 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -498,6 +498,29 @@ void Tree::resolveCppToQmlLinks() } } +/*! + For each C++ class node, resolve any \c using clauses + that appeared in the class declaration. + */ +void Tree::resolveUsingClauses() +{ + foreach (Node* child, root_.childNodes()) { + if (child->isClass()) { + ClassNode* cn = static_cast(child); + QList& usingClauses = cn->usingClauses(); + QList::iterator uc = usingClauses.begin(); + while (uc != usingClauses.end()) { + if (!(*uc).node()) { + const Node* n = qdb_->findFunctionNode((*uc).signature(), cn, Node::CPP); + if (n) + (*uc).setNode(n); + } + ++uc; + } + } + } +} + /*! */ void Tree::fixInheritance(NamespaceNode* rootNode) @@ -1427,7 +1450,8 @@ void Tree::insertQmlType(const QString& key, QmlTypeNode* n) const Node* Tree::findFunctionNode(const QString& target, const Node* relative, Node::Genus genus) { QString t = target; - t.chop(2); + if (t.endsWith("()")) + t.chop(2); QStringList path = t.split("::"); const FunctionNode* fn = findFunctionNode(path, relative, SearchBaseClasses, genus); if (fn && fn->metaness() != FunctionNode::MacroWithoutParams) -- cgit v1.2.3