Skip to content

Commit 5bd2b64

Browse files
committed
clang-format everything
1 parent 9d8bd6d commit 5bd2b64

24 files changed

+60
-69
lines changed

compiler-rt/test/asan/TestCases/Windows/crash_read_write.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// RUN: not %run %t write 2>&1 | FileCheck %s --check-prefix=WRITE
44

55
#include "../defines.h"
6-
#include <windows.h>
76
#include <stdio.h>
7+
#include <windows.h>
88

99
static volatile int sink;
1010
ATTRIBUTE_NOINLINE void Read(int *ptr) { sink = *ptr; }

compiler-rt/test/asan/TestCases/Windows/dll_intercept_memcpy.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ int test_function() {
2323
// CHECK: Initial test OK
2424

2525
memcpy(buff2, buff1, 6);
26-
// CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
27-
// CHECK: WRITE of size 6 at [[ADDR]] thread T0
28-
// CHECK-NEXT: __asan_{{.*}}{{(memcpy|memmove)}}
29-
// CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy.cpp:[[@LINE-4]]
30-
// CHECK: Address [[ADDR]] is located in stack of thread T0 at offset {{.*}} in frame
31-
// CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy.cpp
32-
// CHECK: 'buff2'{{.*}} <== Memory access at offset {{.*}} overflows this variable
26+
// CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
27+
// CHECK: WRITE of size 6 at [[ADDR]] thread T0
28+
// CHECK-NEXT: __asan_{{.*}}{{(memcpy|memmove)}}
29+
// CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy.cpp:[[@LINE-4]]
30+
// CHECK: Address [[ADDR]] is located in stack of thread T0 at offset {{.*}} in frame
31+
// CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy.cpp
32+
// CHECK: 'buff2'{{.*}} <== Memory access at offset {{.*}} overflows this variable
3333
return 0;
3434
}

