[LV] Add test showing debug output for loops with uncountable BTCs.
[llvm-project.git] / clang / test / ClangScanDeps / modules-incomplete-umbrella.c
blob696e621960b6f6e90e230a901fe24b93025156e8
1 // This test checks that modules loaded during compilation (but not imported)
2 // are still reported as dependencies.
4 // RUN: rm -rf %t && mkdir %t
5 // RUN: split-file %s %t
7 //--- frameworks/FW.framework/Modules/module.modulemap
8 framework module FW {
9 umbrella header "FW.h"
10 module * { export * }
12 //--- frameworks/FW.framework/Headers/FW.h
13 //--- frameworks/FW.framework/Modules/module.private.modulemap
14 framework module FW_Private {
15 umbrella header "FW_Private.h"
16 module * { export * }
18 //--- frameworks/FW.framework/PrivateHeaders/FW_Private.h
19 #include "One.h"
20 //--- frameworks/FW.framework/PrivateHeaders/One.h
21 //--- frameworks/FW.framework/PrivateHeaders/Two.h
23 // Let's check we report the non-imported modular dependencies for a translation unit.
25 //--- from_tu.cdb.json.template
27 "file": "DIR/from_tu.m",
28 "directory": "DIR",
29 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -F DIR/frameworks -c DIR/from_tu.m -o DIR/from_tu.o"
31 //--- from_tu.m
32 #include "FW/FW.h"
33 #include "FW/Two.h"
35 // RUN: sed -e "s|DIR|%/t|g" %t/from_tu.cdb.json.template > %t/from_tu.cdb.json
36 // RUN: clang-scan-deps -compilation-database %t/from_tu.cdb.json -format experimental-full > %t/from_tu_result.json
37 // RUN: cat %t/from_tu_result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefixes=CHECK_TU
38 // CHECK_TU: {
39 // CHECK_TU-NEXT: "modules": [
40 // CHECK_TU-NEXT: {
41 // CHECK_TU-NEXT: "clang-module-deps": [],
42 // CHECK_TU-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
43 // CHECK_TU-NEXT: "command-line": [
44 // CHECK_TU: ],
45 // CHECK_TU-NEXT: "context-hash": "{{.*}}",
46 // CHECK_TU-NEXT: "file-deps": [
47 // CHECK_TU-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
48 // CHECK_TU-NEXT: "[[PREFIX]]/frameworks/FW.framework/Headers/FW.h"
49 // CHECK_TU-NEXT: ],
50 // CHECK_TU-NEXT: "link-libraries": [
51 // CHECK_TU-NEXT: {
52 // CHECK_TU-NEXT: "isFramework": true,
53 // CHECK_TU-NEXT: "link-name": "FW"
54 // CHECK_TU-NEXT: }
55 // CHECK_TU-NEXT: ],
56 // CHECK_TU-NEXT: "name": "FW"
57 // CHECK_TU-NEXT: },
58 // CHECK_TU-NEXT: {
59 // CHECK_TU-NEXT: "clang-module-deps": [],
60 // CHECK_TU-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
61 // CHECK_TU-NEXT: "command-line": [
62 // CHECK_TU: ],
63 // CHECK_TU-NEXT: "context-hash": "{{.*}}",
64 // CHECK_TU-NEXT: "file-deps": [
65 // CHECK_TU-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
66 // CHECK_TU-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/FW_Private.h",
67 // CHECK_TU-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/One.h"
68 // CHECK_TU-NEXT: ],
69 // CHECK_TU-NEXT: "link-libraries": [
70 // CHECK_TU-NEXT: {
71 // CHECK_TU-NEXT: "isFramework": true,
72 // CHECK_TU-NEXT: "link-name": "FW"
73 // CHECK_TU-NEXT: }
74 // CHECK_TU-NEXT: ],
75 // CHECK_TU-NEXT: "name": "FW_Private"
76 // CHECK_TU-NEXT: }
77 // CHECK_TU-NEXT: ],
78 // CHECK_TU-NEXT: "translation-units": [
79 // CHECK_TU-NEXT: {
80 // CHECK_TU: "clang-context-hash": "{{.*}}",
81 // CHECK_TU-NEXT: "clang-module-deps": [
82 // CHECK_TU-NEXT: {
83 // CHECK_TU-NEXT: "context-hash": "{{.*}}",
84 // CHECK_TU-NEXT: "module-name": "FW"
85 // CHECK_TU-NEXT: },
86 // CHECK_TU-NEXT: {
87 // CHECK_TU-NEXT: "context-hash": "{{.*}}",
88 // CHECK_TU-NEXT: "module-name": "FW_Private"
89 // CHECK_TU-NEXT: }
90 // CHECK_TU-NEXT: ],
91 // CHECK_TU-NEXT: "command-line": [
92 // CHECK_TU: "-fmodule-file={{.*}}/FW-{{.*}}.pcm"
93 // CHECK_TU: "-fmodule-file={{.*}}/FW_Private-{{.*}}.pcm"
94 // CHECK_TU: ],
95 // CHECK_TU: "file-deps": [
96 // CHECK_TU-NEXT: "[[PREFIX]]/from_tu.m",
97 // CHECK_TU-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/Two.h"
98 // CHECK_TU-NEXT: ],
99 // CHECK_TU-NEXT: "input-file": "[[PREFIX]]/from_tu.m"
100 // CHECK_TU-NEXT: }
102 // RUN: %deps-to-rsp %t/from_tu_result.json --module-name=FW > %t/FW.cc1.rsp
103 // RUN: %deps-to-rsp %t/from_tu_result.json --module-name=FW_Private > %t/FW_Private.cc1.rsp
104 // RUN: %deps-to-rsp %t/from_tu_result.json --tu-index=0 > %t/tu.rsp
105 // RUN: %clang @%t/FW.cc1.rsp
106 // RUN: %clang @%t/FW_Private.cc1.rsp
107 // RUN: %clang @%t/tu.rsp
109 // Now let's check we report the dependencies for modules as well.
111 //--- from_module.cdb.json.template
113 "file": "DIR/from_module.m",
114 "directory": "DIR",
115 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -F DIR/frameworks -c DIR/from_module.m -o DIR/from_module.o"
117 //--- module.modulemap
118 module Mod { header "Mod.h" }
119 //--- Mod.h
120 #include "FW/FW.h"
121 #include "FW/Two.h"
122 //--- from_module.m
123 #include "Mod.h"
125 // RUN: sed -e "s|DIR|%/t|g" %t/from_module.cdb.json.template > %t/from_module.cdb.json
126 // RUN: clang-scan-deps -compilation-database %t/from_module.cdb.json -format experimental-full > %t/from_module_result.json
127 // RUN: cat %t/from_module_result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefixes=CHECK_MODULE
128 // CHECK_MODULE: {
129 // CHECK_MODULE-NEXT: "modules": [
130 // CHECK_MODULE-NEXT: {
131 // CHECK_MODULE-NEXT: "clang-module-deps": [],
132 // CHECK_MODULE-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
133 // CHECK_MODULE-NEXT: "command-line": [
134 // CHECK_MODULE: ],
135 // CHECK_MODULE-NEXT: "context-hash": "{{.*}}",
136 // CHECK_MODULE-NEXT: "file-deps": [
137 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
138 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/Headers/FW.h"
139 // CHECK_MODULE-NEXT: ],
140 // CHECK_MODULE-NEXT: "link-libraries": [
141 // CHECK_MODULE-NEXT: {
142 // CHECK_MODULE-NEXT: "isFramework": true,
143 // CHECK_MODULE-NEXT: "link-name": "FW"
144 // CHECK_MODULE-NEXT: }
145 // CHECK_MODULE-NEXT: ],
146 // CHECK_MODULE-NEXT: "name": "FW"
147 // CHECK_MODULE-NEXT: },
148 // CHECK_MODULE-NEXT: {
149 // CHECK_MODULE-NEXT: "clang-module-deps": [],
150 // CHECK_MODULE-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
151 // CHECK_MODULE-NEXT: "command-line": [
152 // CHECK_MODULE: ],
153 // CHECK_MODULE-NEXT: "context-hash": "{{.*}}",
154 // CHECK_MODULE-NEXT: "file-deps": [
155 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
156 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/FW_Private.h",
157 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/One.h"
158 // CHECK_MODULE-NEXT: ],
159 // CHECK_MODULE-NEXT: "link-libraries": [
160 // CHECK_MODULE-NEXT: {
161 // CHECK_MODULE-NEXT: "isFramework": true,
162 // CHECK_MODULE-NEXT: "link-name": "FW"
163 // CHECK_MODULE-NEXT: }
164 // CHECK_MODULE-NEXT: ],
165 // CHECK_MODULE-NEXT: "name": "FW_Private"
166 // CHECK_MODULE-NEXT: },
167 // CHECK_MODULE-NEXT: {
168 // CHECK_MODULE-NEXT: "clang-module-deps": [
169 // CHECK_MODULE-NEXT: {
170 // CHECK_MODULE-NEXT: "context-hash": "{{.*}}",
171 // CHECK_MODULE-NEXT: "module-name": "FW"
172 // CHECK_MODULE-NEXT: },
173 // CHECK_MODULE-NEXT: {
174 // CHECK_MODULE-NEXT: "context-hash": "{{.*}}",
175 // CHECK_MODULE-NEXT: "module-name": "FW_Private"
176 // CHECK_MODULE-NEXT: }
177 // CHECK_MODULE-NEXT: ],
178 // CHECK_MODULE-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
179 // CHECK_MODULE-NEXT: "command-line": [
180 // CHECK_MODULE: "-fmodule-file={{.*}}/FW-{{.*}}.pcm"
181 // CHECK_MODULE: "-fmodule-file={{.*}}/FW_Private-{{.*}}.pcm"
182 // CHECK_MODULE: ],
183 // CHECK_MODULE-NEXT: "context-hash": "{{.*}}",
184 // CHECK_MODULE-NEXT: "file-deps": [
185 // CHECK_MODULE-NEXT: "[[PREFIX]]/module.modulemap"
186 // CHECK_MODULE-NEXT: "[[PREFIX]]/Mod.h",
187 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
188 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
189 // CHECK_MODULE-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/Two.h"
190 // CHECK_MODULE-NEXT: ],
191 // CHECK_MODULE-NEXT: "link-libraries": [],
192 // CHECK_MODULE-NEXT: "name": "Mod"
193 // CHECK_MODULE-NEXT: }
194 // CHECK_MODULE-NEXT: ],
195 // CHECK_MODULE-NEXT: "translation-units": [
196 // CHECK_MODULE-NEXT: {
197 // CHECK_MODULE: "clang-context-hash": "{{.*}}",
198 // CHECK_MODULE-NEXT: "clang-module-deps": [
199 // CHECK_MODULE-NEXT: {
200 // CHECK_MODULE-NEXT: "context-hash": "{{.*}}",
201 // CHECK_MODULE-NEXT: "module-name": "Mod"
202 // CHECK_MODULE-NEXT: }
203 // CHECK_MODULE-NEXT: ],
204 // CHECK_MODULE-NEXT: "command-line": [
205 // CHECK_MODULE: ],
206 // CHECK_MODULE: "file-deps": [
207 // CHECK_MODULE-NEXT: "[[PREFIX]]/from_module.m"
208 // CHECK_MODULE-NEXT: ],
209 // CHECK_MODULE-NEXT: "input-file": "[[PREFIX]]/from_module.m"
210 // CHECK_MODULE-NEXT: }
212 // RUN: %deps-to-rsp %t/from_module_result.json --module-name=FW > %t/FW.cc1.rsp
213 // RUN: %deps-to-rsp %t/from_module_result.json --module-name=FW_Private > %t/FW_Private.cc1.rsp
214 // RUN: %deps-to-rsp %t/from_module_result.json --module-name=Mod > %t/Mod.cc1.rsp
215 // RUN: %deps-to-rsp %t/from_module_result.json --tu-index=0 > %t/tu.rsp
216 // RUN: %clang @%t/FW.cc1.rsp
217 // RUN: %clang @%t/FW_Private.cc1.rsp
218 // RUN: %clang @%t/Mod.cc1.rsp
219 // RUN: %clang @%t/tu.rsp