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 <martin.smith@qt.io>
This commit is contained in:
Martin Smith 2017-01-13 12:12:06 +01:00
parent d3af09fdb2
commit 4f9575ecbc
15 changed files with 129 additions and 139 deletions

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_QFUTURE
#if !defined(QT_NO_QFUTURE) || defined(Q_CLANG_QDOC)
#include <QtCore/qexception.h>
@ -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;

View File

@ -42,60 +42,13 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentfilterkernel.h>
#include <QtConcurrent/qtconcurrentfunctionwrappers.h>
QT_BEGIN_NAMESPACE
#ifdef Q_QDOC
namespace QtConcurrent {
QFuture<void> filter(Sequence &sequence, FilterFunction filterFunction);
template <typename T>
QFuture<T> filtered(const Sequence &sequence, FilterFunction filterFunction);
template <typename T>
QFuture<T> filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction);
template <typename T>
QFuture<T> filteredReduced(const Sequence &sequence,
FilterFunction filterFunction,
ReduceFunction reduceFunction,
QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce);
template <typename T>
QFuture<T> filteredReduced(ConstIterator begin,
ConstIterator end,
FilterFunction filterFunction,
ReduceFunction reduceFunction,
QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce);
void blockingFilter(Sequence &sequence, FilterFunction filterFunction);
template <typename Sequence>
Sequence blockingFiltered(const Sequence &sequence, FilterFunction filterFunction);
template <typename Sequence>
Sequence blockingFiltered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction);
template <typename T>
T blockingFilteredReduced(const Sequence &sequence,
FilterFunction filterFunction,
ReduceFunction reduceFunction,
QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce);
template <typename T>
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<ResultType> filteredReduced(const Sequence &sequence,
return startFilteredReduced<ResultType>(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options);
}
#ifndef Q_CLANG_QDOC
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor>
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filteredReduced(const Sequence &sequence,
KeepFunctor keep,
@ -135,6 +89,7 @@ QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filtere
QtPrivate::createFunctionWrapper(reduce),
options);
}
#endif
// filteredReduced() on iterators
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor>
@ -147,6 +102,7 @@ QFuture<ResultType> filteredReduced(Iterator begin,
return startFilteredReduced<ResultType>(begin, end, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options);
}
#ifndef Q_CLANG_QDOC
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor>
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filteredReduced(Iterator begin,
Iterator end,
@ -160,6 +116,7 @@ QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filtere
QtPrivate::createFunctionWrapper(reduce),
options);
}
#endif
// filtered() on sequences
template <typename Sequence, typename KeepFunctor>
@ -193,6 +150,7 @@ ResultType blockingFilteredReduced(const Sequence &sequence,
.startBlocking();
}
#ifndef Q_CLANG_QDOC
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor>
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFilteredReduced(const Sequence &sequence,
KeepFunctor keep,
@ -205,6 +163,7 @@ typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFiltered
QtPrivate::createFunctionWrapper(reduce),
options);
}
#endif
// blocking filteredReduced() on iterators
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor>
@ -222,6 +181,7 @@ ResultType blockingFilteredReduced(Iterator begin,
.startBlocking();
}
#ifndef Q_CLANG_QDOC
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor>
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFilteredReduced(Iterator begin,
Iterator end,
@ -236,6 +196,7 @@ typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFiltered
options)
.startBlocking();
}
#endif
// blocking filtered() on sequences
template <typename Sequence, typename KeepFunctor>
@ -256,8 +217,6 @@ OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor keep)
} // namespace QtConcurrent
#endif // Q_QDOC
QT_END_NAMESPACE
#endif // QT_NO_CONCURRENT

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined (Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentiteratekernel.h>
#include <QtConcurrent/qtconcurrentmapkernel.h>
@ -51,7 +51,6 @@
QT_BEGIN_NAMESPACE
#ifndef Q_QDOC
namespace QtConcurrent {
@ -341,7 +340,6 @@ inline ThreadEngineStarter<ResultType> startFilteredReduced(Iterator begin, Iter
} // namespace QtConcurrent
#endif // Q_QDOC
QT_END_NAMESPACE

View File

@ -43,13 +43,10 @@
#include <QtConcurrent/qtconcurrentcompilertest.h>
#include <QtCore/QStringList>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
QT_BEGIN_NAMESPACE
#ifndef Q_QDOC
namespace QtConcurrent {
template <typename T>
@ -375,7 +372,6 @@ struct MapResultType<QStringList, U(C::*)() const noexcept>
} // namespace QtPrivate.
#endif //Q_QDOC
QT_END_NAMESPACE

View File

@ -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
*/

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtCore/qatomic.h>
#include <QtConcurrent/qtconcurrentmedian.h>
@ -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

View File

@ -386,8 +386,8 @@
/*!
\fn template <typename OutputSequence, typename InputSequence, typename MapFunctor> 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
*/

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentmapkernel.h>
#include <QtConcurrent/qtconcurrentreducekernel.h>
@ -52,53 +52,6 @@
QT_BEGIN_NAMESPACE
#ifdef Q_QDOC
namespace QtConcurrent {
QFuture<void> map(Sequence &sequence, MapFunction function);
QFuture<void> map(Iterator begin, Iterator end, MapFunction function);
template <typename T>
QFuture<T> mapped(const Sequence &sequence, MapFunction function);
template <typename T>
QFuture<T> mapped(ConstIterator begin, ConstIterator end, MapFunction function);
template <typename T>
QFuture<T> mappedReduced(const Sequence &sequence,
MapFunction function,
ReduceFunction function,
QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce);
template <typename T>
QFuture<T> 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 <typename T>
T blockingMapped(const Sequence &sequence, MapFunction function);
template <typename T>
T blockingMapped(ConstIterator begin, ConstIterator end, MapFunction function);
template <typename T>
T blockingMappedReduced(const Sequence &sequence,
MapFunction function,
ReduceFunction function,
QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce);
template <typename T>
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<Iterator, MapFunctor>::ResultType blockingMapp
} // namespace QtConcurrent
#endif // Q_QDOC
QT_END_NAMESPACE

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined (Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentiteratekernel.h>
#include <QtConcurrent/qtconcurrentreducekernel.h>
@ -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<ResultType> startMappedReduced(Iterator begin, Iterat
} // namespace QtConcurrent
#endif //Q_QDOC
QT_END_NAMESPACE

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) ||defined(Q_CLANG_QDOC)
#include <QtCore/qvector.h>
@ -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

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtCore/qatomic.h>
#include <QtCore/qlist.h>
@ -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<T> 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 <typename ReduceFunctor, typename ReduceResultType, typename T>
class ReduceKernel
@ -239,8 +241,6 @@ struct SequenceHolder2 : public Base
}
};
#endif //Q_QDOC
} // namespace QtConcurrent
QT_END_NAMESPACE

