[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / ClangScanDeps / modules-full.cpp
blob59efef0ecbaa64fce41cfe3b474d1642e6718055
1 // RUN: rm -rf %t.dir
2 // RUN: rm -rf %t.cdb
3 // RUN: mkdir -p %t.dir
4 // RUN: cp %s %t.dir/modules_cdb_input.cpp
5 // RUN: cp %s %t.dir/modules_cdb_input2.cpp
6 // RUN: mkdir %t.dir/Inputs
7 // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
8 // RUN: cp %S/Inputs/header2.h %t.dir/Inputs/header2.h
9 // RUN: cp %S/Inputs/module.modulemap %t.dir/Inputs/module.modulemap
10 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb.json > %t.cdb
11 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl.json > %t_clangcl.cdb
13 // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
14 // RUN: -mode preprocess-dependency-directives > %t.result
15 // RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir %s
17 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \
18 // RUN: -mode preprocess-dependency-directives > %t_clangcl.result
19 // RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir %s
21 #include "header.h"
23 // CHECK: {
24 // CHECK-NEXT: "modules": [
25 // CHECK-NEXT: {
26 // CHECK-NEXT: "clang-module-deps": [
27 // CHECK-NEXT: {
28 // CHECK-NEXT: "context-hash": "[[HASH_H2_DINCLUDE:[A-Z0-9]+]]",
29 // CHECK-NEXT: "module-name": "header2"
30 // CHECK-NEXT: }
31 // CHECK-NEXT: ],
32 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap",
33 // CHECK-NEXT: "command-line": [
34 // CHECK-NEXT: "-cc1"
35 // CHECK: "-emit-module"
36 // CHECK: "-fmodule-file={{.*}}[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H2_DINCLUDE]]/header2-{{[A-Z0-9]+}}.pcm"
37 // CHECK-NOT: "-fimplicit-module-maps"
38 // CHECK: "-fmodule-name=header1"
39 // CHECK: "-fno-implicit-modules"
40 // CHECK: ],
41 // CHECK-NEXT: "context-hash": "[[HASH_H1_DINCLUDE:[A-Z0-9]+]]",
42 // CHECK-NEXT: "file-deps": [
43 // CHECK-NEXT: "[[PREFIX]]/Inputs/header.h",
44 // CHECK-NEXT: "[[PREFIX]]/Inputs/module.modulemap"
45 // CHECK-NEXT: ],
46 // CHECK-NEXT: "name": "header1"
47 // CHECK-NEXT: },
48 // CHECK-NEXT: {
49 // CHECK-NEXT: "clang-module-deps": [],
50 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap",
51 // CHECK-NEXT: "command-line": [
52 // CHECK-NEXT: "-cc1",
53 // CHECK: "-emit-module",
54 // CHECK-NOT: "-fimplicit-module-maps",
55 // CHECK: "-fmodule-name=header1",
56 // CHECK: "-fno-implicit-modules",
57 // CHECK: ],
58 // CHECK-NEXT: "context-hash": "[[HASH_H1:[A-Z0-9]+]]",
59 // CHECK-NEXT: "file-deps": [
60 // CHECK-NEXT: "[[PREFIX]]/Inputs/header.h",
61 // CHECK-NEXT: "[[PREFIX]]/Inputs/module.modulemap"
62 // CHECK-NEXT: ],
63 // CHECK-NEXT: "name": "header1"
64 // CHECK-NEXT: },
65 // CHECK-NEXT: {
66 // CHECK-NEXT: "clang-module-deps": [],
67 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap",
68 // CHECK-NEXT: "command-line": [
69 // CHECK-NEXT: "-cc1",
70 // CHECK: "-emit-module",
71 // CHECK: "-fmodule-name=header2",
72 // CHECK-NOT: "-fimplicit-module-maps",
73 // CHECK: "-fno-implicit-modules",
74 // CHECK: ],
75 // CHECK-NEXT: "context-hash": "[[HASH_H2_DINCLUDE]]",
76 // CHECK-NEXT: "file-deps": [
77 // CHECK-NEXT: "[[PREFIX]]/Inputs/header2.h",
78 // CHECK-NEXT: "[[PREFIX]]/Inputs/module.modulemap"
79 // CHECK-NEXT: ],
80 // CHECK-NEXT: "name": "header2"
81 // CHECK-NEXT: }
82 // CHECK-NEXT: ],
83 // CHECK-NEXT: "translation-units": [
84 // CHECK-NEXT: {
85 // CHECK-NEXT: "commands": [
86 // CHECK-NEXT: {
87 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU_DINCLUDE:[A-Z0-9]+]]",
88 // CHECK-NEXT: "clang-module-deps": [
89 // CHECK-NEXT: {
90 // CHECK-NEXT: "context-hash": "[[HASH_H1_DINCLUDE]]",
91 // CHECK-NEXT: "module-name": "header1"
92 // CHECK-NEXT: }
93 // CHECK-NEXT: ],
94 // CHECK-NEXT: "command-line": [
95 // CHECK-NOT: "-fimplicit-modules"
96 // CHECK-NOT: "-fimplicit-module-maps"
97 // CHECK: "-fmodule-file={{.*}}[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1_DINCLUDE]]/header1-{{[A-Z0-9]+}}.pcm"
98 // CHECK: ],
99 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
100 // CHECK-NEXT: "file-deps": [
101 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input2.cpp"
102 // CHECK-NEXT: ],
103 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input2.cpp"
104 // CHECK-NEXT: }
105 // CHECK-NEXT: ]
106 // CHECK-NEXT: },
107 // CHECK-NEXT: {
108 // CHECK-NEXT: "commands": [
109 // CHECK-NEXT: {
110 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU:[A-Z0-9]+]]",
111 // CHECK-NEXT: "clang-module-deps": [
112 // CHECK-NEXT: {
113 // CHECK-NEXT: "context-hash": "[[HASH_H1]]",
114 // CHECK-NEXT: "module-name": "header1"
115 // CHECK-NEXT: }
116 // CHECK-NEXT: ],
117 // CHECK-NEXT: "command-line": [
118 // CHECK-NOT: "-fimplicit-modules"
119 // CHECK-NOT: "-fimplicit-module-maps"
120 // CHECK: "-fmodule-file={{.*}}[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
121 // CHECK: ],
122 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
123 // CHECK-NEXT: "file-deps": [
124 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input.cpp"
125 // CHECK-NEXT: ],
126 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input.cpp"
127 // CHECK-NEXT: }
128 // CHECK-NEXT: ]
129 // CHECK-NEXT: },
130 // CHECK-NEXT: {
131 // CHECK-NEXT: "commands": [
132 // CHECK-NEXT: {
133 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU:[A-Z0-9]+]]",
134 // CHECK-NEXT: "clang-module-deps": [
135 // CHECK-NEXT: {
136 // CHECK-NEXT: "context-hash": "[[HASH_H1]]",
137 // CHECK-NEXT: "module-name": "header1"
138 // CHECK-NEXT: }
139 // CHECK-NEXT: ],
140 // CHECK-NEXT: "command-line": [
141 // CHECK-NOT: "-fimplicit-modules"
142 // CHECK-NOT: "-fimplicit-module-maps"
143 // CHECK: "-fmodule-file={{.*}}[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
144 // CHECK: ],
145 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
146 // CHECK-NEXT: "file-deps": [
147 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input.cpp"
148 // CHECK-NEXT: ],
149 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input.cpp"
150 // CHECK-NEXT: }
151 // CHECK-NEXT: ]
152 // CHECK-NEXT: },
153 // CHECK-NEXT: {
154 // CHECK-NEXT: "commands": [
155 // CHECK-NEXT: {
156 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU:[A-Z0-9]+]]",
157 // CHECK-NEXT: "clang-module-deps": [
158 // CHECK-NEXT: {
159 // CHECK-NEXT: "context-hash": "[[HASH_H1]]",
160 // CHECK-NEXT: "module-name": "header1"
161 // CHECK-NEXT: }
162 // CHECK-NEXT: ],
163 // CHECK-NEXT: "command-line": [
164 // CHECK-NOT: "-fimplicit-modules"
165 // CHECK-NOT: "-fimplicit-module-maps"
166 // CHECK: "-fmodule-file={{.*}}[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
167 // CHECK: ],
168 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
169 // CHECK-NEXT: "file-deps": [
170 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input.cpp"
171 // CHECK-NEXT: ],
172 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input.cpp"
173 // CHECK-NEXT: }
174 // CHECK-NEXT: ]
175 // CHECK-NEXT: }
176 // CHECK-NEXT: ]
177 // CHECK-NEXT: }