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
24 // CHECK-NEXT: "modules": [
26 // CHECK-NEXT: "clang-module-deps": [
28 // CHECK-NEXT: "context-hash": "[[HASH_H2_DINCLUDE:[A-Z0-9]+]]",
29 // CHECK-NEXT: "module-name": "header2"
32 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/module.modulemap",
33 // CHECK-NEXT: "command-line": [
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"
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"
46 // CHECK-NEXT: "name": "header1"
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",
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"
63 // CHECK-NEXT: "name": "header1"
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",
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"
80 // CHECK-NEXT: "name": "header2"
83 // CHECK-NEXT: "translation-units": [
85 // CHECK-NEXT: "commands": [
87 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU_DINCLUDE:[A-Z0-9]+]]",
88 // CHECK-NEXT: "clang-module-deps": [
90 // CHECK-NEXT: "context-hash": "[[HASH_H1_DINCLUDE]]",
91 // CHECK-NEXT: "module-name": "header1"
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"
99 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
100 // CHECK-NEXT: "file-deps": [
101 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input2.cpp"
103 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input2.cpp"
108 // CHECK-NEXT: "commands": [
110 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU:[A-Z0-9]+]]",
111 // CHECK-NEXT: "clang-module-deps": [
113 // CHECK-NEXT: "context-hash": "[[HASH_H1]]",
114 // CHECK-NEXT: "module-name": "header1"
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"
122 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
123 // CHECK-NEXT: "file-deps": [
124 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input.cpp"
126 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input.cpp"
131 // CHECK-NEXT: "commands": [
133 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU:[A-Z0-9]+]]",
134 // CHECK-NEXT: "clang-module-deps": [
136 // CHECK-NEXT: "context-hash": "[[HASH_H1]]",
137 // CHECK-NEXT: "module-name": "header1"
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"
145 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
146 // CHECK-NEXT: "file-deps": [
147 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input.cpp"
149 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input.cpp"
154 // CHECK-NEXT: "commands": [
156 // CHECK-NEXT: "clang-context-hash": "[[HASH_TU:[A-Z0-9]+]]",
157 // CHECK-NEXT: "clang-module-deps": [
159 // CHECK-NEXT: "context-hash": "[[HASH_H1]]",
160 // CHECK-NEXT: "module-name": "header1"
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"
168 // CHECK-NEXT: "executable": "{{.*}}clang{{.*}}"
169 // CHECK-NEXT: "file-deps": [
170 // CHECK-NEXT: "[[PREFIX]]/modules_cdb_input.cpp"
172 // CHECK-NEXT: "input-file": "[[PREFIX]]/modules_cdb_input.cpp"