2 // RUN: split-file %s %t
7 //--- zeroth/module.modulemap
8 module zeroth { header "zeroth.h" }
13 //--- first/module.modulemap
15 module first_other { header "first_other.h" }
16 //--- first/first_other.h
18 //--- second/module.modulemap
19 extern module second "second.modulemap"
20 //--- second/second.modulemap
21 module second { header "second.h" }
23 #include "first_other.h"
25 //--- cdb.json.template
29 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR/zeroth -I DIR/first -I DIR/second -c DIR/tu.m -o DIR/tu.o"
32 // RUN: sed -e "s|DIR|%/t|g" -e "s|INPUTS|%/S/Inputs|g" %t/cdb.json.template > %t/cdb.json
33 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
34 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
37 // CHECK-NEXT: "modules": [
39 // CHECK-NEXT: "clang-module-deps": [],
40 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",
41 // CHECK-NEXT: "command-line": [
43 // CHECK-NEXT: "context-hash": "{{.*}}",
44 // CHECK-NEXT: "file-deps": [
45 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap"
47 // CHECK-NEXT: "name": "first"
50 // CHECK-NEXT: "clang-module-deps": [],
51 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",
52 // CHECK-NEXT: "command-line": [
54 // CHECK-NEXT: "context-hash": "{{.*}}",
55 // CHECK-NEXT: "file-deps": [
56 // CHECK-NEXT: "[[PREFIX]]/first/first_other.h",
57 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap"
59 // CHECK-NEXT: "name": "first_other"
62 // CHECK-NEXT: "clang-module-deps": [
64 // CHECK-NEXT: "context-hash": "{{.*}}",
65 // CHECK-NEXT: "module-name": "first_other"
68 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/second/second.modulemap",
69 // CHECK-NEXT: "command-line": [
71 // CHECK-NEXT: "context-hash": "{{.*}}",
72 // CHECK-NEXT: "file-deps": [
73 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap",
74 // CHECK-NEXT: "[[PREFIX]]/second/second.h",
75 // CHECK-NEXT: "[[PREFIX]]/second/second.modulemap"
77 // CHECK-NEXT: "name": "second"
80 // CHECK-NEXT: "clang-module-deps": [
82 // CHECK-NEXT: "context-hash": "{{.*}}",
83 // CHECK-NEXT: "module-name": "first"
86 // CHECK-NEXT: "context-hash": "{{.*}}",
87 // CHECK-NEXT: "module-name": "second"
90 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/zeroth/module.modulemap",
91 // CHECK-NEXT: "command-line": [
93 // CHECK-NEXT: "context-hash": "{{.*}}",
94 // CHECK-NEXT: "file-deps": [
95 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap",
96 // CHECK-NEXT: "[[PREFIX]]/second/module.modulemap",
97 // CHECK-NEXT: "[[PREFIX]]/second/second.modulemap",
98 // CHECK-NEXT: "[[PREFIX]]/zeroth/module.modulemap",
99 // CHECK-NEXT: "[[PREFIX]]/zeroth/zeroth.h"
101 // CHECK-NEXT: "name": "zeroth"
104 // CHECK-NEXT: "translation-units": [
106 // CHECK-NEXT: "commands": [
108 // CHECK-NEXT: "clang-context-hash": "{{.*}}",
109 // CHECK-NEXT: "clang-module-deps": [
111 // CHECK-NEXT: "context-hash": "{{.*}}",
112 // CHECK-NEXT: "module-name": "zeroth"
115 // CHECK-NEXT: "command-line": [
117 // CHECK-NEXT: "executable": "clang",
118 // CHECK-NEXT: "file-deps": [
119 // CHECK-NEXT: "[[PREFIX]]/tu.m"
121 // CHECK-NEXT: "input-file": "[[PREFIX]]/tu.m"
128 // RUN: %deps-to-rsp --module-name=first %t/result.json > %t/first.cc1.rsp
129 // RUN: %deps-to-rsp --module-name=first_other %t/result.json > %t/first_other.cc1.rsp
130 // RUN: %deps-to-rsp --module-name=second %t/result.json > %t/second.cc1.rsp
131 // RUN: %deps-to-rsp --module-name=zeroth %t/result.json > %t/zeroth.cc1.rsp
132 // RUN: %clang @%t/first.cc1.rsp
133 // RUN: %clang @%t/first_other.cc1.rsp
134 // RUN: %clang @%t/second.cc1.rsp
135 // RUN: %clang @%t/zeroth.cc1.rsp