summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2022-04-06 11:58:48 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-04-07 22:29:09 +0000
commita31108213d24d71bdaf14ab351cc8c188b420b92 (patch)
tree8de7f783b5a518e5101d063f26a648318ffc4637
parent9a856489aa687f8056076bd3abb876b8e5205e61 (diff)
qdoc: Add warning for the location of duplicate-documented QML property
QDoc warned if a QML property was documented multiple times, but did not output the location of the previously seen doc entry. Display the previously seen comment location in warning details, and adjust similar warnings to the same format as they were previously emitting two warnings for a single problem. Fixes: QTBUG-102332 Change-Id: Ib5d05a378bb8120d5d5cfe34681c5d90ed71ddcf Reviewed-by: Luca Di Sera <luca.disera@qt.io> (cherry picked from commit 09dd127f67455dc88fc31300040102a99d3c5094) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qdoc/cppcodeparser.cpp8
-rw-r--r--src/qdoc/doc/qdoc-warnings.qdoc15
-rw-r--r--src/qdoc/node.cpp4
-rw-r--r--src/qdoc/qdocdatabase.cpp4
4 files changed, 16 insertions, 15 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 5314f3052..3aac57ceb 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -448,7 +448,8 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
if (!doc.body().isEmpty()) {
doc.startLocation().warning(
QStringLiteral("QML property documented multiple times: '%1'")
- .arg(arg));
+ .arg(arg), QStringLiteral("also seen here: %1")
+ .arg(existingProperty->location().toString()));
}
continue;
}
@@ -809,8 +810,9 @@ FunctionNode *CppCodeParser::parseMacroArg(const Location &location, const QStri
macro->setReturnType(returnType);
macro->setParameters(params);
if (macro->compare(oldMacroNode)) {
- location.warning(QStringLiteral("\\macro %1 documented more than once").arg(macroArg));
- oldMacroNode->doc().location().warning(QStringLiteral("(The previous doc is here)"));
+ location.warning(QStringLiteral("\\macro %1 documented more than once")
+ .arg(macroArg), QStringLiteral("also seen here: %1")
+ .arg(oldMacroNode->doc().location().toString()));
}
return macro;
}
diff --git a/src/qdoc/doc/qdoc-warnings.qdoc b/src/qdoc/doc/qdoc-warnings.qdoc
index e229f1042..1540a29a8 100644
--- a/src/qdoc/doc/qdoc-warnings.qdoc
+++ b/src/qdoc/doc/qdoc-warnings.qdoc
@@ -144,11 +144,11 @@
Very similar to \l {Cannot tie this documentation to anything}, but
specific to comments that are not in C++ or QML files.
- \section1 <name> documented more than once (The previous doc is here)
+ \section1 <name> documented more than once
QDoc issues this warning when it finds two comments that
- document the same item. The warning comes in two parts,
- one giving the later occurrence, the other the first.
+ document the same item. The location of the previously seen
+ comment is provided in warning details.
For example, you see this warning when a function has a documentation
comment preceding its definition, and a separate \\fn comment
@@ -718,12 +718,11 @@
Without them, QDoc cannot locate the index files of any dependencies
defined with the 'depends' configuration variable.
- \section1 Overrides a previous doc (The previous doc is here)
+ \section1 Overrides a previous doc
- When QDoc finds two comments that appear to describe the same
- entity, it issues this warning and tells you where to find the
- other comment. The warning comes in two parts, one giving the
- later occurrence, the other the first.
+ QDoc issues this warning when it finds two comments that appear to
+ describe the same entity. The location of the previously seen
+ comment is provided in warning details.
\section1 Unrecognized list style <name>
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 8c23009b0..eabf11ef9 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -673,8 +673,8 @@ bool Node::match(const QList<int> &types) const
void Node::setDoc(const Doc &doc, bool replace)
{
if (!m_doc.isEmpty() && !replace && !doc.isMarkedReimp()) {
- doc.location().warning(QStringLiteral("Overrides a previous doc"));
- m_doc.location().warning(QStringLiteral("(The previous doc is here)"));
+ doc.location().warning(QStringLiteral("Overrides a previous doc"),
+ QStringLiteral("from here: %1").arg(m_doc.location().toString()));
}
m_doc = doc;
}
diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp
index e5dbbf64c..c67f238b3 100644
--- a/src/qdoc/qdocdatabase.cpp
+++ b/src/qdoc/qdocdatabase.cpp
@@ -1120,8 +1120,8 @@ void QDocDatabase::resolveNamespaces()
if (nsNode->hadDoc() && nsNode != ns) {
ns->doc().location().warning(
QStringLiteral("Namespace %1 documented more than once")
- .arg(nsNode->name()));
- nsNode->doc().location().warning(QStringLiteral("...also seen here"));
+ .arg(nsNode->name()), QStringLiteral("also seen here: %1")
+ .arg(nsNode->doc().location().toString()));
}
}
} else if (!indexNamespace) {