QFuture: fix headercheck warning with Clang 17: member shadowing
Pretty sure this is a Clang bug because the promise member that it says is getting shadowed shouldn't be in scope (`this` isn't being captured). qfuture_impl.h:538:60: error: declaration shadows a field of 'Continuation<Function, ResultType, ParentResultType>' [-Werror,-Wshadow] qfuture_impl.h:327:26: note: previous declaration is here Pick-to: 6.5 Change-Id: Ifeb6206a9fa04424964bfffd17883e21cfec6d8e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit bf7732baca43537b11ba8989d7e68fa9a9a6696d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
500b747bb9
commit
01bc132083
@ -535,18 +535,18 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func,
|
|||||||
|
|
||||||
fi.setLaunchAsync(launchAsync);
|
fi.setLaunchAsync(launchAsync);
|
||||||
|
|
||||||
auto continuation = [func = std::forward<F>(func), fi, promise = QPromise(fi), pool,
|
auto continuation = [func = std::forward<F>(func), fi, promise_ = QPromise(fi), pool,
|
||||||
launchAsync](const QFutureInterfaceBase &parentData) mutable {
|
launchAsync](const QFutureInterfaceBase &parentData) mutable {
|
||||||
const auto parent = QFutureInterface<ParentResultType>(parentData).future();
|
const auto parent = QFutureInterface<ParentResultType>(parentData).future();
|
||||||
Continuation<Function, ResultType, ParentResultType> *continuationJob = nullptr;
|
Continuation<Function, ResultType, ParentResultType> *continuationJob = nullptr;
|
||||||
if (launchAsync) {
|
if (launchAsync) {
|
||||||
auto asyncJob = new AsyncContinuation<Function, ResultType, ParentResultType>(
|
auto asyncJob = new AsyncContinuation<Function, ResultType, ParentResultType>(
|
||||||
std::forward<Function>(func), parent, std::move(promise), pool);
|
std::forward<Function>(func), parent, std::move(promise_), pool);
|
||||||
fi.setRunnable(asyncJob);
|
fi.setRunnable(asyncJob);
|
||||||
continuationJob = asyncJob;
|
continuationJob = asyncJob;
|
||||||
} else {
|
} else {
|
||||||
continuationJob = new SyncContinuation<Function, ResultType, ParentResultType>(
|
continuationJob = new SyncContinuation<Function, ResultType, ParentResultType>(
|
||||||
std::forward<Function>(func), parent, std::move(promise));
|
std::forward<Function>(func), parent, std::move(promise_));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isLaunched = continuationJob->execute();
|
bool isLaunched = continuationJob->execute();
|
||||||
@ -573,11 +573,11 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func,
|
|||||||
fi.setLaunchAsync(true);
|
fi.setLaunchAsync(true);
|
||||||
fi.setThreadPool(pool);
|
fi.setThreadPool(pool);
|
||||||
|
|
||||||
auto continuation = [func = std::forward<F>(func), promise = QPromise(fi),
|
auto continuation = [func = std::forward<F>(func), promise_ = QPromise(fi),
|
||||||
pool](const QFutureInterfaceBase &parentData) mutable {
|
pool](const QFutureInterfaceBase &parentData) mutable {
|
||||||
const auto parent = QFutureInterface<ParentResultType>(parentData).future();
|
const auto parent = QFutureInterface<ParentResultType>(parentData).future();
|
||||||
auto continuationJob = new AsyncContinuation<Function, ResultType, ParentResultType>(
|
auto continuationJob = new AsyncContinuation<Function, ResultType, ParentResultType>(
|
||||||
std::forward<Function>(func), parent, std::move(promise), pool);
|
std::forward<Function>(func), parent, std::move(promise_), pool);
|
||||||
bool isLaunched = continuationJob->execute();
|
bool isLaunched = continuationJob->execute();
|
||||||
// If continuation is successfully launched, AsyncContinuation will be deleted
|
// If continuation is successfully launched, AsyncContinuation will be deleted
|
||||||
// by the QThreadPool which has started it.
|
// by the QThreadPool which has started it.
|
||||||
@ -615,9 +615,9 @@ void Continuation<Function, ResultType, ParentResultType>::create(F &&func,
|
|||||||
// continuation callback is destroyed. The promise that is created in the capture list is
|
// continuation callback is destroyed. The promise that is created in the capture list is
|
||||||
// destroyed and, if it is not yet finished, cancelled.
|
// destroyed and, if it is not yet finished, cancelled.
|
||||||
auto continuation = [func = std::forward<F>(func), parent = *f,
|
auto continuation = [func = std::forward<F>(func), parent = *f,
|
||||||
promise = QPromise(fi)]() mutable {
|
promise_ = QPromise(fi)]() mutable {
|
||||||
SyncContinuation<Function, ResultType, ParentResultType> continuationJob(
|
SyncContinuation<Function, ResultType, ParentResultType> continuationJob(
|
||||||
std::forward<Function>(func), parent, std::move(promise));
|
std::forward<Function>(func), parent, std::move(promise_));
|
||||||
continuationJob.execute();
|
continuationJob.execute();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -687,11 +687,11 @@ void FailureHandler<Function, ResultType>::create(F &&function, QFuture<ResultTy
|
|||||||
{
|
{
|
||||||
Q_ASSERT(future);
|
Q_ASSERT(future);
|
||||||
|
|
||||||
auto failureContinuation = [function = std::forward<F>(function), promise = QPromise(fi)](
|
auto failureContinuation = [function = std::forward<F>(function), promise_ = QPromise(fi)](
|
||||||
const QFutureInterfaceBase &parentData) mutable {
|
const QFutureInterfaceBase &parentData) mutable {
|
||||||
const auto parent = QFutureInterface<ResultType>(parentData).future();
|
const auto parent = QFutureInterface<ResultType>(parentData).future();
|
||||||
FailureHandler<Function, ResultType> failureHandler(std::forward<Function>(function),
|
FailureHandler<Function, ResultType> failureHandler(std::forward<Function>(function),
|
||||||
parent, std::move(promise));
|
parent, std::move(promise_));
|
||||||
failureHandler.run();
|
failureHandler.run();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -707,9 +707,9 @@ void FailureHandler<Function, ResultType>::create(F &&function, QFuture<ResultTy
|
|||||||
Q_ASSERT(future);
|
Q_ASSERT(future);
|
||||||
Q_ASSERT(context);
|
Q_ASSERT(context);
|
||||||
auto failureContinuation = [function = std::forward<F>(function),
|
auto failureContinuation = [function = std::forward<F>(function),
|
||||||
parent = *future, promise = QPromise(fi)]() mutable {
|
parent = *future, promise_ = QPromise(fi)]() mutable {
|
||||||
FailureHandler<Function, ResultType> failureHandler(
|
FailureHandler<Function, ResultType> failureHandler(
|
||||||
std::forward<Function>(function), parent, std::move(promise));
|
std::forward<Function>(function), parent, std::move(promise_));
|
||||||
failureHandler.run();
|
failureHandler.run();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user