1 // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S                       -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK
2 // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=address    -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,ASAN
3 // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=bounds     -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,BOUNDS
4 // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=memory     -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,MSAN
5 // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=thread     -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,TSAN
6 // RUN: %clang %s -target x86_64-unknown-linux-gnu -emit-llvm -S -fsanitize=undefined  -fsanitize-coverage=trace-pc,trace-cmp -o - | FileCheck %s --check-prefixes=CHECK,UBSAN
7 
8 int x[10];
9 
10 // CHECK-LABEL: define dso_local void @foo(
11 void foo(int n) {
12   // CHECK-DAG: call void @__sanitizer_cov_trace_pc
13   // CHECK-DAG: call void @__sanitizer_cov_trace_const_cmp
14   // ASAN-DAG: call void @__asan_report_store
15   // MSAN-DAG: call void @__msan_warning
16   // BOUNDS-DAG: call void @__ubsan_handle_out_of_bounds
17   // TSAN-DAG: call void @__tsan_func_entry
18   // UBSAN-DAG: call void @__ubsan_handle
19   if (n)
20     x[n] = 42;
21 }
22 // CHECK-LABEL: declare void
23