1// REQUIRES: crash-recovery, shell, system-darwin
2//
3// RUN: rm -rf %t
4// RUN: mkdir -p %t/m %t/out
5
6// RUN: %clang_cc1 -x objective-c-header -emit-pch %S/Inputs/pch-used.h \
7// RUN:     -o %t/out/pch-used.h.pch -fmodules -fimplicit-module-maps \
8// RUN:     -fmodules-cache-path=%t/cache -O0 \
9// RUN:     -isystem %S/Inputs/System/usr/include
10
11// RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
12// RUN: not %clang %s -E -include-pch %t/out/pch-used.h.pch -fmodules -nostdlibinc \
13// RUN:     -fimplicit-module-maps -fmodules-cache-path=%t/cache -O0 \
14// RUN:     -Xclang -fno-validate-pch -isystem %S/Inputs/System/usr/include \
15// RUN:     -o %t/output.E 2>&1 | FileCheck %s
16
17// RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
18// RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
19// RUN:   %t/crash-vfs-*.cache/vfs/vfs.yaml
20
21void f() { SPXTrace(); }
22void g() { double x = DBL_MAX; }
23
24// CHECK: Preprocessed source(s) and associated run script(s) are located at:
25// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
26// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
27
28// CHECKSH: "-include-pch" "/[[INCPATH:.*]]/out/pch-used.h.pch"
29// CHECKSH: "crash-vfs-{{[^ ]*}}.m"
30// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
31// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
32
33// CHECKYAML: 'case-sensitive':
34// CHECKYAML-NEXT: 'use-external-names': 'false',
35// CHECKYAML-NEXT: 'overlay-relative': 'true',
36// CHECKYAML: 'type': 'directory'
37// CHECKYAML: 'name': "/[[PATH:.*]]/out",
38// CHECKYAML-NEXT: 'contents': [
39// CHECKYAML-NEXT:   {
40// CHECKYAML-NEXT:     'type': 'file',
41// CHECKYAML-NEXT:     'name': "pch-used.h.pch",
42// CHECKYAML-NEXT:     'external-contents': "/[[PATH]]/out/pch-used.h.pch"
43