blob: 19b4af43a2d10eed2675286f79711366524138af [file] [log] [blame]
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +00001// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0
Alexey Samsonovdfa908c2015-05-07 22:34:06 +00002// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0
3// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +00004// CHECK-SANITIZE-COVERAGE-0-NOT: fsanitize-coverage-type
Kostya Serebryany578787a2016-03-02 19:16:54 +00005// CHECK-SANITIZE-COVERAGE-0: -fsanitize=address
Alexey Samsonovdfa908c2015-05-07 22:34:06 +00006
Kostya Serebryany8e3061b2016-02-17 23:57:17 +00007// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
8// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
9// RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
10// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
11// RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
12// RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
13// CHECK-SANITIZE-COVERAGE-FUNC: fsanitize-coverage-type=1
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000014
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000015// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-BB
16// CHECK-SANITIZE-COVERAGE-BB: fsanitize-coverage-type=2
17
18// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-EDGE
19// CHECK-SANITIZE-COVERAGE-EDGE: fsanitize-coverage-type=3
20
21// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC_INDIR
22// CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-type=3
23// CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-indirect-calls
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000024
Kostya Serebryany578787a2016-03-02 19:16:54 +000025// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1
26// CHECK-SANITIZE-COVERAGE-1: warning: argument '-fsanitize-coverage=1' is deprecated, use '-fsanitize-coverage=func' instead
27// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-2
28// CHECK-SANITIZE-COVERAGE-2: warning: argument '-fsanitize-coverage=2' is deprecated, use '-fsanitize-coverage=bb' instead
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000029// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-3
Nico Weber4152f522016-02-18 19:32:54 +000030// CHECK-SANITIZE-COVERAGE-3: warning: argument '-fsanitize-coverage=3' is deprecated, use '-fsanitize-coverage=edge' instead
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000031//
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000032// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-5
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000033// CHECK-SANITIZE-COVERAGE-5: error: unsupported argument '5' to option 'fsanitize-coverage='
34
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000035// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED
36// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED
37// CHECK-SANITIZE-COVERAGE-UNUSED: argument unused during compilation: '-fsanitize-coverage=func'
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000038
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000039// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fno-sanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-SAN-DISABLED
Alexey Samsonovde0aff32015-05-21 01:07:52 +000040// CHECK-SANITIZE-COVERAGE-SAN-DISABLED-NOT: argument unused
41
Kostya Serebryanyd4590c72016-02-17 21:34:43 +000042// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-bb,trace-pc,trace-cmp,8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000043// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3
44// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls
45// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-bb
46// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp
47// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-8bit-counters
Kostya Serebryanyd4590c72016-02-17 21:34:43 +000048// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-pc
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000049
50// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,edge,indirect-calls,trace-bb,trace-cmp -fno-sanitize-coverage=edge,indirect-calls,trace-bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MASK
51// CHECK-MASK: -fsanitize-coverage-type=1
52// CHECK-MASK: -fsanitize-coverage-trace-cmp
53// CHECK-MASK-NOT: -fsanitize-coverage-
54
55// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE
56// CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage='
57
58// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE
59// CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge'
60
61// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-TYPE
62// CHECK-MISSING-TYPE: error: invalid argument '-fsanitize-coverage=8bit-counters' only allowed with '-fsanitize-coverage=(func|bb|edge)'
63
Kostya Serebryany52e86492016-02-18 00:49:23 +000064// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE
65// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE
66// CHECK-TRACE_PC_EDGE: -fsanitize-coverage-type=3
67// CHECK-TRACE_PC_EDGE: -fsanitize-coverage-trace-pc
68// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_FUNC
69// CHECK-TRACE_PC_FUNC: -fsanitize-coverage-type=1
70// CHECK-TRACE_PC_FUNC: -fsanitize-coverage-trace-pc
71
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000072// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=trace-cmp,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TYPE-NECESSARY
73// CHECK-NO-TYPE-NECESSARY-NOT: error:
74// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls
75// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp
76
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000077// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=trace-cmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXTEND-LEGACY
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000078// CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1
79// CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp
80
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000081// RUN: %clang_cl --target=i386-pc-win32 -fsanitize=address -fsanitize-coverage=func -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000082// CLANG-CL-COVERAGE-NOT: error:
83// CLANG-CL-COVERAGE-NOT: warning:
84// CLANG-CL-COVERAGE-NOT: argument unused
85// CLANG-CL-COVERAGE-NOT: unknown argument
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000086// CLANG-CL-COVERAGE: -fsanitize-coverage-type=1
Kostya Serebryany52e86492016-02-18 00:49:23 +000087// CLANG-CL-COVERAGE: -fsanitize=address