1
1
// RUN: rm -rf %t
2
2
// RUN: split-file %s %t
3
3
4
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-0.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
5
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-1.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
6
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-2.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
7
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-3.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
8
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-4.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
9
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-5.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
10
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-6.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
11
- // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-7.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s
12
-
13
- // The same type can appear multiple times within an ignorelist. This is a test
14
- // to make sure "=sanitize" has priority regardless of the order in which
15
- // duplicate type entries appear. This is a precautionary measure; we would
16
- // much rather eagerly sanitize than silently forgo sanitization.
4
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-0.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
5
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-1.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
6
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-2.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
7
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-3.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
8
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-4.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
9
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-5.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
10
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-6.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
11
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-7.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
12
+ // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-ignorelist=%t/order-8.ignorelist -emit-llvm %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
13
+
14
+
15
+ // The same type can appear multiple times within an ignorelist. Any ``=sanitize`` type
16
+ // entries enable sanitizer instrumentation, even if it was ignored by entries before.
17
+ // If multiple entries match the source, than the latest entry takes the
18
+ // precedence.
19
+
17
20
18
21
//--- order-0.ignorelist
19
22
type:int
@@ -40,19 +43,39 @@ type:int=sanitize
40
43
type:in*
41
44
42
45
//--- order-6.ignorelist
46
+ type:int
43
47
type:int=sanitize
44
- type:in*
45
48
46
49
//--- order-7.ignorelist
47
- type:int
50
+ [{unsigned-integer-overflow,signed-integer-overflow}]
51
+ type:*
48
52
type:int=sanitize
53
+ type:i*t
54
+ type:*nt=sanitize
55
+ [{unsigned-integer-overflow,signed-integer-overflow}]
56
+ type:*
57
+ type:int
58
+ type:i*t=sanitize
59
+ type:*nt
49
60
50
-
61
+ //--- order-8.ignorelist
62
+ [{unsigned-integer-overflow,signed-integer-overflow}]
63
+ type:*
64
+ type:int
65
+ type:i*t=sanitize
66
+ type:*nt
67
+ [{unsigned-integer-overflow,signed-integer-overflow}]
68
+ type:*
69
+ type:int=sanitize
70
+ type:i*t
71
+ type:*nt=sanitize
51
72
52
73
53
74
//--- test.c
54
- // CHECK-LABEL: @test
75
+ // CHECK-LABEL: define dso_local void @test
55
76
void test(int A) {
56
- // CHECK: @llvm.sadd.with.overflow.i32
77
+ // IGNORE: %inc = add nsw
78
+ // SANITIZE: @llvm.sadd.with.overflow.i32
57
79
++A;
58
80
}
81
+
0 commit comments