From e9954e31624c77d986077ec5431c7ec4a9b058e0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Jan 2014 12:57:17 +0100 Subject: qdoc: Teach qdoc to use multiple trees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qdoc now builds a separate Node Tree for each index file it parsed. The main Node Tree now contains only the Nodes of things being documented in the current module. This should make qdoc run a little faster. qdoc now uses these separate trees to make intra-module and inter-module linking more robust by searching the trees in an order that depends on the type of link it is searching for. The tree for the current module is always searched first. Then qdoc searches the trees for either the C++ modules or the QML modules, depending on whether it is looking for a C++ link or a QML link. In preparation for this update, qdoc was also simplified a lot. Many functions became obsolete and were removed. Others were combined. Task-number: QTBUG-35377 Change-Id: Iea4e49869ff6a6ff0f4d53090728770d40d892f3 Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/cppcodeparser.cpp | 45 ++++++---------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) (limited to 'src/tools/qdoc/cppcodeparser.cpp') diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index bb403bd4d9..c22a5227a6 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -225,8 +225,6 @@ void CppCodeParser::parseSourceFile(const Location& location, const QString& fil */ void CppCodeParser::doneParsingHeaderFiles() { - qdb_->resolveInheritance(); - QMapIterator i(sequentialIteratorClasses); while (i.hasNext()) { i.next(); @@ -959,38 +957,12 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, } } else if (command == COMMAND_RELATES) { - /* - Find the node that this node relates to. - */ - Node* n = 0; - if (arg.startsWith(QLatin1Char('<')) || arg.startsWith('"')) { - /* - It should be a header file, I think. - */ - n = qdb_->findNodeByNameAndType(QStringList(arg), Node::Document, Node::NoSubType); - } - else { - /* - If it wasn't a file, it should be either a class or a namespace. - */ - QStringList newPath = arg.split("::"); - n = qdb_->findClassNode(newPath); - if (!n) - n = qdb_->findNamespaceNode(newPath); - } - - if (!n) { - /* - Didn't ind it. Error... - */ + QStringList path = arg.split("::"); + Node* n = qdb_->findRelatesNode(path); + if (!n) doc.location().warning(tr("Cannot find '%1' in '\\%2'").arg(arg).arg(COMMAND_RELATES)); - } - else { - /* - Found it. This node relates to it. - */ + else node->setRelates(static_cast(n)); - } } else if (command == COMMAND_CONTENTSPAGE) { setLink(node, Node::ContentsLink, arg); @@ -1636,11 +1608,7 @@ bool CppCodeParser::matchBaseSpecifier(ClassNode *classe, bool isClass) if (!matchDataType(&baseClass)) return false; - qdb_->addBaseClass(classe, - access, - baseClass.toPath(), - baseClass.toString(), - classe->parent()); + classe->addUnresolvedBaseClass(access, baseClass.toPath(), baseClass.toString()); return true; } @@ -1735,9 +1703,8 @@ bool CppCodeParser::matchNamespaceDecl(InnerNode *parent) */ QString namespaceName = previousLexeme(); NamespaceNode* ns = 0; - if (parent) { + if (parent) ns = static_cast(parent->findChildNodeByNameAndType(namespaceName, Node::Namespace)); - } if (!ns) { ns = new NamespaceNode(parent, namespaceName); ns->setAccess(access); -- cgit v1.2.3