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 6 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 7 // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 8 // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 9 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 10 // RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 11 // RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 12 // CHECK-SANITIZE-COVERAGE-1: fsanitize-coverage-type=1 13 14 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-2 15 // CHECK-SANITIZE-COVERAGE-2: fsanitize-coverage-type=2 16 17 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-3 18 // CHECK-SANITIZE-COVERAGE-3: fsanitize-coverage-type=3 19 20 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=4 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-4 21 // CHECK-SANITIZE-COVERAGE-4: fsanitize-coverage-type=3 22 // CHECK-SANITIZE-COVERAGE-4: fsanitize-coverage-indirect-calls 23 24 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-5 25 // CHECK-SANITIZE-COVERAGE-5: error: unsupported argument '5' to option 'fsanitize-coverage=' 26 27 // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED 28 // RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED 29 // CHECK-SANITIZE-COVERAGE-UNUSED: argument unused during compilation: '-fsanitize-coverage=1' 30 31 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 -fno-sanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-SAN-DISABLED 32 // CHECK-SANITIZE-COVERAGE-SAN-DISABLED-NOT: argument unused 33 34 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES 35 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3 36 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls 37 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-bb 38 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp 39 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-8bit-counters 40 41 // 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 42 // CHECK-MASK: -fsanitize-coverage-type=1 43 // CHECK-MASK: -fsanitize-coverage-trace-cmp 44 // CHECK-MASK-NOT: -fsanitize-coverage- 45 46 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE 47 // CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage=' 48 49 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE 50 // CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge' 51 52 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-TYPE 53 // CHECK-MISSING-TYPE: error: invalid argument '-fsanitize-coverage=8bit-counters' only allowed with '-fsanitize-coverage=(func|bb|edge)' 54 55 // 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 56 // CHECK-NO-TYPE-NECESSARY-NOT: error: 57 // CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls 58 // CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp 59 60 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 -fsanitize-coverage=trace-cmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXTEND-LEGACY 61 // CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1 62 // CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp 63 64 // RUN: %clang_cl --target=i386-pc-win32 -fsanitize=address -fsanitize-coverage=1 -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE 65 // CLANG-CL-COVERAGE-NOT: error: 66 // CLANG-CL-COVERAGE-NOT: warning: 67 // CLANG-CL-COVERAGE-NOT: argument unused 68 // CLANG-CL-COVERAGE-NOT: unknown argument 69 // CLANG-CL-COVERAGE: -fsanitize=address 70 // CLANG-CL-COVERAGE: -fsanitize-coverage-type=1 71