Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / lsan / TestCases / leak_check_at_exit.cpp
blobae33b41ffa6b87145630dacc62ecb389bcd736ec
1 // Test for the leak_check_at_exit flag.
2 // RUN: %clangxx_lsan %s -o %t
3 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
4 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-do
5 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0:leak_check_at_exit=0 not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
6 // RUN: %env_lsan_opts=use_stacks=0:use_registers=0:leak_check_at_exit=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <sanitizer/lsan_interface.h>
12 int main(int argc, char *argv[]) {
13 fprintf(stderr, "Test alloc: %p.\n", malloc(1337));
14 if (argc > 1)
15 __lsan_do_leak_check();
16 return 0;
19 // CHECK-do: SUMMARY: {{.*}}Sanitizer:
20 // CHECK-dont-NOT: SUMMARY: {{.*}}Sanitizer: