diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 5 | ||||
-rw-r--r-- | src/tools/qdoc/node.cpp | 41 | ||||
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 4 |
3 files changed, 31 insertions, 19 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index d036c40f35..0a80c0242b 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -154,6 +154,11 @@ bool Preprocessor::skipBranch() Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocessor::TokenizeMode mode) { Symbols symbols; + // Preallocate some space to speed up the code below. + // The magic divisor value was found by calculating the average ratio between + // input size and the final size of symbols. + // This yielded a value of 16.x when compiling Qt Base. + symbols.reserve(input.size() / 16); const char *begin = input.constData(); const char *data = begin; while (*data) { diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index c1cf076f47..9740f984f5 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -847,7 +847,7 @@ FunctionNode *Aggregate::findFunctionNode(const QString& name, const QString& pa FunctionNode* fn = pfn; if (fn) { const QVector<Parameter>* funcParams = &(fn->parameters()); - if (params.isEmpty() && funcParams->isEmpty()) + if (params.isEmpty() && funcParams->isEmpty() && !fn->isInternal()) return fn; bool isQPrivateSignal = false; // Not used in the search QVector<Parameter> testParams; @@ -859,7 +859,7 @@ FunctionNode *Aggregate::findFunctionNode(const QString& name, const QString& pa int i = -1; while (fn) { if (testParams.size() == funcParams->size()) { - if (testParams.isEmpty()) + if (testParams.isEmpty() && !fn->isInternal()) return fn; bool different = false; for (int j=0; j<testParams.size(); j++) { @@ -868,7 +868,7 @@ FunctionNode *Aggregate::findFunctionNode(const QString& name, const QString& pa break; } } - if (!different) + if (!different && !fn->isInternal()) return fn; } if (++i < funcs.size()) { @@ -878,19 +878,30 @@ FunctionNode *Aggregate::findFunctionNode(const QString& name, const QString& pa else fn = 0; } - if (!fn && !testParams.empty()) - return 0; + /* + Most \l commands that link to functions don't include + the parameter declarations in the function signature, + so if the \l is meant to go to a function that does + have parameters, the algorithm above won't find it. + Therefore we must return the pointer to the function + in the primary function map in the cases where the + parameters should have been specified in the \l command. + But if the primary function is marked internal, search + the secondary list to find one that is not marked internal. + */ + if (!fn) { + if (!testParams.empty()) + return 0; + if (pfn && !pfn->isInternal()) + return pfn; + foreach (Node* n, funcs) { + fn = static_cast<FunctionNode*>(n); + if (!fn->isInternal()) + return fn; + } + } } - /* - Most \l commands that link to functions don't include - the parameter declarations in the function signature, - so if the \l is meant to go to a function that does - have parameters, the algorithm above won't find it. - Therefore we must return the pointer to the function - in the primary function map in the cases where the - parameters should have been specified in the \l command. - */ - return (fn ? fn : pfn); + return fn; } /*! diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 6312deacbf..ca1648ec2f 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -1672,8 +1672,6 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q Atom* atom = const_cast<Atom*>(a); QStringList targetPath = atom->string().split("#"); QString first = targetPath.first().trimmed(); - if (Generator::debugging()) - qDebug() << " first:" << first; Tree* domain = 0; Node::Genus genus = Node::DontCare; @@ -1717,8 +1715,6 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q node = findNodeByNameAndType(QStringList(first), Node::Document); else if (first.endsWith(QChar(')'))) { node = findFunctionNode(first, relative, genus); - if (Generator::debugging()) - qDebug() << " node:" << node; } if (!node) return findNodeForTarget(targetPath, relative, genus, ref); |