View File

@ -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<T> QtConcurrent::run(Function function, ...);

View File

@ -43,15 +43,16 @@
#include <QtConcurrent/qtconcurrentcompilertest.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentrunbase.h>
#include <QtConcurrent/qtconcurrentstoredfunctioncall.h>
QT_BEGIN_NAMESPACE
#ifdef Q_CLANG_QDOC
#ifdef Q_QDOC
typedef int Function;
namespace QtConcurrent {
@ -919,7 +920,7 @@ QFuture<T> run(QThreadPool *pool, const Class *object, T (Class::*fn)(Param1, Pa
} //namespace QtConcurrent
#endif // Q_QDOC
#endif // Q_CLANG_QDOC
QT_END_NAMESPACE

View File

@ -39,7 +39,7 @@
#include "qtconcurrentthreadengine.h"
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
QT_BEGIN_NAMESPACE

View File

@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
#ifndef QT_NO_CONCURRENT
#if !defined(QT_NO_CONCURRENT) ||defined(Q_CLANG_QDOC)
#include <QtCore/qthreadpool.h>
#include <QtCore/qfuture.h>
@ -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<typename ThreadEngine::ResultType> startThreadEngine(
} // namespace QtConcurrent
#endif //Q_QDOC
QT_END_NAMESPACE