1 // This test checks that only module map files defining affecting modules are
5 // RUN: split-file %s %t
10 //--- zeroth/module.modulemap
11 module zeroth { header "zeroth.h" }
16 //--- first/module.modulemap
18 module first_other { header "first_other.h" }
19 //--- first/first_other.h
21 //--- second/module.modulemap
22 extern module second "second.modulemap"
23 //--- second/second.modulemap
24 module second { header "second.h" }
26 #include "first_other.h"
28 // RUN: clang-scan-deps -format experimental-full -o %t/result.json \
29 // RUN: -- %clang -fmodules -fmodules-cache-path=%t/cache -I %t/zeroth -I %t/first -I %t/second -c %t/tu.m -o %t/tu.o
30 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
33 // CHECK-NEXT: "modules": [
35 // CHECK-NEXT: "clang-module-deps": [],
36 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",
37 // CHECK-NEXT: "command-line": [
39 // CHECK-NEXT: "context-hash": "{{.*}}",
40 // CHECK-NEXT: "file-deps": [
41 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap"
43 // CHECK-NEXT: "link-libraries": [],
44 // CHECK-NEXT: "name": "first"
47 // CHECK-NEXT: "clang-module-deps": [],
48 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",
49 // CHECK-NEXT: "command-line": [
51 // CHECK-NEXT: "context-hash": "{{.*}}",
52 // CHECK-NEXT: "file-deps": [
53 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap",
54 // CHECK-NEXT: "[[PREFIX]]/first/first_other.h"
56 // CHECK-NEXT: "link-libraries": [],
57 // CHECK-NEXT: "name": "first_other"
60 // CHECK-NEXT: "clang-module-deps": [
62 // CHECK-NEXT: "context-hash": "{{.*}}",
63 // CHECK-NEXT: "module-name": "first_other"
66 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/second/second.modulemap",
67 // CHECK-NEXT: "command-line": [
68 // CHECK-NOT: "-fmodule-map-file=[[PREFIX]]/second/module.modulemap"
70 // CHECK-NEXT: "context-hash": "{{.*}}",
71 // CHECK-NEXT: "file-deps": [
72 // CHECK-NEXT: "[[PREFIX]]/second/second.modulemap",
73 // CHECK-NEXT: "[[PREFIX]]/second/second.h",
74 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap"
76 // CHECK-NEXT: "link-libraries": [],
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": [
92 // CHECK-NOT: "-fmodule-map-file=[[PREFIX]]/second/module.modulemap"
94 // CHECK-NEXT: "context-hash": "{{.*}}",
95 // CHECK-NEXT: "file-deps": [
96 // CHECK-NEXT: "[[PREFIX]]/zeroth/module.modulemap",
97 // CHECK-NEXT: "[[PREFIX]]/zeroth/zeroth.h",
98 // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap",
99 // CHECK-NEXT: "[[PREFIX]]/second/second.modulemap"
101 // CHECK-NEXT: "link-libraries": [],
102 // CHECK-NEXT: "name": "zeroth"
105 // CHECK-NEXT: "translation-units": [
107 // CHECK-NEXT: "commands": [
109 // CHECK-NEXT: "clang-context-hash": "{{.*}}",
110 // CHECK-NEXT: "clang-module-deps": [
112 // CHECK-NEXT: "context-hash": "{{.*}}",
113 // CHECK-NEXT: "module-name": "zeroth"
116 // CHECK-NEXT: "command-line": [
118 // CHECK-NEXT: "executable": "{{.*}}",
119 // CHECK-NEXT: "file-deps": [
120 // CHECK-NEXT: "[[PREFIX]]/tu.m"
122 // CHECK-NEXT: "input-file": "[[PREFIX]]/tu.m"
129 // RUN: %deps-to-rsp --module-name=first %t/result.json > %t/first.cc1.rsp
130 // RUN: %deps-to-rsp --module-name=first_other %t/result.json > %t/first_other.cc1.rsp
131 // RUN: %deps-to-rsp --module-name=second %t/result.json > %t/second.cc1.rsp
132 // RUN: %deps-to-rsp --module-name=zeroth %t/result.json > %t/zeroth.cc1.rsp
133 // RUN: %clang @%t/first.cc1.rsp
134 // RUN: %clang @%t/first_other.cc1.rsp
135 // RUN: %clang @%t/second.cc1.rsp
136 // RUN: %clang @%t/zeroth.cc1.rsp