2 // RUN: split-file %s %t
3 // RUN: sed -e "s|DIR|%/t|g" %t/build/compile-commands.json.in > %t/build/compile-commands.json
4 // RUN: sed -e "s|DIR|%/t|g" %t/build/vfs.yaml.in > %t/build/vfs.yaml
5 // RUN: sed -e "s|DIR|%/t|g" %t/build/unused-vfs.yaml.in > %t/build/unused-vfs.yaml
6 // RUN: sed -e "s|DIR|%/t|g" %t/build/unused-vfs.yaml.in > %t/build/unused2-vfs.yaml
7 // RUN: clang-scan-deps -compilation-database %t/build/compile-commands.json \
8 // RUN: -j 1 -format experimental-full --optimize-args=vfs,header-search > %t/deps.db
9 // RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
11 // Check that unused -ivfsoverlay arguments are removed, and that used ones are
15 // CHECK-NEXT: "modules": [
17 // CHECK-NEXT: "clang-module-deps": [],
18 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/modules/A/module.modulemap",
19 // CHECK-NEXT: "command-line": [
20 // CHECK-NOT: "build/unused-vfs.yaml"
21 // CHECK: "-ivfsoverlay"
22 // CHECK-NEXT: "build/vfs.yaml"
23 // CHECK-NOT: "build/unused-vfs.yaml"
25 // CHECK-NEXT: "context-hash": "{{.*}}",
26 // CHECK-NEXT: "file-deps": [
27 // CHECK-NEXT: "[[PREFIX]]/build/module.modulemap",
28 // CHECK-NEXT: "[[PREFIX]]/build/A.h"
30 // CHECK-NEXT: "link-libraries": [],
31 // CHECK-NEXT: "name": "A"
34 // CHECK-NEXT: "clang-module-deps": [],
35 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/modules/B/module.modulemap",
36 // CHECK-NEXT: "command-line": [
37 // CHECK-NOT: "-ivfsoverlay"
39 // CHECK-NEXT: "context-hash": "{{.*}}",
40 // CHECK-NEXT: "file-deps": [
41 // CHECK-NEXT: "[[PREFIX]]/modules/B/module.modulemap",
42 // CHECK-NEXT: "[[PREFIX]]/modules/B/B.h"
44 // CHECK-NEXT: "link-libraries": [],
45 // CHECK-NEXT: "name": "B"
48 // CHECK-NEXT: "clang-module-deps": [
50 // CHECK-NEXT: "context-hash": "{{.*}}",
51 // CHECK-NEXT: "module-name": "B"
54 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/modules/C/module.modulemap",
55 // CHECK-NEXT: "command-line": [
56 // CHECK-NOT: "-ivfsoverlay"
58 // CHECK-NEXT: "context-hash": "{{.*}}",
59 // CHECK-NEXT: "file-deps": [
60 // CHECK-NEXT: "[[PREFIX]]/modules/C/module.modulemap",
61 // CHECK-NEXT: "[[PREFIX]]/modules/C/C.h",
62 // CHECK-NEXT: "[[PREFIX]]/modules/B/module.modulemap"
64 // CHECK-NEXT: "link-libraries": [],
65 // CHECK-NEXT: "name": "C"
68 // CHECK-NEXT: "translation-units": [
72 //--- build/compile-commands.json.in
77 "command": "clang -c DIR/0.m -Imodules/A -Imodules/B -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -ivfsoverlay build/unused-vfs.yaml -ivfsoverlay build/unused2-vfs.yaml -ivfsoverlay build/vfs.yaml",
82 "command": "clang -c DIR/A.m -Imodules/A -Imodules/B -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -ivfsoverlay build/vfs.yaml -ivfsoverlay build/unused-vfs.yaml",
87 "command": "clang -c DIR/B.m -Imodules/B -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -ivfsoverlay build/unused-vfs.yaml -ivfsoverlay build/vfs.yaml",
92 "command": "clang -c DIR/C.m -Imodules/A -Imodules/B -Imodules/C -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -ivfsoverlay build/vfs.yaml -ivfsoverlay build/unused-vfs.yaml",
97 //--- build/vfs.yaml.in
101 "case-sensitive":"false",
106 "external-contents":"DIR/build/module.modulemap",
107 "name":"module.modulemap",
111 "external-contents":"DIR/build/A.h",
116 "name":"DIR/modules/A",
122 //--- build/unused-vfs.yaml.in
126 "case-sensitive":"false",
131 "external-contents":"DIR/build/module.modulemap",
132 "name":"module.modulemap",
136 "name":"DIR/modules/D",
142 //--- build/module.modulemap
145 umbrella header "A.h"
152 //--- modules/B/module.modulemap
155 umbrella header "B.h"
162 //--- modules/C/module.modulemap
165 umbrella header "C.h"