summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2019-04-05 10:10:25 +0200
committerMartin Smith <martin.smith@qt.io>2019-04-05 08:39:21 +0000
commit745bd6375a2e3351fb88e4afaad8cbb490859458 (patch)
tree0c8787f988dfcc551988e9dd53b8d1f90e340097
parentc7a953c6b4889d1a51ec10c7b90903eece5b01a7 (diff)
downloadqttools-745bd6375a2e3351fb88e4afaad8cbb490859458.tar.gz
qdoc: Don't report override error when reimp is used
qdoc was reporting an error when the reimplementation of a virtual function that was documented in the base class was given a qdoc comment in the derived class that only contained the \reimp command. When the reimp command is used, the error should not be reported. This change implements that. Change-Id: I6905e35b4e9c3df12617446c04eb9ea6d1804832 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--src/qdoc/doc.cpp9
-rw-r--r--src/qdoc/doc.h1
-rw-r--r--src/qdoc/node.cpp11
3 files changed, 16 insertions, 5 deletions
diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp
index e460b2865..b31125597 100644
--- a/src/qdoc/doc.cpp
+++ b/src/qdoc/doc.cpp
@@ -3087,6 +3087,15 @@ bool Doc::isInternal() const
}
/*!
+ Returns true if the set of metacommands used in the doc
+ comment contains \e {reimp}.
+ */
+bool Doc::isMarkedReimp() const
+{
+ return metaCommandsUsed().contains(QLatin1String("reimp"));
+}
+
+/*!
Returns a reference to the list of topic commands used in the
current qdoc comment. Normally there is only one, but there
can be multiple \e{qmlproperty} commands, for example.
diff --git a/src/qdoc/doc.h b/src/qdoc/doc.h
index 0c63cde7f..ee3221a2d 100644
--- a/src/qdoc/doc.h
+++ b/src/qdoc/doc.h
@@ -160,6 +160,7 @@ public:
bool hasKeywords() const;
bool hasTargets() const;
bool isInternal() const;
+ bool isMarkedReimp() const;
const QList<Atom *> &tableOfContents() const;
const QVector<int> &tableOfContentsLevels() const;
const QList<Atom *> &keywords() const;
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 630991db3..a771f180c 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -279,14 +279,15 @@ bool Node::match(const QList<int>& types) const
/*!
Sets this Node's Doc to \a doc. If \a replace is false and
- this Node already has a Doc, a warning is reported that the
- Doc is being overridden, and it reports where the previous
- Doc was found. If \a replace is true, the Doc is replaced
- silently.
+ this Node already has a Doc, and if this doc is not marked
+ with the \\reimp command, a warning is reported that the
+ existing Doc is being overridden, and it reports where the
+ previous Doc was found. If \a replace is true, the Doc is
+ replaced silently.
*/
void Node::setDoc(const Doc& doc, bool replace)
{
- if (!doc_.isEmpty() && !replace) {
+ if (!doc_.isEmpty() && !replace && !doc.isMarkedReimp()) {
doc.location().warning(tr("Overrides a previous doc"));
doc_.location().warning(tr("(The previous doc is here)"));
}