[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / crash-report-with-asserts.c
blob686c49f339fb75493b033efa29973d14afb8234e
1 // RUN: export LSAN_OPTIONS=detect_leaks=0
2 // RUN: rm -rf %t
3 // RUN: mkdir %t
5 // RUN: echo '-fsyntax-only \
6 // RUN: -F/tmp/ -I /tmp/ -idirafter /tmp/ -iquote /tmp/ -isystem /tmp/ \
7 // RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \
8 // RUN: -Xclang -internal-isystem -Xclang /tmp/ \
9 // RUN: -Xclang -internal-externc-isystem -Xclang /tmp/ \
10 // RUN: -Xclang -main-file-name -Xclang foo.c \
11 // RUN: -DFOO=BAR -DBAR="BAZ QUX"' > %t.rsp
13 // RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \
14 // RUN: CC_PRINT_HEADERS=1 CC_LOG_DIAGNOSTICS=1 \
15 // RUN: not %clang %s @%t.rsp -DASSERT 2>&1 | FileCheck %s
16 // RUN: cat %t/crash-report-*.c | FileCheck --check-prefix=CHECKSRC %s
17 // RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s
19 // RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \
20 // RUN: CC_PRINT_HEADERS=1 CC_LOG_DIAGNOSTICS=1 \
21 // RUN: not %clang %s @%t.rsp -DUNREACHABLE 2>&1 | FileCheck %s
22 // RUN: cat %t/crash-report-with-asserts-*.c | FileCheck --check-prefix=CHECKSRC %s
23 // RUN: cat %t/crash-report-with-asserts-*.sh | FileCheck --check-prefix=CHECKSH %s
25 // REQUIRES: crash-recovery, asserts
27 #ifdef ASSERT
28 #pragma clang __debug assert
29 #elif UNREACHABLE
30 #pragma clang __debug llvm_unreachable
31 #endif
33 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
34 // CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-with-asserts-{{.*}}.c
35 FOO
36 // CHECKSRC: FOO
37 // CHECKSH: # Crash reproducer
38 // CHECKSH-NEXT: # Driver args: {{.*}}"-fsyntax-only"
39 // CHECKSH-SAME: "-D" "FOO=BAR"
40 // CHECKSH-SAME: "-D" "BAR=BAZ QUX"
41 // CHECKSH-NEXT: # Original command: {{.*$}}
42 // CHECKSH-NEXT: "-cc1"
43 // CHECKSH: "-main-file-name" "crash-report-with-asserts.c"
44 // CHECKSH-NOT: "-header-include-file"
45 // CHECKSH-NOT: "-diagnostic-log-file"
46 // CHECKSH: "-D" "FOO=BAR"
47 // CHECKSH: "-D" "BAR=BAZ QUX"
48 // CHECKSH-NOT: "-F/tmp/"
49 // CHECKSH-NOT: "-I" "/tmp/"
50 // CHECKSH-NOT: "-idirafter" "/tmp/"
51 // CHECKSH-NOT: "-iquote" "/tmp/"
52 // CHECKSH-NOT: "-isystem" "/tmp/"
53 // CHECKSH-NOT: "-iprefix" "/the/prefix"
54 // CHECKSH-NOT: "-iwithprefix" "/tmp/"
55 // CHECKSH-NOT: "-iwithprefixbefore" "/tmp/"
56 // CHECKSH-NOT: "-internal-isystem" "/tmp/"
57 // CHECKSH-NOT: "-internal-externc-isystem" "/tmp/"
58 // CHECKSH-NOT: "-dwarf-debug-flags"
59 // CHECKSH: "crash-report-with-asserts-{{[^ ]*}}.c"