|
1 | 1 | // RUN: %clang -E -fsanitize=undefined %s -o - | FileCheck --check-prefix=CHECK-UBSAN %s
|
2 |
| -// RUN: %clang -E -fsanitize=alignment %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-ALIGNMENT %s |
3 |
| -// RUN: %clang -E -fsanitize=bool %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-BOOL %s |
4 |
| -// RUN: %clang -E -fsanitize=builtin %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-BUILTIN %s |
5 |
| -// RUN: %clang -E -fsanitize=array-bounds %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-ARRAY-BOUNDS %s |
6 |
| -// RUN: %clang -E -fsanitize=enum %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-ENUM %s |
7 |
| -// RUN: %clang -E -fsanitize=float-cast-overflow %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-FLOAT-CAST-OVERFLOW %s |
8 |
| -// RUN: %clang -E -fsanitize=integer-divide-by-zero %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-INTEGER-DIVIDE-BY-ZERO %s |
9 |
| -// RUN: %clang -E -fsanitize=nonnull-attribute %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-NONNULL-ATTRIBUTE %s |
10 |
| -// RUN: %clang -E -fsanitize=null %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-NULL %s |
11 |
| -// object-size is a no-op at O0. |
12 |
| -// RUN: %clang -E -O2 -fsanitize=object-size %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-OBJECT-SIZE %s |
13 |
| -// RUN: %clang -E -fsanitize=pointer-overflow %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-POINTER-OVERFLOW %s |
14 |
| -// RUN: %clang -E -fsanitize=return %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-RETURN %s |
15 |
| -// RUN: %clang -E -fsanitize=returns-nonnull-attribute %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-RETURNS-NONNULL-ATTRIBUTE %s |
16 |
| -// RUN: %clang -E -fsanitize=shift-base %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SHIFT-BASE,CHECK-SHIFT %s |
17 |
| -// RUN: %clang -E -fsanitize=shift-exponent %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SHIFT-EXPONENT,CHECK-SHIFT %s |
18 |
| -// RUN: %clang -E -fsanitize=shift %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SHIFT %s |
19 |
| -// RUN: %clang -E -fsanitize=signed-integer-overflow %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-SIGNED-INTEGER-OVERFLOW %s |
20 |
| -// RUN: %clang -E -fsanitize=unreachable %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-UNREACHABLE %s |
21 |
| -// RUN: %clang -E -fsanitize=vla-bound %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-VLA-BOUND %s |
22 |
| -// RUN: %clang -E -fsanitize=function %s -o - | FileCheck --check-prefixes=CHECK-UBSAN,CHECK-FUNCTION %s |
23 |
| - |
| 2 | +// RUN: %clang -E -fsanitize=alignment %s -o - | FileCheck --check-prefix=CHECK-ALIGNMENT %s |
24 | 3 | // RUN: %clang -E %s -o - | FileCheck --check-prefix=CHECK-NO-UBSAN %s
|
25 | 4 |
|
26 |
| -#if !__has_feature(undefined_behavior_sanitizer_finegrained_feature_checks) |
27 |
| -#error "Missing undefined_behavior_sanitizer_finegrained_feature_checks" |
28 |
| -#endif |
29 |
| - |
30 | 5 | #if __has_feature(undefined_behavior_sanitizer)
|
31 | 6 | int UBSanEnabled();
|
32 | 7 | #else
|
33 | 8 | int UBSanDisabled();
|
34 | 9 | #endif
|
35 | 10 |
|
36 |
| -#if __has_feature(alignment_sanitizer) |
37 |
| -int AlignmentSanitizerEnabled(); |
38 |
| -#else |
39 |
| -int AlignmentSanitizerDisabled(); |
40 |
| -#endif |
41 |
| - |
42 |
| -#if __has_feature(bool_sanitizer) |
43 |
| -int BoolSanitizerEnabled(); |
44 |
| -#else |
45 |
| -int BoolSanitizerDisabled(); |
46 |
| -#endif |
47 |
| - |
48 |
| -#if __has_feature(builtin_sanitizer) |
49 |
| -int BuiltinSanitizerEnabled(); |
50 |
| -#else |
51 |
| -int BuiltinSanitizerDisabled(); |
52 |
| -#endif |
53 |
| - |
54 |
| -#if __has_feature(array_bounds_sanitizer) |
55 |
| -int ArrayBoundsSanitizerEnabled(); |
56 |
| -#else |
57 |
| -int ArrayBoundsSanitizerDisabled(); |
58 |
| -#endif |
59 |
| - |
60 |
| -#if __has_feature(enum_sanitizer) |
61 |
| -int EnumSanitizerEnabled(); |
62 |
| -#else |
63 |
| -int EnumSanitizerDisabled(); |
64 |
| -#endif |
65 |
| - |
66 |
| -#if __has_feature(float_cast_overflow_sanitizer) |
67 |
| -int FloatCastOverflowSanitizerEnabled(); |
68 |
| -#else |
69 |
| -int FloatCastOverflowSanitizerDisabled(); |
70 |
| -#endif |
71 |
| - |
72 |
| -#if __has_feature(integer_divide_by_zero_sanitizer) |
73 |
| -int IntegerDivideByZeroSanitizerEnabled(); |
74 |
| -#else |
75 |
| -int IntegerDivideByZeroSanitizerDisabled(); |
76 |
| -#endif |
77 |
| - |
78 |
| -#if __has_feature(nonnull_attribute_sanitizer) |
79 |
| -int NonnullAttributeSanitizerEnabled(); |
80 |
| -#else |
81 |
| -int NonnullAttributeSanitizerDisabled(); |
82 |
| -#endif |
83 |
| - |
84 |
| -#if __has_feature(null_sanitizer) |
85 |
| -int NullSanitizerEnabled(); |
86 |
| -#else |
87 |
| -int NullSanitizerDisabled(); |
88 |
| -#endif |
89 |
| - |
90 |
| -#if __has_feature(object_size_sanitizer) |
91 |
| -int ObjectSizeSanitizerEnabled(); |
92 |
| -#else |
93 |
| -int ObjectSizeSanitizerDisabled(); |
94 |
| -#endif |
95 |
| - |
96 |
| -#if __has_feature(pointer_overflow_sanitizer) |
97 |
| -int PointerOverflowSanitizerEnabled(); |
98 |
| -#else |
99 |
| -int PointerOverflowSanitizerDisabled(); |
100 |
| -#endif |
101 |
| - |
102 |
| -#if __has_feature(return_sanitizer) |
103 |
| -int ReturnSanitizerEnabled(); |
104 |
| -#else |
105 |
| -int ReturnSanitizerDisabled(); |
106 |
| -#endif |
107 |
| - |
108 |
| -#if __has_feature(returns_nonnull_attribute_sanitizer) |
109 |
| -int ReturnsNonnullAttributeSanitizerEnabled(); |
110 |
| -#else |
111 |
| -int ReturnsNonnullAttributeSanitizerDisabled(); |
112 |
| -#endif |
113 |
| - |
114 |
| -#if __has_feature(shift_base_sanitizer) |
115 |
| -int ShiftBaseSanitizerEnabled(); |
116 |
| -#else |
117 |
| -int ShiftBaseSanitizerDisabled(); |
118 |
| -#endif |
119 |
| - |
120 |
| -#if __has_feature(shift_exponent_sanitizer) |
121 |
| -int ShiftExponentSanitizerEnabled(); |
122 |
| -#else |
123 |
| -int ShiftExponentSanitizerDisabled(); |
124 |
| -#endif |
125 |
| - |
126 |
| -#if __has_feature(shift_sanitizer) |
127 |
| -int ShiftSanitizerEnabled(); |
128 |
| -#else |
129 |
| -int ShiftSanitizerDisabled(); |
130 |
| -#endif |
131 |
| - |
132 |
| -#if __has_feature(signed_integer_overflow_sanitizer) |
133 |
| -int SignedIntegerOverflowSanitizerEnabled(); |
134 |
| -#else |
135 |
| -int SignedIntegerOverflowSanitizerDisabled(); |
136 |
| -#endif |
137 |
| - |
138 |
| -#if __has_feature(unreachable_sanitizer) |
139 |
| -int UnreachableSanitizerEnabled(); |
140 |
| -#else |
141 |
| -int UnreachableSanitizerDisabled(); |
142 |
| -#endif |
143 |
| - |
144 |
| -#if __has_feature(vla_bound_sanitizer) |
145 |
| -int VLABoundSanitizerEnabled(); |
146 |
| -#else |
147 |
| -int VLABoundSanitizerDisabled(); |
148 |
| -#endif |
149 |
| - |
150 |
| -#if __has_feature(function_sanitizer) |
151 |
| -int FunctionSanitizerEnabled(); |
152 |
| -#else |
153 |
| -int FunctionSanitizerDisabled(); |
154 |
| -#endif |
155 |
| - |
156 | 11 | // CHECK-UBSAN: UBSanEnabled
|
157 |
| -// CHECK-ALIGNMENT: AlignmentSanitizerEnabled |
158 |
| -// CHECK-BOOL: BoolSanitizerEnabled |
159 |
| -// CHECK-BUILTIN: BuiltinSanitizerEnabled |
160 |
| -// CHECK-ARRAY-BOUNDS: ArrayBoundsSanitizerEnabled |
161 |
| -// CHECK-ENUM: EnumSanitizerEnabled |
162 |
| -// CHECK-FLOAT-CAST-OVERFLOW: FloatCastOverflowSanitizerEnabled |
163 |
| -// CHECK-INTEGER-DIVIDE-BY-ZERO: IntegerDivideByZeroSanitizerEnabled |
164 |
| -// CHECK-NONNULL-ATTRIBUTE: NonnullAttributeSanitizerEnabled |
165 |
| -// CHECK-NULL: NullSanitizerEnabled |
166 |
| -// CHECK-OBJECT-SIZE: ObjectSizeSanitizerEnabled |
167 |
| -// CHECK-POINTER-OVERFLOW: PointerOverflowSanitizerEnabled |
168 |
| -// CHECK-RETURN: ReturnSanitizerEnabled |
169 |
| -// CHECK-RETURNS-NONNULL-ATTRIBUTE: ReturnsNonnullAttributeSanitizerEnabled |
170 |
| -// CHECK-SHIFT-BASE: ShiftBaseSanitizerEnabled |
171 |
| -// CHECK-SHIFT-EXPONENT: ShiftExponentSanitizerEnabled |
172 |
| -// CHECK-SHIFT: ShiftSanitizerEnabled |
173 |
| -// CHECK-SIGNED-INTEGER-OVERFLOW: SignedIntegerOverflowSanitizerEnabled |
174 |
| -// CHECK-UNREACHABLE: UnreachableSanitizerEnabled |
175 |
| -// CHECK-VLA-BOUND: VLABoundSanitizerEnabled |
176 |
| -// CHECK-FUNCTION: FunctionSanitizerEnabled |
| 12 | +// CHECK-ALIGNMENT: UBSanEnabled |
177 | 13 | // CHECK-NO-UBSAN: UBSanDisabled
|
0 commit comments