1 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 2 // 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 4 // CHECK-SANITIZE-COVERAGE-0-NOT: fsanitize-coverage-type 5 // CHECK-SANITIZE-COVERAGE-0: -fsanitize=address 6 7 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 8 // RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-address -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 9 // RUN: %clang -target x86_64-linux-gnu -fsanitize=hwaddress -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 10 // RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-hwaddress -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 11 // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 12 // RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-memory -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 13 // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 14 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 15 // RUN: %clang -target x86_64-linux-gnu -fsanitize=bounds -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 16 // RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 17 // RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 18 // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 19 // RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 20 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC 21 // CHECK-SANITIZE-COVERAGE-FUNC: fsanitize-coverage-type=1 22 23 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-BB 24 // CHECK-SANITIZE-COVERAGE-BB: fsanitize-coverage-type=2 25 26 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-EDGE 27 // CHECK-SANITIZE-COVERAGE-EDGE: fsanitize-coverage-type=3 28 29 // 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 30 // CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-type=3 31 // CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-indirect-calls 32 33 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 34 // CHECK-SANITIZE-COVERAGE-1: warning: argument '-fsanitize-coverage=1' is deprecated, use '-fsanitize-coverage=trace-pc-guard' instead 35 36 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED 37 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED 38 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED 39 // CHECK_FUNC_BB_EDGE_DEPRECATED: warning: argument '-fsanitize-coverage=[func|bb|edge]' is deprecated, use '-fsanitize-coverage=[func|bb|edge],[trace-pc-guard|trace-pc]' instead 40 41 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-pc,trace-cmp,trace-div,trace-gep %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES 42 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3 43 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls 44 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp 45 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-div 46 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-gep 47 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-pc 48 49 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,edge,indirect-calls,trace-cmp -fno-sanitize-coverage=edge,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MASK 50 // CHECK-MASK: -fsanitize-coverage-type=1 51 // CHECK-MASK: -fsanitize-coverage-trace-cmp 52 // CHECK-MASK-NOT: -fsanitize-coverage- 53 54 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE 55 // CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage=' 56 57 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE 58 // CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge' 59 60 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-8BIT 61 // CHECK-8BIT: warning: argument '-fsanitize-coverage=8bit-counters' is deprecated, use '-fsanitize-coverage=trace-pc-guard' instead 62 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE-BB 63 // CHECK-TRACE-BB: warning: argument '-fsanitize-coverage=trace-bb' is deprecated, use '-fsanitize-coverage=trace-pc-guard' instead 64 65 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE 66 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE 67 // CHECK-TRACE_PC_EDGE: -fsanitize-coverage-type=3 68 // CHECK-TRACE_PC_EDGE: -fsanitize-coverage-trace-pc 69 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_FUNC 70 // CHECK-TRACE_PC_FUNC: -fsanitize-coverage-type=1 71 // CHECK-TRACE_PC_FUNC: -fsanitize-coverage-trace-pc 72 73 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_EDGE 74 // 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 75 // CHECK-TRACE_PC_GUARD_EDGE: -fsanitize-coverage-type=3 76 // CHECK-TRACE_PC_GUARD_EDGE: -fsanitize-coverage-trace-pc-guard 77 // 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 78 // CHECK-TRACE_PC_GUARD_FUNC: -fsanitize-coverage-type=1 79 // CHECK-TRACE_PC_GUARD_FUNC: -fsanitize-coverage-trace-pc-guard 80 81 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=stack-depth %s \ 82 // RUN: -### 2>&1 | FileCheck %s --check-prefix=CHECK-STACK-DEPTH 83 // RUN: %clang -target x86_64-linux-gnu \ 84 // RUN: -fsanitize-coverage=trace-pc-guard,stack-depth %s -### 2>&1 | \ 85 // RUN: FileCheck %s --check-prefix=CHECK-STACK-DEPTH-PC-GUARD 86 // CHECK-STACK-DEPTH: -fsanitize-coverage-type=1 87 // CHECK-STACK-DEPTH: -fsanitize-coverage-stack-depth 88 // CHECK-STACK-DEPTH-PC-GUARD: -fsanitize-coverage-type=3 89 // CHECK-STACK-DEPTH-PC-GUARD: -fsanitize-coverage-trace-pc-guard 90 // CHECK-STACK-DEPTH-PC-GUARD: -fsanitize-coverage-stack-depth 91 92 // 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 93 // CHECK-NO-TYPE-NECESSARY-NOT: error: 94 // CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls 95 // CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp 96 97 // 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 98 // CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1 99 // CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp 100 101 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=no-prune,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_NOPRUNE 102 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=no-prune,func,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_NOPRUNE 103 // CHECK_NOPRUNE: -fsanitize-coverage-no-prune 104 105 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT 106 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=bb,inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT 107 // CHECK_INLINE8BIT-NOT: warning 108 // CHECK_INLINE8BIT: -fsanitize-coverage-inline-8bit-counters 109 110 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINE8BIT 111 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINE8BIT 112 // CHECK_PC_TABLE_FOR_INLINE8BIT: -fsanitize-coverage-pc-table 113 114 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG 115 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=bb,inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG 116 // CHECK_INLINE_BOOL_FLAG-NOT: warning 117 // CHECK_INLINE_BOOL_FLAG: -fsanitize-coverage-inline-bool-flag 118 119 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINEBOOL 120 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINEBOOL 121 // CHECK_PC_TABLE_FOR_INLINEBOOL: -fsanitize-coverage-pc-table 122 123 // RUN: %clang_cl --target=i386-pc-win32 -fsanitize=address -fsanitize-coverage=func,trace-pc-guard -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE 124 // CLANG-CL-COVERAGE-NOT: error: 125 // CLANG-CL-COVERAGE-NOT: warning: 126 // CLANG-CL-COVERAGE-NOT: argument unused 127 // CLANG-CL-COVERAGE-NOT: unknown argument 128 // CLANG-CL-COVERAGE: -fsanitize-coverage-type=1 129 // CLANG-CL-COVERAGE: -fsanitize=address 130 131 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VS-SAFESTACK 132 // CHECK-VS-SAFESTACK: -fsanitize-coverage-trace-pc-guard 133 // CHECK-VS-SAFESTACK: -fsanitize=safe-stack 134 135 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fsanitize-coverage=trace-pc-guard -fno-sanitize=safe-stack %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFESTACK 136 // CHECK-NO-SAFESTACK-NOT: error: 137 // CHECK-NO-SAFESTACK-NOT: warning: 138 // CHECK-NO-SAFESTACK-NOT: argument unused 139 // CHECK-NO-SAFESTACK-NOT: unknown argument 140 // CHECK-NO-SAFESTACK-NOT: -fsanitize=safe-stack 141 // CHECK-NO-SAFESTACK: -fsanitize-coverage-trace-pc-guard 142 143 // RUN: %clang -target x86_64-linux-gnu -fsanitize=shadow-call-stack -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VS-SHADOWCALLSTACK 144 // CHECK-VS-SHADOWCALLSTACK: -fsanitize-coverage-trace-pc-guard 145 // CHECK-VS-SHADOWCALLSTACK: -fsanitize=shadow-call-stack 146 147 // RUN: %clang -target x86_64-linux-gnu -fsanitize=shadow-call-stack -fsanitize-coverage=trace-pc-guard -fno-sanitize=shadow-call-stack %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFESTACK 148 // CHECK-NO-SHADOWCALLSTACK-NOT: error: 149 // CHECK-NO-SHADOWCALLSTACK-NOT: warning: 150 // CHECK-NO-SHADOWCALLSTACK-NOT: argument unused 151 // CHECK-NO-SHADOWCALLSTACK-NOT: unknown argument 152 // CHECK-NO-SHADOWCALLSTACK-NOT: -fsanitize=shadow-call-stack 153 // CHECK-NO-SHADOWCALLSTACK: -fsanitize-coverage-trace-pc-guard 154