summaryrefslogtreecommitdiff
path: root/src/qdoc/clangcodeparser.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2019-03-20 11:27:29 +0100
committerMartin Smith <martin.smith@qt.io>2019-04-02 09:57:25 +0000
commitf395f1b47b7f9ebba66730e0518167944b0a47de (patch)
tree4ddbfc5e2f0ee861fe29d7a594330b41abcb78a5 /src/qdoc/clangcodeparser.cpp
parentd1da1ab17ab72efa85f9543bcfc6c13aa3dec45a (diff)
downloadqttools-f395f1b47b7f9ebba66730e0518167944b0a47de.tar.gz
qdoc: Search for QML type before creating it
Because we have QML types that represent C++ classes, it is possible for qdoc to process a \qmlproperty command before it has processed the \qmltype for the QML type where the QML property belongs. This is because the \qmlproperty command can appear in a different .cpp file from the one containing the \qmltype command. If the .cpp file is parsed first, the QML type node won't exist when the \qmlproperty is processed, resulting in a qdoc error. This update forces qdoc to always check for the exist of the QML type before creating it and before creating any QML properties for it, and if the QML type does not exist, create it. If it does exist, use it. Change-Id: I78705aa95ee5bf3abc2e17fb2b6cd52191d54b68 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r--src/qdoc/clangcodeparser.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index 298669764..b8774b4a7 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -224,7 +224,7 @@ static Node *findNodeForCursor(QDocDatabase* qdb, CXCursor cur) {
return qdb->primaryTreeRoot();
Node *p = findNodeForCursor(qdb, clang_getCursorSemanticParent(cur));
- if (!p)
+ if (p == nullptr)
return nullptr;
if (!p->isAggregate())
return nullptr;
@@ -313,7 +313,7 @@ static Node *findFunctionNodeForCursor(QDocDatabase* qdb, CXCursor cur) {
return qdb->primaryTreeRoot();
Node *p = findNodeForCursor(qdb, clang_getCursorSemanticParent(cur));
- if (!p || !p->isAggregate())
+ if (p == nullptr || !p->isAggregate())
return nullptr;
auto parent = static_cast<Aggregate *>(p);
@@ -617,7 +617,7 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l
auto baseCursor = clang_getTypeDeclaration(type);
auto baseNode = findNodeForCursor(qdb_, baseCursor);
auto classe = static_cast<ClassNode*>(parent_);
- if (!baseNode || !baseNode->isClassNode()) {
+ if (baseNode == nullptr || !baseNode->isClassNode()) {
QString bcName = fromCXString(clang_getCursorSpelling(baseCursor));
classe->addUnresolvedBaseClass(access, QStringList(bcName), bcName);
return CXChildVisit_Continue;