[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / fuzzer.c
blob409fbfac8ce1d0c2c9ce6a4cd6117eda052e76ae
1 // Test flags inserted by -fsanitize=fuzzer.
3 // RUN: %clang -fsanitize=fuzzer %s -target x86_64-apple-darwin14 -### 2>&1 | FileCheck --check-prefixes=CHECK-FUZZER-LIB,CHECK-COVERAGE %s
4 //
5 // CHECK-COVERAGE: -fsanitize-coverage-indirect-calls
6 // CHECK-COVERAGE-SAME: -fsanitize-coverage-trace-cmp
7 // CHECK-COVERAGE-SAME: -fsanitize-coverage-inline-8bit-counters
8 // CHECK-COVERAGE-SAME: -fsanitize-coverage-pc-table
9 // CHECK-FUZZER-LIB: libclang_rt.fuzzer
11 // RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=platform %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-LINUX %s
13 // CHECK-LIBCXX-LINUX: -lstdc++
15 // RUN: %clang -target x86_64-apple-darwin14 -fsanitize=fuzzer %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DARWIN %s
17 // CHECK-LIBCXX-DARWIN: -lc++
20 // Check that we don't link in libFuzzer.a when producing a shared object.
21 // RUN: %clang --target=x86_64-linux-gnu -fsanitize=fuzzer %s -shared -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB-SO %s
22 // CHECK-NOLIB-SO-NOT: libclang_rt.libfuzzer
24 // Check that we don't link in libFuzzer when compiling with -fsanitize=fuzzer-no-link.
25 // RUN: %clang -fsanitize=fuzzer-no-link %s -target x86_64-apple-darwin14 -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB,CHECK-COV %s
26 // CHECK-NOLIB-NOT: libclang_rt.libfuzzer
27 // CHECK-COV: -fsanitize-coverage-inline-8bit-counters
29 // Check that we respect whether thes tandard library should be linked
30 // statically.
32 // RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBSTDCXX-DYNAMIC %s
33 // CHECK-LIBSTDCXX-DYNAMIC-NOT: -Bstatic
34 // CHECK-LIBSTDCXX-DYNAMIC: -lstdc++
36 // RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libstdc++ -static-libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBSTDCXX-STATIC %s
37 // CHECK-LIBSTDCXX-STATIC: "-Bstatic" "-lstdc++"
39 // RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DYNAMIC %s
40 // CHECK-LIBCXX-DYNAMIC-NOT: -Bstatic
41 // CHECK-LIBCXX-DYNAMIC: -lc++
43 // RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libc++ -static-libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-STATIC %s
44 // CHECK-LIBCXX-STATIC: "-Bstatic" "-lc++"
46 int LLVMFuzzerTestOneInput(const char *Data, long Size) {
47 return 0;