Skip to content

Commit dae4a93

Browse files
committed
clang-format
1 parent 348c2c5 commit dae4a93

File tree

9 files changed

+89
-80
lines changed

9 files changed

+89
-80
lines changed

llvm/include/llvm/ExecutionEngine/Orc/Core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#include "llvm/Support/Debug.h"
3131
#include "llvm/Support/ExtensibleRTTI.h"
3232

33+
#include "llvm/ExecutionEngine/Orc/TaskDispatch.h"
3334
#include <atomic>
3435
#include <deque>
35-
#include "llvm/ExecutionEngine/Orc/TaskDispatch.h"
3636
#include <memory>
3737
#include <vector>
3838

llvm/include/llvm/ExecutionEngine/Orc/DylibManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class UnsupportedExecutorProcessControl : public DylibManager,
125125
}
126126
};
127127

128-
129128
/// A ExecutorProcessControl implementation targeting the current process.
130129
class LLVM_ABI SelfExecutorProcessControl : public DylibManager,
131130
private InProcessMemoryAccess {

llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ class LLVM_ABI ExecutorProcessControl {
404404
class LLVM_ABI InProcessMemoryAccess
405405
: public ExecutorProcessControl::MemoryAccess {
406406
public:
407-
InProcessMemoryAccess(ExecutorProcessControl &EPC, bool IsArch64Bit)
407+
InProcessMemoryAccess(ExecutorProcessControl &EPC, bool IsArch64Bit)
408408
: MemoryAccess(EPC), IsArch64Bit(IsArch64Bit) {}
409409
void writeUInt8sAsync(ArrayRef<tpctypes::UInt8Write> Ws,
410410
WriteResultFn OnWriteComplete) override;

llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ template <typename ORCABI> class LocalTrampolinePool : public TrampolinePool {
133133
return LandingAddressF.get(TrampolinePool->D).getValue();
134134
}
135135

136-
LocalTrampolinePool(ResolveLandingFunction ResolveLanding, TaskDispatcher &D, Error &Err)
136+
LocalTrampolinePool(ResolveLandingFunction ResolveLanding, TaskDispatcher &D,
137+
Error &Err)
137138
: ResolveLanding(std::move(ResolveLanding)), D(D) {
138139

139140
ErrorAsOutParameter _(Err);
@@ -269,7 +270,8 @@ class LocalJITCompileCallbackManager : public JITCompileCallbackManager {
269270
[this](ExecutorAddr TrampolineAddr,
270271
NotifyLandingResolvedFunction NotifyLandingResolved) {
271272
NotifyLandingResolved(executeCompileCallback(TrampolineAddr));
272-
}, ES.getExecutorProcessControl().getDispatcher());
273+
},
274+
ES.getExecutorProcessControl().getDispatcher());
273275

274276
if (!TP) {
275277
Err = TP.takeError();

llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ class LazyCallThroughManager {
5656
ExecutorAddr TrampolineAddr,
5757
TrampolinePool::NotifyLandingResolvedFunction NotifyLandingResolved);
5858

59-
TaskDispatcher& getDispatcher() { return ES.getExecutorProcessControl().getDispatcher(); }
59+
TaskDispatcher &getDispatcher() {
60+
return ES.getExecutorProcessControl().getDispatcher();
61+
}
6062

6163
virtual ~LazyCallThroughManager() = default;
6264

@@ -104,7 +106,8 @@ class LocalLazyCallThroughManager : public LazyCallThroughManager {
104106
NotifyLandingResolved) {
105107
resolveTrampolineLandingAddress(TrampolineAddr,
106108
std::move(NotifyLandingResolved));
107-
}, getDispatcher());
109+
},
110+
getDispatcher());
108111

109112
if (!TP)
110113
return TP.takeError();

llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
2222
#include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorBootstrapService.h"
2323
#include "llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.h"
24-
#include <future>
2524
#include "llvm/Support/Compiler.h"
2625
#include "llvm/Support/DynamicLibrary.h"
2726
#include "llvm/Support/Error.h"
27+
#include <future>
2828

