summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2018-01-23 12:19:33 +0100
committerMartin Smith <martin.smith@qt.io>2018-01-24 10:02:08 +0000
commit4ca0d764546908dd31fc3794ddcead5582436097 (patch)
tree7a43605848c6355c9d563134d31ffb30e56b1174
parentf28d0d8ae83b7a9882c5f2d5c4a2e651bbe3597e (diff)
doc: clang-qdoc must not see certain function declarations
The macro Q_DECLARE_INTERFACE declared some qobject_cast() functions that clang-qdoc must not see in the contexts where the macro is used. This update prevents that from happening by ensuring that Q_CLANG_QDOC is not defined when the macro is defined. This update also adds a \fn command for a declaration of qobject_cast() that was missing in the documentation. There are two versions of the function, one with a const parameter and one with a non-const parameter, and they both share one qdoc comment. Change-Id: Ic74d0aaae62767cd0391474ee95ae3f4f820b06e Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--src/corelib/kernel/qobject.cpp4
-rw-r--r--src/corelib/kernel/qobject.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index dc43a95675..5b37945ae0 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1093,7 +1093,9 @@ QObjectPrivate::Connection::~Connection()
\sa metaObject()
*/
-/*! \fn template <class T> T *qobject_cast<T *>(QObject *object)
+/*!
+ \fn template <class T> T qobject_cast(QObject *object)
+ \fn template <class T> T qobject_cast(const QObject *object)
\relates QObject
Returns the given \a object cast to type T if the object is of type
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 9f38a6ef87..0e608a3208 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -517,7 +517,7 @@ inline T qobject_cast(const QObject *object)
template <class T> inline const char * qobject_interface_iid()
{ return nullptr; }
-#ifndef Q_MOC_RUN
+#if !defined(Q_MOC_RUN) && !defined(Q_CLANG_QDOC)
# define Q_DECLARE_INTERFACE(IFace, IId) \
template <> inline const char *qobject_interface_iid<IFace *>() \
{ return IId; } \