From 4f9575ecbcfd40252b9ad28092e815efe9e824da Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 13 Jan 2017 12:12:06 +0100 Subject: doc: Fix all qdoc errors in QtConcurrent These errors resulted from the improved parsing provided by clang, which required rethinking which elements of the QtConcurrent API should be visible to clangqdoc. The basic problem is that clang must see declarations for all types used by a type, or else it either gets lost and fails to parse a type correctly, or it simply refuses to include the type in its AST. Change-Id: Iaa699c287e67d1288fcb2d83a9dbbaf07521d0cc Reviewed-by: Martin Smith --- src/concurrent/qtconcurrentexception.h | 4 +- src/concurrent/qtconcurrentfilter.h | 59 ++++----------------------- src/concurrent/qtconcurrentfilterkernel.h | 4 +- src/concurrent/qtconcurrentfunctionwrappers.h | 6 +-- src/concurrent/qtconcurrentiteratekernel.cpp | 50 ++++++++++++++++++++++- src/concurrent/qtconcurrentiteratekernel.h | 4 +- src/concurrent/qtconcurrentmap.cpp | 40 +++++++++++++++++- src/concurrent/qtconcurrentmap.h | 50 +---------------------- src/concurrent/qtconcurrentmapkernel.h | 4 +- src/concurrent/qtconcurrentmedian.h | 4 +- src/concurrent/qtconcurrentreducekernel.h | 20 ++++----- src/concurrent/qtconcurrentrun.cpp | 9 ++++ src/concurrent/qtconcurrentrun.h | 7 ++-- src/concurrent/qtconcurrentthreadengine.cpp | 2 +- src/concurrent/qtconcurrentthreadengine.h | 5 +-- 15 files changed, 129 insertions(+), 139 deletions(-) (limited to 'src/concurrent') diff --git a/src/concurrent/qtconcurrentexception.h b/src/concurrent/qtconcurrentexception.h index 03dd7ec498..3ed4ac2cf5 100644 --- a/src/concurrent/qtconcurrentexception.h +++ b/src/concurrent/qtconcurrentexception.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_QFUTURE +#if !defined(QT_NO_QFUTURE) || defined(Q_CLANG_QDOC) #include @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE namespace QtConcurrent { -#ifndef QT_NO_EXCEPTIONS +#if !defined(QT_NO_EXCEPTIONS) || defined(Q_CLANG_QDOC) typedef Q_DECL_DEPRECATED QException Exception; typedef Q_DECL_DEPRECATED QUnhandledException UnhandledException; diff --git a/src/concurrent/qtconcurrentfilter.h b/src/concurrent/qtconcurrentfilter.h index 5f4148091e..acc794fad8 100644 --- a/src/concurrent/qtconcurrentfilter.h +++ b/src/concurrent/qtconcurrentfilter.h @@ -42,60 +42,13 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) #include #include QT_BEGIN_NAMESPACE - -#ifdef Q_QDOC - -namespace QtConcurrent { - - QFuture filter(Sequence &sequence, FilterFunction filterFunction); - - template - QFuture filtered(const Sequence &sequence, FilterFunction filterFunction); - template - QFuture filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction); - - template - QFuture filteredReduced(const Sequence &sequence, - FilterFunction filterFunction, - ReduceFunction reduceFunction, - QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); - template - QFuture filteredReduced(ConstIterator begin, - ConstIterator end, - FilterFunction filterFunction, - ReduceFunction reduceFunction, - QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); - - void blockingFilter(Sequence &sequence, FilterFunction filterFunction); - - template - Sequence blockingFiltered(const Sequence &sequence, FilterFunction filterFunction); - template - Sequence blockingFiltered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction); - - template - T blockingFilteredReduced(const Sequence &sequence, - FilterFunction filterFunction, - ReduceFunction reduceFunction, - QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); - template - T blockingFilteredReduced(ConstIterator begin, - ConstIterator end, - FilterFunction filterFunction, - ReduceFunction reduceFunction, - QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce); - -} // namespace QtConcurrent - -#else - namespace QtConcurrent { //! [QtConcurrent-1] @@ -123,6 +76,7 @@ QFuture filteredReduced(const Sequence &sequence, return startFilteredReduced(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options); } +#ifndef Q_CLANG_QDOC template QFuture::ResultType> filteredReduced(const Sequence &sequence, KeepFunctor keep, @@ -135,6 +89,7 @@ QFuture::ResultType> filtere QtPrivate::createFunctionWrapper(reduce), options); } +#endif // filteredReduced() on iterators template @@ -147,6 +102,7 @@ QFuture filteredReduced(Iterator begin, return startFilteredReduced(begin, end, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options); } +#ifndef Q_CLANG_QDOC template QFuture::ResultType> filteredReduced(Iterator begin, Iterator end, @@ -160,6 +116,7 @@ QFuture::ResultType> filtere QtPrivate::createFunctionWrapper(reduce), options); } +#endif // filtered() on sequences template @@ -193,6 +150,7 @@ ResultType blockingFilteredReduced(const Sequence &sequence, .startBlocking(); } +#ifndef Q_CLANG_QDOC template typename QtPrivate::ReduceResultType::ResultType blockingFilteredReduced(const Sequence &sequence, KeepFunctor keep, @@ -205,6 +163,7 @@ typename QtPrivate::ReduceResultType::ResultType blockingFiltered QtPrivate::createFunctionWrapper(reduce), options); } +#endif // blocking filteredReduced() on iterators template @@ -222,6 +181,7 @@ ResultType blockingFilteredReduced(Iterator begin, .startBlocking(); } +#ifndef Q_CLANG_QDOC template typename QtPrivate::ReduceResultType::ResultType blockingFilteredReduced(Iterator begin, Iterator end, @@ -236,6 +196,7 @@ typename QtPrivate::ReduceResultType::ResultType blockingFiltered options) .startBlocking(); } +#endif // blocking filtered() on sequences template @@ -256,8 +217,6 @@ OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor keep) } // namespace QtConcurrent -#endif // Q_QDOC - QT_END_NAMESPACE #endif // QT_NO_CONCURRENT diff --git a/src/concurrent/qtconcurrentfilterkernel.h b/src/concurrent/qtconcurrentfilterkernel.h index 4500bd4f8a..4ef5ac0cee 100644 --- a/src/concurrent/qtconcurrentfilterkernel.h +++ b/src/concurrent/qtconcurrentfilterkernel.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined (Q_CLANG_QDOC) #include #include @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE -#ifndef Q_QDOC namespace QtConcurrent { @@ -341,7 +340,6 @@ inline ThreadEngineStarter startFilteredReduced(Iterator begin, Iter } // namespace QtConcurrent -#endif // Q_QDOC QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentfunctionwrappers.h b/src/concurrent/qtconcurrentfunctionwrappers.h index 111933410b..0f9eb46999 100644 --- a/src/concurrent/qtconcurrentfunctionwrappers.h +++ b/src/concurrent/qtconcurrentfunctionwrappers.h @@ -43,13 +43,10 @@ #include #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) QT_BEGIN_NAMESPACE - -#ifndef Q_QDOC - namespace QtConcurrent { template @@ -375,7 +372,6 @@ struct MapResultType } // namespace QtPrivate. -#endif //Q_QDOC QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentiteratekernel.cpp b/src/concurrent/qtconcurrentiteratekernel.cpp index 52218f794b..11bdb7e8cd 100644 --- a/src/concurrent/qtconcurrentiteratekernel.cpp +++ b/src/concurrent/qtconcurrentiteratekernel.cpp @@ -43,7 +43,7 @@ #include "private/qfunctions_p.h" -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) QT_BEGIN_NAMESPACE @@ -64,6 +64,54 @@ static double elapsed(qint64 after, qint64 before) namespace QtConcurrent { +/*! + \class QtConcurrent::Median + \inmodule QtConcurrent + \internal + */ + +/*! + \class QtConcurrent::MedianDouble + \inmodule QtConcurrent + \internal + */ + +/*! + \class QtConcurrent::BlockSizeManager + \inmodule QtConcurrent + \internal + */ + +/*! + \class QtConcurrent::BlockSizeManagerV2 + \inmodule QtConcurrent + \internal + */ + +/*! + \class QtConcurrent::ResultReporter + \inmodule QtConcurrent + \internal + */ + +/*! \fn bool QtConcurrent::selectIteration(std::bidirectional_iterator_tag) + \internal + */ + +/*! \fn bool QtConcurrent::selectIteration(std::forward_iterator_tag) + \internal + */ + +/*! \fn bool QtConcurrent::selectIteration(std::random_access_iterator_tag) + \internal + */ + +/*! + \class QtConcurrent::IterateKernel + \inmodule QtConcurrent + \internal + */ + /*! \internal */ diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h index 082fa9e838..b543833776 100644 --- a/src/concurrent/qtconcurrentiteratekernel.h +++ b/src/concurrent/qtconcurrentiteratekernel.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) #include #include @@ -53,7 +53,6 @@ QT_BEGIN_NAMESPACE -#ifndef Q_QDOC namespace QtConcurrent { @@ -323,7 +322,6 @@ public: } // namespace QtConcurrent -#endif //Q_QDOC QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index 9c01b65611..a8f1d6496e 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -386,8 +386,8 @@ /*! \fn template OutputSequence QtConcurrent::blockingMapped(const InputSequence &sequence, MapFunctor function) - Calls \a function once for each item in \a sequence and returns a Sequence containing - the results. The type of the results will match the type returned my the MapFunction. + Calls \a function once for each item in \a sequence and returns an OutputSequence containing + the results. The type of the results will match the type returned my the MapFunctor. \note This function will block until all items in the sequence have been processed. @@ -441,3 +441,39 @@ \sa blockingMappedReduced(), {Concurrent Map and Map-Reduce} */ + +/*! + \class QtConcurrent::FunctionWrapper0 + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::FunctionWrapper1 + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::FunctionWrapper2 + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::MemberFunctionWrapper + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::MemberFunctionWrapper1 + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::ConstMemberFunctionWrapper + \inmodule QtConcurrent + \internal +*/ diff --git a/src/concurrent/qtconcurrentmap.h b/src/concurrent/qtconcurrentmap.h index f8acf31f1d..ed1f7cedd1 100644 --- a/src/concurrent/qtconcurrentmap.h +++ b/src/concurrent/qtconcurrentmap.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) #include #include @@ -52,53 +52,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_QDOC - -namespace QtConcurrent { - - QFuture map(Sequence &sequence, MapFunction function); - QFuture map(Iterator begin, Iterator end, MapFunction function); - - template - QFuture mapped(const Sequence &sequence, MapFunction function); - template - QFuture mapped(ConstIterator begin, ConstIterator end, MapFunction function); - - template - QFuture mappedReduced(const Sequence &sequence, - MapFunction function, - ReduceFunction function, - QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); - template - QFuture mappedReduced(ConstIterator begin, - ConstIterator end, - MapFunction function, - ReduceFunction function, - QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); - - void blockingMap(Sequence &sequence, MapFunction function); - void blockingMap(Iterator begin, Iterator end, MapFunction function); - - template - T blockingMapped(const Sequence &sequence, MapFunction function); - template - T blockingMapped(ConstIterator begin, ConstIterator end, MapFunction function); - - template - T blockingMappedReduced(const Sequence &sequence, - MapFunction function, - ReduceFunction function, - QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); - template - T blockingMappedReduced(ConstIterator begin, - ConstIterator end, - MapFunction function, - ReduceFunction function, - QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce); - -} // namespace QtConcurrent - -#else namespace QtConcurrent { @@ -306,7 +259,6 @@ typename QtPrivate::MapResultType::ResultType blockingMapp } // namespace QtConcurrent -#endif // Q_QDOC QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentmapkernel.h b/src/concurrent/qtconcurrentmapkernel.h index 26e755c819..e8df668791 100644 --- a/src/concurrent/qtconcurrentmapkernel.h +++ b/src/concurrent/qtconcurrentmapkernel.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined (Q_CLANG_QDOC) #include #include @@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE -#ifndef Q_QDOC namespace QtConcurrent { // map kernel, works with both parallel-for and parallel-while @@ -264,7 +263,6 @@ inline ThreadEngineStarter startMappedReduced(Iterator begin, Iterat } // namespace QtConcurrent -#endif //Q_QDOC QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h index d0f832812c..87e6b2935d 100644 --- a/src/concurrent/qtconcurrentmedian.h +++ b/src/concurrent/qtconcurrentmedian.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) ||defined(Q_CLANG_QDOC) #include @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE -#ifndef Q_QDOC namespace QtConcurrent { @@ -195,7 +194,6 @@ private: } // namespace QtConcurrent -#endif //Q_QDOC QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentreducekernel.h b/src/concurrent/qtconcurrentreducekernel.h index c5003a2a0e..d1a283eb53 100644 --- a/src/concurrent/qtconcurrentreducekernel.h +++ b/src/concurrent/qtconcurrentreducekernel.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) #include #include @@ -57,8 +57,6 @@ QT_BEGIN_NAMESPACE namespace QtConcurrent { -#ifndef Q_QDOC - /* The ReduceQueueStartLimit and ReduceQueueThrottleLimit constants limit the reduce queue size for MapReduce. When the number of @@ -66,10 +64,17 @@ namespace QtConcurrent { MapReduce won't start any new threads, and when it exceeds ReduceQueueThrottleLimit running threads will be stopped. */ +#ifdef Q_CLANG_QDOC +enum ReduceQueueLimits { + ReduceQueueStartLimit = 20, + ReduceQueueThrottleLimit = 30 +}; +#else enum { ReduceQueueStartLimit = 20, ReduceQueueThrottleLimit = 30 }; +#endif // IntermediateResults holds a block of intermediate results from a // map or filter functor. The begin/end offsets indicates the origin @@ -82,8 +87,6 @@ public: QVector vector; }; -#endif // Q_QDOC - enum ReduceOption { UnorderedReduce = 0x1, OrderedReduce = 0x2, @@ -91,10 +94,9 @@ enum ReduceOption { // ParallelReduce = 0x8 }; Q_DECLARE_FLAGS(ReduceOptions, ReduceOption) +#ifndef Q_CLANG_QDOC Q_DECLARE_OPERATORS_FOR_FLAGS(ReduceOptions) - -#ifndef Q_QDOC - +#endif // supports both ordered and out-of-order reduction template class ReduceKernel @@ -239,8 +241,6 @@ struct SequenceHolder2 : public Base } }; -#endif //Q_QDOC - } // namespace QtConcurrent QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp index 1d8f7afe85..e2e3b3f3af 100644 --- a/src/concurrent/qtconcurrentrun.cpp +++ b/src/concurrent/qtconcurrentrun.cpp @@ -114,6 +114,15 @@ \snippet code/src_concurrent_qtconcurrentrun.cpp 6 */ +/*! + \typedef Function + \internal + + This typedef is a dummy required to make the \c Function + type name known so that clang doesn't reject functions + that use it. +*/ + /*! \fn QFuture QtConcurrent::run(Function function, ...); diff --git a/src/concurrent/qtconcurrentrun.h b/src/concurrent/qtconcurrentrun.h index c0c0e66913..7963294ebf 100644 --- a/src/concurrent/qtconcurrentrun.h +++ b/src/concurrent/qtconcurrentrun.h @@ -43,15 +43,16 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) #include #include QT_BEGIN_NAMESPACE +#ifdef Q_CLANG_QDOC -#ifdef Q_QDOC +typedef int Function; namespace QtConcurrent { @@ -919,7 +920,7 @@ QFuture run(QThreadPool *pool, const Class *object, T (Class::*fn)(Param1, Pa } //namespace QtConcurrent -#endif // Q_QDOC +#endif // Q_CLANG_QDOC QT_END_NAMESPACE diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index 2e27e0e83c..8d6bd0efb2 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -39,7 +39,7 @@ #include "qtconcurrentthreadengine.h" -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) QT_BEGIN_NAMESPACE diff --git a/src/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h index 0941f559f2..69e42018e6 100644 --- a/src/concurrent/qtconcurrentthreadengine.h +++ b/src/concurrent/qtconcurrentthreadengine.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_CONCURRENT +#if !defined(QT_NO_CONCURRENT) ||defined(Q_CLANG_QDOC) #include #include @@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE -#ifndef Q_QDOC - namespace QtConcurrent { // The ThreadEngineBarrier counts worker threads, and allows one @@ -268,7 +266,6 @@ inline ThreadEngineStarter startThreadEngine( } // namespace QtConcurrent -#endif //Q_QDOC QT_END_NAMESPACE -- cgit v1.2.3