2929
#include <condition_variable>
3030
#include <memory>

llvm/include/llvm/ExecutionEngine/Orc/TaskDispatch.h

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "llvm/Config/llvm-config.h"
1717
#include "llvm/Support/Compiler.h"
1818
#include "llvm/Support/Debug.h"
19-
#include "llvm/Support/ExtensibleRTTI.h"
2019
#include "llvm/Support/ErrorHandling.h"
20+
#include "llvm/Support/ExtensibleRTTI.h"
2121
#include "llvm/Support/raw_ostream.h"
2222

2323
#include <atomic>
@@ -122,23 +122,23 @@ class LLVM_ABI TaskDispatcher {
122122
virtual void shutdown() = 0;
123123

124124
/// Work on dispatched tasks until the given future is ready.
125-
virtual void work_until(future_base& F) = 0;
125+
virtual void work_until(future_base &F) = 0;
126126
};
127127

128128
/// Runs all tasks on the current thread.
129129
class LLVM_ABI InPlaceTaskDispatcher : public TaskDispatcher {
130130
public:
131131
void dispatch(std::unique_ptr<Task> T) override;
132132
void shutdown() override;
133-
void work_until(future_base& F) override;
133+
void work_until(future_base &F) override;
134134

135135
private:
136136
thread_local static SmallVector<std::unique_ptr<Task>> TaskQueue;
137-
137+
138138
#if LLVM_ENABLE_THREADS
139139
std::mutex DispatchMutex;
140140
std::condition_variable WorkFinishedCV;
141-
SmallVector<future_base*> WaitingFutures;
141+
SmallVector<future_base *> WaitingFutures;
142142
#endif
143143
};
144144

