xref: /llvm-project/clang/test/ClangScanDeps/modulemap-via-vfs.m (revision b00de4dd4156874fd5c163e9cecd69a54e45e083)
1// RUN: rm -rf %t.dir
2// RUN: split-file %s %t.dir
3// RUN: sed -e "s|DIR|%/t.dir|g" %t.dir/build/compile-commands.json.in > %t.dir/build/compile-commands.json
4// RUN: sed -e "s|DIR|%/t.dir|g" %t.dir/build/vfs.yaml.in > %t.dir/build/vfs.yaml
5// RUN: clang-scan-deps -compilation-database %t.dir/build/compile-commands.json \
6// RUN:   -j 1 -format experimental-full -mode preprocess-dependency-directives > %t.db
7// RUN: %deps-to-rsp %t.db --module-name=A > %t.A.cc1.rsp
8// RUN: cat %t.A.cc1.rsp | sed 's:\\\\\?:/:g' | FileCheck %s
9
10// CHECK-NOT: build/module.modulemap
11// CHECK: A/module.modulemap
12// CHECK-NOT: build/module.modulemap
13
14//--- build/compile-commands.json.in
15
16[
17{
18  "directory": "DIR",
19  "command": "clang DIR/main.m -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -ivfsoverlay build/vfs.yaml",
20  "file": "DIR/main.m"
21},
22{
23  "directory": "DIR",
24  "command": "clang DIR/main.m -Imodules/A -fmodules -Xclang -fno-modules-share-filemanager -fmodules-cache-path=DIR/module-cache-unshared -fimplicit-modules -fimplicit-module-maps -ivfsoverlay build/vfs.yaml",
25  "file": "DIR/main.m"
26}
27]
28
29//--- build/module.modulemap
30
31module A {
32  umbrella header "A.h"
33}
34
35//--- modules/A/A.h
36
37typedef int A_t;
38
39//--- build/vfs.yaml.in
40
41{
42  "version": 0,
43  "case-sensitive": "false",
44  "use-external-names": true,
45  "roots": [
46  {
47     "contents": [
48     {
49        "external-contents": "DIR/build/module.modulemap",
50        "name": "module.modulemap",
51        "type": "file"
52     }],
53     "name": "DIR/modules/A",
54     "type": "directory"
55  }
56  ]
57}
58
59//--- main.m
60
61@import A;
62
63A_t a = 0;
64