compiler-rt/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ struct C {
1111

1212
int ATTRIBUTE_NOINLINE
1313
#if defined(__clang__) || !defined(_MSC_VER)
14-
__attribute__((optnone))
14+
__attribute__((optnone))
1515
#endif
16-
hide(int x) { return x; }
16+
hide(int x) {
17+
return x;
18+
}
1719

1820
extern "C" __declspec(dllexport)
1921
int test_function() {

compiler-rt/test/asan/TestCases/Windows/issue64990.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// UNSUPPORTED: target={{.*-windows-gnu}}
66

77
#if defined(_MSC_VER) && !defined(__clang__)
8-
#include <string.h>
8+
# include <string.h>
99
#endif
1010

1111
char buff1[6] = "hello";

compiler-rt/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ struct C {
88
~C() {}
99
};
1010
#if defined(_MSC_VER) && !defined(__clang__)
11-
#pragma optimize("", off)
11+
# pragma optimize("", off)
1212
#else
1313
__attribute__((optnone))
1414
#endif
1515
int ATTRIBUTE_NOINLINE hide(int x) { return x; }
1616
#if defined(_MSC_VER) && !defined(__clang__)
17-
#pragma optimize("", on)
17+
# pragma optimize("", on)
1818
#endif
1919
int main() {
2020
C *buffer = new C[42];

compiler-rt/test/asan/TestCases/Windows/unsymbolized.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// REQUIRES: lld-available
1010

1111
#include "../defines.h"
12-
#include <stdlib.h>
1312
#include <stdio.h>
13+
#include <stdlib.h>
1414
int ATTRIBUTE_NOINLINE do_uaf(void);
1515
int main() {
1616
int r = do_uaf();

compiler-rt/test/asan/TestCases/alloca_constant_size.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <string.h>
99
#include <stdlib.h>
1010
#ifdef _MSC_VER
11-
#include <malloc.h>
11+
# include <malloc.h>
1212
#endif
1313

1414
// MSVC provides _alloca instead of alloca.

compiler-rt/test/asan/TestCases/alloca_detect_custom_size_.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <assert.h>
77
#include <stdint.h>
88
#if defined(_MSC_VER) && !defined(__clang__)
9-
#include <malloc.h>
9+
# include <malloc.h>
1010
#endif
1111

1212
struct A {
@@ -18,7 +18,7 @@ ATTRIBUTE_NOINLINE void foo(int index, int len) {
1818
#if !defined(_MSC_VER) || defined(__clang__)
1919
volatile struct A str[len] ATTRIBUTE_ALIGNED(32);
2020
#else
21-
volatile struct A *str = (volatile struct A*)_alloca(len * sizeof(struct A));
21+
volatile struct A *str = (volatile struct A *)_alloca(len * sizeof(struct A));
2222
#endif
2323
assert(!(reinterpret_cast<uintptr_t>(str) & 31L));
2424
str[index].a[0] = '1'; // BOOM

compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// UNSUPPORTED: MSVC
88

99
#include "defines.h"
10+
#include "sanitizer/asan_interface.h"
1011
#include <assert.h>
1112
#include <stdint.h>
1213
#include <stdlib.h>
13-
#include "sanitizer/asan_interface.h"
1414

1515
// MSVC provides _alloca instead of alloca.
1616
#if defined(_MSC_VER) && !defined(alloca)

compiler-rt/test/asan/TestCases/coverage-trace-pc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ extern "C" void __sanitizer_cov_trace_pc_indir(void *callee) {
1414
last_callee = callee;
1515
}
1616
#else
17-
#include "defines.h"
18-
#include <stdio.h>
19-
#include <assert.h>
17+
# include "defines.h"
18+
# include <assert.h>
19+
# include <stdio.h>
2020
extern int pc_count;
2121
extern void *last_callee;
2222

compiler-rt/test/asan/TestCases/deep_tail_call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "defines.h"
88
int global[10];
99
// CHECK: {{#0.*call4}}
10-
void ATTRIBUTE_NOINLINE call4(int i) { global[i+10]++; }
10+
void ATTRIBUTE_NOINLINE call4(int i) { global[i + 10]++; }
1111
// CHECK: {{#1.*call3}}
1212
void ATTRIBUTE_NOINLINE call3(int i) { call4(i); }
1313
// CHECK: {{#2.*call2}}

compiler-rt/test/asan/TestCases/default_options.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const char *kAsanDefaultOptions = "verbosity=1 help=1";
88
#if (__APPLE__)
99
__attribute__((weak))
1010
#endif
11-
ATTRIBUTE_NO_SANITIZE_ADDRESS
12-
extern "C" const char *
11+
ATTRIBUTE_NO_SANITIZE_ADDRESS extern "C" const char *
1312
__asan_default_options() {
1413
// CHECK: Available flags for AddressSanitizer:
1514
return kAsanDefaultOptions;
Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
#pragma once
22

33
#if defined(_MSC_VER) && !defined(__clang__)
4-
#include <intrin.h>
4+
# include <intrin.h>
55

6-
#define ATTRIBUTE_NOINLINE __declspec(noinline)
7-
#define ATTRIBUTE_ALIGNED(x) __declspec(align(x))
8-
#define ATTRIBUTE_NO_SANITIZE_ADDRESS __declspec(no_sanitize_address)
9-
#define ATTRIBUTE_USED /* FIXME: Is there a __declspec used? */
10-
#define ATTRIBUTE_ALWAYS_INLINE __forceinline
11-
#define VOLATILE volatile
12-
#define EXTRACT_RETURN_ADDRESS _ReturnAddress()
13-
#define ASM_CAUSE_SIDE_EFFECT(dest) __asm { mov eax, dest}
14-
#define MULTIPLE_ATTRIBUTE_DECL(a, b) __declspec(a b)
6+
# define ATTRIBUTE_NOINLINE __declspec(noinline)
7+
# define ATTRIBUTE_ALIGNED(x) __declspec(align(x))
8+
# define ATTRIBUTE_NO_SANITIZE_ADDRESS __declspec(no_sanitize_address)
9+
# define ATTRIBUTE_USED /* FIXME: Is there a __declspec used? */
10+
# define ATTRIBUTE_ALWAYS_INLINE __forceinline
11+
# define VOLATILE volatile
12+
# define EXTRACT_RETURN_ADDRESS _ReturnAddress()
13+
# define ASM_CAUSE_SIDE_EFFECT(dest) __asm { mov eax, dest}
14+
# define MULTIPLE_ATTRIBUTE_DECL(a, b) __declspec(a b)
1515

1616
#else
1717

18-
#define ATTRIBUTE_NOINLINE __attribute__((noinline))
19-
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
20-
#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
21-
#define ATTRIBUTE_USED __attribute__((used))
22-
#define ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
23-
#define INLINE_ASM(x) __asm__(x)
24-
#define VOLATILE __volatile__
25-
#define EXTRACT_RETURN_ADDRESS __builtin_extract_return_addr(__builtin_return_address(0))
26-
#define ASM_CAUSE_SIDE_EFFECT(dest) __asm__ __volatile__("" \
27-
: \
28-
: "r"(dest) \
29-
: "memory");
30-
#define MULTIPLE_ATTRIBUTE_DECL(a, b) __attribute__((a, b))
18+
# define ATTRIBUTE_NOINLINE __attribute__((noinline))
19+
# define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
20+
# define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
21+
# define ATTRIBUTE_USED __attribute__((used))
22+
# define ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
23+
# define INLINE_ASM(x) __asm__(x)
24+
# define VOLATILE __volatile__
25+
# define EXTRACT_RETURN_ADDRESS \
26+
__builtin_extract_return_addr(__builtin_return_address(0))
27+
# define ASM_CAUSE_SIDE_EFFECT(dest) \
28+
__asm__ __volatile__("" : : "r"(dest) : "memory");
29+
# define MULTIPLE_ATTRIBUTE_DECL(a, b) __attribute__((a, b))
3130

3231
#endif // _MSC_VER

compiler-rt/test/asan/TestCases/error_report_callback.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ static void ErrorReportCallbackOneToZ(const char *report) {
1212

1313
int main(int argc, char **argv) {
1414
__asan_set_error_report_callback(ErrorReportCallbackOneToZ);
15-
__asan_report_error(
16-
(void *)EXTRACT_RETURN_ADDRESS, 0, 0,
17-
0, true, 1);
15+
__asan_report_error((void *)EXTRACT_RETURN_ADDRESS, 0, 0, 0, true, 1);
1816
// CHECK: ABCDEF
1917
// CHECK: ERROR: AddressSanitizer
2018
// CHECK: GHIJKL

compiler-rt/test/asan/TestCases/heavy_uar_test.cpp

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

1818
#include "defines.h"
1919
#include <stdio.h>
20-
#include <string.h>
2120
#include <stdlib.h>
21+
#include <string.h>
2222
#ifdef _WIN32
2323
# include <windows.h>
2424
#endif
@@ -36,9 +36,8 @@ char *LeakStack() {
3636
return pretend_to_do_something(x);
3737
}
3838

39-
template<size_t kFrameSize>
40-
ATTRIBUTE_NOINLINE
41-
void RecursiveFunctionWithStackFrame(int depth) {
39+
template <size_t kFrameSize>
40+
ATTRIBUTE_NOINLINE void RecursiveFunctionWithStackFrame(int depth) {
4241
if (depth <= 0) return;
4342
char x[kFrameSize];
4443
x[0] = depth;

compiler-rt/test/asan/TestCases/ill.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// note: test is limited to i386 only ("asan-32-bits") when using "real" MSVC
1212
// see the REQUIRES: clause above
1313
#if defined(_MSC_VER) && !defined(__clang__)
14-
#define __builtin_trap() __asm ud2;
14+
# define __builtin_trap() __asm ud2;
1515
#endif
1616

1717
int main(int argc, char **argv) {

compiler-rt/test/asan/TestCases/interception_failure_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// XFAIL: target={{.*netbsd.*}} && !asan-dynamic-runtime
2020

2121
#if defined(_MSC_VER) && !defined(__clang__)
22-
#pragma warning(disable : 4273)
22+
# pragma warning(disable : 4273)
2323
#endif
2424

2525
#include <stdlib.h>

compiler-rt/test/asan/TestCases/strncpy-overflow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// REQUIRES: stable-runtime
88

99
#include "defines.h"
10-
#include <string.h>
1110
#include <stdlib.h>
11+
#include <string.h>
1212

1313
// We need a way to prevent the optimize from eliminating the
1414
// strncpy below (which otherwises writes to dead storage). We

compiler-rt/test/asan/TestCases/throw_catch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include "defines.h"
44
#include <assert.h>
5-
#include <stdio.h>
65
#include <sanitizer/asan_interface.h>
6+
#include <stdio.h>
77

88
ATTRIBUTE_NOINLINE
99
void Throw() {

compiler-rt/test/asan/TestCases/throw_invoke_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// Investigate why it fails with NDK 21.
55
// UNSUPPORTED: android, MSVC
66

7-
87
#include "defines.h"
98
#include <stdio.h>
109
static volatile int zero = 0;

compiler-rt/test/asan/TestCases/use-after-scope-temp.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ struct IntHolder {
88

99
const IntHolder *saved;
1010

11-
ATTRIBUTE_NOINLINE void save(const IntHolder &holder) {
12-
saved = &holder;
13-
}
11+
ATTRIBUTE_NOINLINE void save(const IntHolder &holder) { saved = &holder; }
1412

1513
int main(int argc, char *argv[]) {
1614
save({argc});

compiler-rt/test/asan/TestCases/use-after-scope-temp2.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include "defines.h"
55

66
struct IntHolder {
7-
ATTRIBUTE_NOINLINE const IntHolder &Self() const {
8-
return *this;
9-
}
7+
ATTRIBUTE_NOINLINE const IntHolder &Self() const { return *this; }
108
int val = 3;
119
};
1210

compiler-rt/test/asan/TestCases/vla_chrome_testcase.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
// See http://reviews.llvm.org/D6055?vs=on&id=15616&whitespace=ignore-all#toc.
88

99
#include "defines.h"
10-
#include <stdint.h>
1110
#include <assert.h>
11+
#include <stdint.h>
1212

1313
int a = 7;
1414
int b;
1515
int c;
1616
int *p;
1717

18-
ATTRIBUTE_NOINLINE void fn3(int *first, int second) {
19-
}
18+
ATTRIBUTE_NOINLINE void fn3(int *first, int second) {}
2019

2120
int main() {
2221
int d = b && c;

compiler-rt/test/asan/TestCases/zero_page_pc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s
33

44
#if defined(_MSC_VER) && !defined(__CLANG__)
5-
#define __has_feature(x) 0
5+
# define __has_feature(x) 0
66
#endif
77

88
#if __has_feature(ptrauth_calls)

0 commit comments

Comments
 (0)