Skip to content

Commit 2e8aef7

Browse files
committed
Fix clang format
1 parent b86f26a commit 2e8aef7

File tree

6 files changed

+44
-47
lines changed

6 files changed

+44
-47
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -993,9 +993,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
993993

994994
if (LangOpts.Sanitize.has(SanitizerKind::Realtime)) {
995995
PB.registerLoopOptimizerEndEPCallback(
996-
[](LoopPassManager &LPM, OptimizationLevel Level) {
997-
LPM.addPass(RealtimeSanitizerLoopPass());
998-
});
996+
[](LoopPassManager &LPM, OptimizationLevel Level) {
997+
LPM.addPass(RealtimeSanitizerLoopPass());
998+
});
999999
PB.registerScalarOptimizerLateEPCallback(
10001000
[](FunctionPassManager &FPM, OptimizationLevel Level) {
10011001
RealtimeSanitizerOptions Opts;

compiler-rt/test/rtsan/bound_loop.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,24 @@
1717

1818
#include <assert.h>
1919

20-
21-
void FillBufferInterleaved(int* buffer, int sample_count, int channel_count) [[clang::nonblocking]] {
20+
void FillBufferInterleaved(int *buffer, int sample_count, int channel_count)
21+
[[clang::nonblocking]] {
2222
for (int sample = 0; sample < sample_count; sample++)
2323
for (int channel = 0; channel < channel_count; channel++)
2424
buffer[sample * channel_count + channel] = sample;
2525
}
2626

27-
void Deinterleave(int* buffer, int sample_count, int channel_count, int* scratch_buffer) [[clang::nonblocking]] {
27+
void Deinterleave(int *buffer, int sample_count, int channel_count,
28+
int *scratch_buffer) [[clang::nonblocking]] {
2829
for (int channel = 0; channel < channel_count; channel++)
2930
for (int sample = 0; sample < sample_count; sample++) {
30-
int interleaved_index = sample * channel_count + channel;
31-
int deinterleaved_index = channel * sample_count + sample;
32-
scratch_buffer[deinterleaved_index] = buffer[interleaved_index];
33-
}
31+
int interleaved_index = sample * channel_count + channel;
32+
int deinterleaved_index = channel * sample_count + sample;
33+
scratch_buffer[deinterleaved_index] = buffer[interleaved_index];
34+
}
3435

3536
for (int i = 0; i < sample_count * channel_count; i++)
36-
buffer[i] = scratch_buffer[i];
37+
buffer[i] = scratch_buffer[i];
3738
}
3839

3940
int main() {

compiler-rt/test/rtsan/infinite_loop.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
#include <stdlib.h>
99

1010
void infinity() [[clang::nonblocking]] {
11-
while(true);
11+
while (true)
12+
;
1213
}
1314

1415
int main() {

compiler-rt/test/rtsan/spinlock.cpp

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,46 @@
1010

1111
class SpinLockTestAndSet {
1212
public:
13-
void lock() {
14-
while (lock_flag.test_and_set(std::memory_order_acquire)) {
15-
// Busy-wait (spin) until the lock is acquired
16-
}
13+
void lock() {
14+
while (lock_flag.test_and_set(std::memory_order_acquire)) {
15+
// Busy-wait (spin) until the lock is acquired
1716
}
17+
}
1818

19-
void unlock() {
20-
lock_flag.clear(std::memory_order_release);
21-
}
19+
void unlock() { lock_flag.clear(std::memory_order_release); }
2220

2321
private:
24-
std::atomic_flag lock_flag = ATOMIC_FLAG_INIT;
22+
std::atomic_flag lock_flag = ATOMIC_FLAG_INIT;
2523
};
2624

2725
class SpinLockCompareExchange {
2826
public:
29-
void lock() {
30-
bool expected = false;
31-
while (!lock_flag.compare_exchange_weak(expected, true, std::memory_order_acquire, std::memory_order_relaxed)) {
32-
}
27+
void lock() {
28+
bool expected = false;
29+
while (!lock_flag.compare_exchange_weak(
30+
expected, true, std::memory_order_acquire, std::memory_order_relaxed)) {
3331
}
32+
}
3433

35-
void unlock() {
36-
lock_flag.store(false, std::memory_order_release);
37-
}
34+
void unlock() { lock_flag.store(false, std::memory_order_release); }
3835

3936
private:
40-
std::atomic<bool> lock_flag{false};
37+
std::atomic<bool> lock_flag{false};
4138
};
4239

43-
int lock_violation() [[clang::nonblocking]]
44-
{
40+
int lock_violation() [[clang::nonblocking]] {
4541
#if defined(TEST_AND_SET_SPINLOCK)
46-
SpinLockTestAndSet lock;
42+
SpinLockTestAndSet lock;
4743
#elif defined(CAS_SPINLOCK)
48-
SpinLockCompareExchange lock;
44+
SpinLockCompareExchange lock;
4945
#else
50-
#error "No spinlock defined"
46+
# error "No spinlock defined"
5147
#endif
52-
lock.lock();
53-
return 0;
48+
lock.lock();
49+
return 0;
5450
}
5551

56-
int main() [[clang::nonblocking]]
57-
{
58-
lock_violation();
59-
}
52+
int main() [[clang::nonblocking]] { lock_violation(); }
6053

6154
// CHECK-ALL: {{.*Real-time violation.*}}
6255
// CHECK-CAS: {{.*SpinLockCompareExchange::lock.*}}

compiler-rt/test/rtsan/unbound_loop.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
#include <assert.h>
1919

20-
21-
void BadScalarEvolution(int* buffer, int sample_count, int channel_count) [[clang::nonblocking]] {
20+
void BadScalarEvolution(int *buffer, int sample_count, int channel_count)
21+
[[clang::nonblocking]] {
2222

2323
int sample = 0;
2424
while (sample < sample_count) {

llvm/lib/Transforms/Instrumentation/RealtimeSanitizer.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,20 @@ PreservedAnalyses RealtimeSanitizerPass::run(Function &F,
7575
return PreservedAnalyses::all();
7676
}
7777

78-
PreservedAnalyses RealtimeSanitizerLoopPass::run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U) {
78+
PreservedAnalyses
79+
RealtimeSanitizerLoopPass::run(Loop &L, LoopAnalysisManager &AM,
80+
LoopStandardAnalysisResults &AR, LPMUpdater &U) {
7981
BasicBlock *Context =
8082
L.getLoopPreheader() ? L.getLoopPreheader() : L.getHeader();
8183
assert(Context && "Loop has no preheader or header block");
8284

83-
Function* F = Context->getParent();
85+
Function *F = Context->getParent();
8486
assert(F && "Loop has no parent function");
8587

8688
const bool HasNoExits = L.hasNoExitBlocks();
87-
const bool CannotPredictLoopCount = isa<SCEVCouldNotCompute>(AR.SE.getConstantMaxBackedgeTakenCount(&L)) ||
88-
isa<SCEVCouldNotCompute>(AR.SE.getBackedgeTakenCount(&L));
89+
const bool CannotPredictLoopCount =
90+
isa<SCEVCouldNotCompute>(AR.SE.getConstantMaxBackedgeTakenCount(&L)) ||
91+
isa<SCEVCouldNotCompute>(AR.SE.getBackedgeTakenCount(&L));
8992
const bool LoopIsPotentiallyUnbound = HasNoExits || CannotPredictLoopCount;
9093

9194
if (LoopIsPotentiallyUnbound) {
@@ -107,8 +110,7 @@ PreservedAnalyses RealtimeSanitizerLoopPass::run(Loop &L, LoopAnalysisManager &A
107110

108111
// TODO: What is preserved here??
109112
return PreservedAnalyses::none();
110-
}
113+
}
111114

112115
return PreservedAnalyses::all();
113116
}
114-

0 commit comments

Comments
 (0)