@@ -152,7 +152,8 @@ class LLVM_ABI DynamicThreadPoolTaskDispatcher : public TaskDispatcher {
152152

153153
void dispatch(std::unique_ptr<Task> T) override;
154154
void shutdown() override;
155-
void work_until(future_base& F) override;
155+
void work_until(future_base &F) override;
156+
156157
private:
157158
bool canRunMaterializationTaskNow();
158159
bool canRunIdleTaskNow();
@@ -171,26 +172,24 @@ class LLVM_ABI DynamicThreadPoolTaskDispatcher : public TaskDispatcher {
171172
#endif // LLVM_ENABLE_THREADS
172173

173174
/// Status for future/promise state
174-
enum class FutureStatus : uint8_t {
175-
NotReady = 0,
176-
Ready = 1,
177-
NotValid = 2
178-
};
175+
enum class FutureStatus : uint8_t { NotReady = 0, Ready = 1, NotValid = 2 };
179176

180177
/// Type-erased base class for futures
181178
class future_base {
182179
public:
183180
bool is_ready() const {
184-
return state_->status_.load(std::memory_order_acquire) != FutureStatus::NotReady;
181+
return state_->status_.load(std::memory_order_acquire) !=
182+
FutureStatus::NotReady;
185183
}
186184

187185
/// Check if the future is in a valid state (not moved-from and not consumed)
188186
bool valid() const {
189-
return state_ && state_->status_.load(std::memory_order_acquire) != FutureStatus::NotValid;
187+
return state_ && state_->status_.load(std::memory_order_acquire) !=
188+
FutureStatus::NotValid;
190189
}
191190

192191
/// Wait for the future to be ready, helping with task dispatch
193-
void wait(TaskDispatcher& D) {
192+
void wait(TaskDispatcher &D) {
194193
// Keep helping with task dispatch until our future is ready
195194
if (!is_ready())
196195
D.work_until(*this);
@@ -202,19 +201,19 @@ class future_base {
202201
std::atomic<FutureStatus> status_{FutureStatus::NotReady};
203202
};
204203

205-
future_base(state_base* state) : state_(state) {}
204+
future_base(state_base *state) : state_(state) {}
206205
future_base() = default;
207-
~future_base() {
206+
~future_base() {
208207
if (valid())
209208
report_fatal_error("get() must be called before future destruction");
210-
delete state_;
209+
delete state_;
211210
}
212211

213212
// Move constructor and assignment
214-
future_base(future_base&& other) noexcept : state_(other.state_) {
213+
future_base(future_base &&other) noexcept : state_(other.state_) {
215214
other.state_ = nullptr;
216215
}
217-
future_base& operator=(future_base&& other) noexcept {
216+
future_base &operator=(future_base &&other) noexcept {
218217
if (this != &other) {
219218
delete state_;
220219
state_ = other.state_;
@@ -223,87 +222,85 @@ class future_base {
223222
return *this;
224223
}
225224

226-
state_base* state_;
225+
state_base *state_;
227226
};
228227

229228
/// ORC-aware future class that can help with task dispatch while waiting
230229

231230
template <typename T> class future;
232231
template <typename T> class promise;
233-
template <typename T>
234-
class future : public future_base {
232+
template <typename T> class future : public future_base {
235233
public:
236234
struct state : public future_base::state_base {
237-
template <typename U>
238-
struct value_storage {
235+
template <typename U> struct value_storage {
239236
U value_;
240237
};
241-
242-
template <>
243-
struct value_storage<void> {
238+
239+
template <> struct value_storage<void> {
244240
// No value_ member for void
245241
};
246-
242+
247243
value_storage<T> storage;
248244
};
249245

250246
future() = delete;
251-
future(const future&) = delete;
252-
future& operator=(const future&) = delete;
253-
future(future&&) = default;
254-
future& operator=(future&&) = default;
247+
future(const future &) = delete;
248+
future &operator=(const future &) = delete;
249+
future(future &&) = default;
250+
future &operator=(future &&) = default;
255251

256252
/// Get the value, helping with task dispatch while waiting.
257253
/// This will destroy the underlying value, so this must only be called once.
258-
T get(TaskDispatcher& D) {
254+
T get(TaskDispatcher &D) {
259255
if (!valid())
260256
report_fatal_error("get() must only be called once");
261257
wait(D);
262-
auto old_status = state_->status_.exchange(FutureStatus::NotValid, std::memory_order_release);
258+
auto old_status = state_->status_.exchange(FutureStatus::NotValid,
259+
std::memory_order_release);
263260
if (old_status != FutureStatus::Ready)
264261
report_fatal_error("get() must only be called once");
265262
return take_value();
266263
}
267264

268265
private:
269266
friend class promise<T>;
270-
267+
271268
template <typename U = T>
272269
typename std::enable_if<!std::is_void<U>::value, U>::type take_value() {
273-
return std::move(static_cast<typename future<T>::state*>(state_)->storage.value_);
270+
return std::move(
271+
static_cast<typename future<T>::state *>(state_)->storage.value_);
274272
}
275-
273+
276274
template <typename U = T>
277275
typename std::enable_if<std::is_void<U>::value, U>::type take_value() {}
278276

279-
explicit future(state* state) : future_base(state) {}
277+
explicit future(state *state) : future_base(state) {}
280278
};
281279

282280
/// ORC-aware promise class that works with ORC future
283-
template <typename T>
284-
class promise {
281+
template <typename T> class promise {
285282
friend class future<T>;
286-
283+
287284
public:
288285
promise() : state_(new typename future<T>::state()), future_created_(false) {}
289-
286+
290287
~promise() {
291288
// Delete state only if get_future() was never called
292289
if (!future_created_) {
293290
delete state_;
294291
}
295292
}
296-
297-
promise(const promise&) = delete;
298-
promise& operator=(const promise&) = delete;
299-
300-
promise(promise&& other) noexcept
301-
: state_(other.state_), future_created_(other.future_created_) {
293+
294+
promise(const promise &) = delete;
295+
promise &operator=(const promise &) = delete;
296+
297+
promise(promise &&other) noexcept
298+
: state_(other.state_), future_created_(other.future_created_) {
302299
other.state_ = nullptr;
303300
other.future_created_ = false;
304301
}
305-
306-
promise& operator=(promise&& other) noexcept {
302+
303+
promise &operator=(promise &&other) noexcept {
307304
if (this != &other) {
308305
if (!future_created_) {
309306
delete state_;
@@ -329,24 +326,29 @@ class promise {
329326
// but that if the user calls set_value(v) for any value v that they get a
330327
// member function error, instead of no member named 'value_'.
331328
template <typename U = T>
332-
void set_value(const typename std::conditional<std::is_void<T>::value, std::nullopt_t, T>::type& value) {
329+
void
330+
set_value(const typename std::conditional<std::is_void<T>::value,
331+
std::nullopt_t, T>::type &value) {
333332
assert(state_ && "Invalid promise state");
334333
state_->storage.value_ = value;
335334
state_->status_.store(FutureStatus::Ready, std::memory_order_release);
336335
}
337-
336+
338337
template <typename U = T>
339-
void set_value(typename std::conditional<std::is_void<T>::value, std::nullopt_t, T>::type&& value) {
338+
void set_value(typename std::conditional<std::is_void<T>::value,
339+
std::nullopt_t, T>::type &&value) {
340340
assert(state_ && "Invalid promise state");
341341
state_->storage.value_ = std::move(value);
342342
state_->status_.store(FutureStatus::Ready, std::memory_order_release);
343343
}
344344

345345
template <typename U = T>
346-
typename std::enable_if<std::is_void<U>::value, void>::type set_value(const std::nullopt_t& value) = delete;
346+
typename std::enable_if<std::is_void<U>::value, void>::type
347+
set_value(const std::nullopt_t &value) = delete;
347348

348349
template <typename U = T>
349-
typename std::enable_if<std::is_void<U>::value, void>::type set_value(std::nullopt_t&& value) = delete;
350+
typename std::enable_if<std::is_void<U>::value, void>::type
351+
set_value(std::nullopt_t &&value) = delete;
350352

351353
template <typename U = T>
352354
typename std::enable_if<std::is_void<U>::value, void>::type set_value() {
@@ -355,14 +357,14 @@ class promise {
355357
}
356358

357359
/// Swap with another promise
358-
void swap(promise& other) noexcept {
360+
void swap(promise &other) noexcept {
359361
using std::swap;
360362
swap(state_, other.state_);
361363
swap(future_created_, other.future_created_);
362364
}
363365

364366
private:
365-
typename future<T>::state* state_;
367+
typename future<T>::state *state_;
366368
bool future_created_;
367369
};
368370

@@ -371,7 +373,7 @@ class promise {
371373

372374
namespace std {
373375
template <typename T>
374-
void swap(llvm::orc::promise<T>& lhs, llvm::orc::promise<T>& rhs) noexcept {
376+
void swap(llvm::orc::promise<T> &lhs, llvm::orc::promise<T> &rhs) noexcept {
375377
lhs.swap(rhs);
376378
}
377379
} // End namespace std

llvm/lib/ExecutionEngine/Orc/Core.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "llvm/Support/MSVCErrorWorkarounds.h"
1717
#include "llvm/Support/raw_ostream.h"
1818

19-
#include <condition_variable>
2019
#include "llvm/ExecutionEngine/Orc/TaskDispatch.h"
20+
#include <condition_variable>
2121
#include <optional>
2222

2323
#define DEBUG_TYPE "orc"
@@ -1863,7 +1863,8 @@ ExecutionSession::lookup(const JITDylibSearchOrder &SearchOrder,
18631863
std::move(NotifyComplete), RegisterDependencies);
18641864

18651865
#if LLVM_ENABLE_THREADS
1866-
return PromisedResult.get_future().get(getExecutorProcessControl().getDispatcher());
1866+
return PromisedResult.get_future().get(
1867+
getExecutorProcessControl().getDispatcher());
18671868
#else
18681869
if (ResolutionError)
18691870
return std::move(ResolutionError);

0 commit comments

Comments
 (0)