diff options
author | Martin Smith <martin.smith@qt.io> | 2018-01-10 12:18:19 +0100 |
---|---|---|
committer | Martin Smith <martin.smith@qt.io> | 2018-01-12 10:59:41 +0000 |
commit | 0c10a2186e2413936cbd3c685c7d61427ec76559 (patch) | |
tree | 393b9bb65e354f8b0d598b86907bfa1685ea3a42 /src/qdoc/clangcodeparser.cpp | |
parent | fe2c46d86e4287580191fc71357ec776cf1f5dd8 (diff) | |
download | qttools-0c10a2186e2413936cbd3c685c7d61427ec76559.tar.gz |
qdoc: Disable clang errors when the class is internal
From time to time, we have classes added that are marked both
\internal and \preliminary in their \class comment. This was a
race condition that set the status of the class documentation
to either internal or preliminary depending on the order of the
\internal and \preliminary commands. But \preliminary should
only be used when the class is meant to be included in the public
API marked as preliminary, so users will understand that it might
be changed before it is stable. So this update lets \internal win
when both commands appear in the \class comment, regardless of
their order.
This update also prevents clang parsing errors from being reported
for \fn commands where the class containing the member function is
marked \internal. This eliminates a lot of qdoc warnings.
Change-Id: Id1ecec4bdd573ae81fa5d589dfdd4afc4b313825
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index bed70573d..1698b23d7 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1415,10 +1415,26 @@ Node* ClangCodeParser::parseFnArg(const Location& location, const QString& fnArg if (fnNode == 0) { unsigned diagnosticCount = clang_getNumDiagnostics(tu); if (diagnosticCount > 0) { - location.warning(ClangCodeParser::tr("clang found diagnostics parsing \\fn %1").arg(fnArg)); - for (unsigned i = 0; i < diagnosticCount; ++i) { - CXDiagnostic diagnostic = clang_getDiagnostic(tu, i); - location.report(tr(" %1").arg(fromCXString(clang_formatDiagnostic(diagnostic, 0)))); + bool report = true; + QStringList signature = fnArg.split(QLatin1String("::")); + if (signature.size() > 1) { + QStringList typeAndQualifier = signature.at(0).split(' '); + QString qualifier = typeAndQualifier.last(); + int i = 0; + while (qualifier.size() > i && !qualifier.at(i).isLetter()) + qualifier[i++] = QChar(' '); + if (i > 0) + qualifier = qualifier.simplified(); + ClassNode* cn = qdb_->findClassNode(QStringList(qualifier)); + if (cn && cn->isInternal()) + report = false; + } + if (report) { + location.warning(ClangCodeParser::tr("clang found diagnostics parsing \\fn %1").arg(fnArg)); + for (unsigned i = 0; i < diagnosticCount; ++i) { + CXDiagnostic diagnostic = clang_getDiagnostic(tu, i); + location.report(tr(" %1").arg(fromCXString(clang_formatDiagnostic(diagnostic, 0)))); + } } } } |