blob: 6fc8e39354d4f8eee96cb9ceb82673547c99b350 [file] [log] [blame]
Marco Elver14de6e22020-05-26 12:51:46 -07001// 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
8int x[10];
9
10// CHECK-LABEL: define dso_local void @foo(
11void 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