blob: b04e71e90c92daae5e342ece60981022d842f4ba [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
Evgeniy Stepanov5b49eb42016-06-14 21:33:40 +000036// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000037// CHECK-SANITIZE-COVERAGE-UNUSED: argument unused during compilation: '-fsanitize-coverage=func'
Kostya Serebryanyf5b25f82016-04-18 21:30:17 +000038// CHECK-SANITIZE-COVERAGE-UNUSED-NOT: -fsanitize-coverage-type=1
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000039
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000040// 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 +000041// CHECK-SANITIZE-COVERAGE-SAN-DISABLED-NOT: argument unused
42
Kostya Serebryany3b419712016-08-30 01:27:03 +000043// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-bb,trace-pc,trace-cmp,8bit-counters,trace-div,trace-gep %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000044// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3
45// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls
46// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-bb
47// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp
Kostya Serebryany3b419712016-08-30 01:27:03 +000048// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-div
49// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-gep
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000050// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-8bit-counters
Kostya Serebryanyd4590c72016-02-17 21:34:43 +000051// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-pc
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000052
53// 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
54// CHECK-MASK: -fsanitize-coverage-type=1
55// CHECK-MASK: -fsanitize-coverage-trace-cmp
56// CHECK-MASK-NOT: -fsanitize-coverage-
57
58// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE
59// CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage='
60
61// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE
62// CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge'
63
64// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-TYPE
65// CHECK-MISSING-TYPE: error: invalid argument '-fsanitize-coverage=8bit-counters' only allowed with '-fsanitize-coverage=(func|bb|edge)'
66
Kostya Serebryany52e86492016-02-18 00:49:23 +000067// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE
68// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE
69// CHECK-TRACE_PC_EDGE: -fsanitize-coverage-type=3
70// CHECK-TRACE_PC_EDGE: -fsanitize-coverage-trace-pc
71// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_FUNC
72// CHECK-TRACE_PC_FUNC: -fsanitize-coverage-type=1
73// CHECK-TRACE_PC_FUNC: -fsanitize-coverage-trace-pc
74
Kostya Serebryany60cdd612016-09-14 01:39:49 +000075// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_EDGE
76// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_EDGE
77// CHECK-TRACE_PC_GUARD_EDGE: -fsanitize-coverage-type=3
78// CHECK-TRACE_PC_GUARD_EDGE: -fsanitize-coverage-trace-pc-guard
79// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_FUNC
80// CHECK-TRACE_PC_GUARD_FUNC: -fsanitize-coverage-type=1
81// CHECK-TRACE_PC_GUARD_FUNC: -fsanitize-coverage-trace-pc-guard
82
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000083// 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
84// CHECK-NO-TYPE-NECESSARY-NOT: error:
85// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls
86// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp
87
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000088// 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 +000089// CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1
90// CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp
91
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000092// 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 +000093// CLANG-CL-COVERAGE-NOT: error:
94// CLANG-CL-COVERAGE-NOT: warning:
95// CLANG-CL-COVERAGE-NOT: argument unused
96// CLANG-CL-COVERAGE-NOT: unknown argument
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000097// CLANG-CL-COVERAGE: -fsanitize-coverage-type=1
Kostya Serebryany52e86492016-02-18 00:49:23 +000098// CLANG-CL-COVERAGE: -fsanitize=address