[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / lsan / TestCases / link_turned_off.cpp
blobd700d7a40cb9353aa1e0e3592994281e827ca50a
1 // Test for disabling LSan at link-time.
2 // RUN: %clangxx_lsan %s -o %t
3 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t
4 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s
5 //
6 // UNSUPPORTED: darwin
8 #include <sanitizer/lsan_interface.h>
10 int argc_copy;
12 extern "C" {
13 int __attribute__((used)) __lsan_is_turned_off() {
14 return (argc_copy == 1);
18 int main(int argc, char *argv[]) {
19 volatile int *x = new int;
20 *x = 42;
21 argc_copy = argc;
22 return 0;
25 // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 4 byte(s) leaked in 1 allocation(s)