[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / clang / test / ClangScanDeps / optimize-vfs.m
blob2043a603179fe895bbeedfecbf0197a6ce26c7f9
1 // RUN: rm -rf %t
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
12 // not.
14 // CHECK:      {
15 // CHECK-NEXT:   "modules": [
16 // CHECK-NEXT:     {
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"
24 // CHECK:            ],
25 // CHECK-NEXT:       "context-hash": "{{.*}}",
26 // CHECK-NEXT:       "file-deps": [
27 // CHECK-NEXT:         "[[PREFIX]]/build/module.modulemap",
28 // CHECK-NEXT:         "[[PREFIX]]/build/A.h"
29 // CHECK-NEXT:       ],
30 // CHECK-NEXT:       "link-libraries": [],
31 // CHECK-NEXT:       "name": "A"
32 // CHECK-NEXT:     },
33 // CHECK-NEXT:     {
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"
38 // CHECK:            ],
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"
43 // CHECK-NEXT:       ],
44 // CHECK-NEXT:       "link-libraries": [],
45 // CHECK-NEXT:       "name": "B"
46 // CHECK-NEXT:     },
47 // CHECK-NEXT:     {
48 // CHECK-NEXT:       "clang-module-deps": [
49 // CHECK-NEXT:         {
50 // CHECK-NEXT:           "context-hash": "{{.*}}",
51 // CHECK-NEXT:           "module-name": "B"
52 // CHECK-NEXT:         }
53 // CHECK-NEXT:       ],
54 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/modules/C/module.modulemap",
55 // CHECK-NEXT:       "command-line": [
56 // CHECK-NOT:          "-ivfsoverlay"
57 // CHECK:            ],
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"
63 // CHECK-NEXT:       ],
64 // CHECK-NEXT:       "link-libraries": [],
65 // CHECK-NEXT:       "name": "C"
66 // CHECK-NEXT:     }
67 // CHECK-NEXT:   ],
68 // CHECK-NEXT:   "translation-units": [
69 // CHECK:        ]
70 // CHECK:      }
72 //--- build/compile-commands.json.in
76   "directory": "DIR",
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",
78   "file": "DIR/0.m"
81   "directory": "DIR",
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",
83   "file": "DIR/A.m"
86   "directory": "DIR",
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",
88   "file": "DIR/B.m"
91   "directory": "DIR",
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",
93   "file": "DIR/C.m"
97 //--- build/vfs.yaml.in
100    "version":0,
101    "case-sensitive":"false",
102    "roots":[
103       {
104          "contents":[
105             {
106                "external-contents":"DIR/build/module.modulemap",
107                "name":"module.modulemap",
108                "type":"file"
109             },
110             {
111                "external-contents":"DIR/build/A.h",
112                "name":"A.h",
113                "type":"file"
114             }
115          ],
116          "name":"DIR/modules/A",
117          "type":"directory"
118       }
119    ]
122 //--- build/unused-vfs.yaml.in
125    "version":0,
126    "case-sensitive":"false",
127    "roots":[
128       {
129          "contents":[
130             {
131                "external-contents":"DIR/build/module.modulemap",
132                "name":"module.modulemap",
133                "type":"file"
134             }
135          ],
136          "name":"DIR/modules/D",
137          "type":"directory"
138       }
139    ]
142 //--- build/module.modulemap
144 module A {
145   umbrella header "A.h"
148 //--- build/A.h
150 typedef int A_t;
152 //--- modules/B/module.modulemap
154 module B {
155   umbrella header "B.h"
158 //--- modules/B/B.h
160 typedef int B_t;
162 //--- modules/C/module.modulemap
164 module C {
165   umbrella header "C.h"
168 //--- modules/C/C.h
170 @import B;
172 typedef B_t C_t;
174 //--- 0.m
176 #include <A.h>
178 A_t a = 0;
180 //--- A.m
182 #include <A.h>
184 A_t a = 0;
186 //--- B.m
188 #include <B.h>
190 B_t b = 0;
192 //--- C.m
194 #include <C.h>
196 C_t b = 0;