blob: 2e12ff334f6c24806c9f8089475f6214b132c337 [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
Alexey Samsonovdfa908c2015-05-07 22:34:06 +00005
Kostya Serebryany8e3061b2016-02-17 23:57:17 +00006// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
7// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
8// RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
9// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
10// RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
11// RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC
12// CHECK-SANITIZE-COVERAGE-FUNC: fsanitize-coverage-type=1
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000013
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000014// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-BB
15// CHECK-SANITIZE-COVERAGE-BB: fsanitize-coverage-type=2
16
17// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-EDGE
18// CHECK-SANITIZE-COVERAGE-EDGE: fsanitize-coverage-type=3
19
20// 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
21// CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-type=3
22// CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-indirect-calls
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000023
24// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-3
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000025// CHECK-SANITIZE-COVERAGE-3: warning: argument '-fsanitize-coverage=3' is deprecated, use '-fsanitize-coverage=[func,bb,edge]' instead
26//
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000027// 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 +000028// CHECK-SANITIZE-COVERAGE-5: error: unsupported argument '5' to option 'fsanitize-coverage='
29
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000030// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED
31// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED
32// CHECK-SANITIZE-COVERAGE-UNUSED: argument unused during compilation: '-fsanitize-coverage=func'
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000033
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000034// 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 +000035// CHECK-SANITIZE-COVERAGE-SAN-DISABLED-NOT: argument unused
36
Kostya Serebryanyd4590c72016-02-17 21:34:43 +000037// 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 +000038// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3
39// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls
40// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-bb
41// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp
42// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-8bit-counters
Kostya Serebryanyd4590c72016-02-17 21:34:43 +000043// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-pc
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000044
45// 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
46// CHECK-MASK: -fsanitize-coverage-type=1
47// CHECK-MASK: -fsanitize-coverage-trace-cmp
48// CHECK-MASK-NOT: -fsanitize-coverage-
49
50// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE
51// CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage='
52
53// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE
54// CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge'
55
56// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-TYPE
57// CHECK-MISSING-TYPE: error: invalid argument '-fsanitize-coverage=8bit-counters' only allowed with '-fsanitize-coverage=(func|bb|edge)'
58
Kostya Serebryany52e86492016-02-18 00:49:23 +000059// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE
60// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE
61// CHECK-TRACE_PC_EDGE: -fsanitize-coverage-type=3
62// CHECK-TRACE_PC_EDGE: -fsanitize-coverage-trace-pc
63// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_FUNC
64// CHECK-TRACE_PC_FUNC: -fsanitize-coverage-type=1
65// CHECK-TRACE_PC_FUNC: -fsanitize-coverage-trace-pc
66
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000067// 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
68// CHECK-NO-TYPE-NECESSARY-NOT: error:
69// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls
70// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp
71
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000072// 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 +000073// CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1
74// CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp
75
Kostya Serebryany8e3061b2016-02-17 23:57:17 +000076// 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 +000077// CLANG-CL-COVERAGE-NOT: error:
78// CLANG-CL-COVERAGE-NOT: warning:
79// CLANG-CL-COVERAGE-NOT: argument unused
80// CLANG-CL-COVERAGE-NOT: unknown argument
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000081// CLANG-CL-COVERAGE: -fsanitize-coverage-type=1
Kostya Serebryany52e86492016-02-18 00:49:23 +000082// CLANG-CL-COVERAGE: -fsanitize=address