[LV] Add test showing debug output for loops with uncountable BTCs.
[llvm-project.git] / clang / test / ClangScanDeps / modules-extern-unrelated.m
blobc003f0d9a2ee857112154e445b1eebfa853cae34
1 // This test checks that only module map files defining affecting modules are
2 // affecting.
4 // RUN: rm -rf %t
5 // RUN: split-file %s %t
7 //--- tu.m
8 @import zeroth;
10 //--- zeroth/module.modulemap
11 module zeroth { header "zeroth.h" }
12 //--- zeroth/zeroth.h
13 @import first;
14 #include "second.h"
16 //--- first/module.modulemap
17 module first {}
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" }
25 //--- second/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
32 // CHECK:      {
33 // CHECK-NEXT:   "modules": [
34 // CHECK-NEXT:     {
35 // CHECK-NEXT:       "clang-module-deps": [],
36 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",
37 // CHECK-NEXT:       "command-line": [
38 // CHECK:            ],
39 // CHECK-NEXT:       "context-hash": "{{.*}}",
40 // CHECK-NEXT:       "file-deps": [
41 // CHECK-NEXT:         "[[PREFIX]]/first/module.modulemap"
42 // CHECK-NEXT:       ],
43 // CHECK-NEXT:       "link-libraries": [],
44 // CHECK-NEXT:       "name": "first"
45 // CHECK-NEXT:     },
46 // CHECK-NEXT:     {
47 // CHECK-NEXT:       "clang-module-deps": [],
48 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",
49 // CHECK-NEXT:       "command-line": [
50 // CHECK:            ],
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"
55 // CHECK-NEXT:       ],
56 // CHECK-NEXT:       "link-libraries": [],
57 // CHECK-NEXT:       "name": "first_other"
58 // CHECK-NEXT:     },
59 // CHECK-NEXT:     {
60 // CHECK-NEXT:       "clang-module-deps": [
61 // CHECK-NEXT:         {
62 // CHECK-NEXT:           "context-hash": "{{.*}}",
63 // CHECK-NEXT:           "module-name": "first_other"
64 // CHECK-NEXT:         }
65 // CHECK-NEXT:       ],
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"
69 // CHECK:            ],
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"
75 // CHECK-NEXT:       ],
76 // CHECK-NEXT:       "link-libraries": [],
77 // CHECK-NEXT:       "name": "second"
78 // CHECK-NEXT:     },
79 // CHECK-NEXT:     {
80 // CHECK-NEXT:       "clang-module-deps": [
81 // CHECK-NEXT:         {
82 // CHECK-NEXT:           "context-hash": "{{.*}}",
83 // CHECK-NEXT:           "module-name": "first"
84 // CHECK-NEXT:         },
85 // CHECK-NEXT:         {
86 // CHECK-NEXT:           "context-hash": "{{.*}}",
87 // CHECK-NEXT:           "module-name": "second"
88 // CHECK-NEXT:         }
89 // CHECK-NEXT:       ],
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"
93 // CHECK:            ],
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"
100 // CHECK-NEXT:       ],
101 // CHECK-NEXT:       "link-libraries": [],
102 // CHECK-NEXT:       "name": "zeroth"
103 // CHECK-NEXT:     }
104 // CHECK-NEXT:   ],
105 // CHECK-NEXT:   "translation-units": [
106 // CHECK-NEXT:     {
107 // CHECK-NEXT:       "commands": [
108 // CHECK-NEXT:         {
109 // CHECK-NEXT:           "clang-context-hash": "{{.*}}",
110 // CHECK-NEXT:           "clang-module-deps": [
111 // CHECK-NEXT:             {
112 // CHECK-NEXT:               "context-hash": "{{.*}}",
113 // CHECK-NEXT:               "module-name": "zeroth"
114 // CHECK-NEXT:             }
115 // CHECK-NEXT:           ],
116 // CHECK-NEXT:           "command-line": [
117 // CHECK:                ],
118 // CHECK-NEXT:           "executable": "{{.*}}",
119 // CHECK-NEXT:           "file-deps": [
120 // CHECK-NEXT:             "[[PREFIX]]/tu.m"
121 // CHECK-NEXT:           ],
122 // CHECK-NEXT:           "input-file": "[[PREFIX]]/tu.m"
123 // CHECK-NEXT:         }
124 // CHECK:            ]
125 // CHECK:          }
126 // CHECK:        ]
127 // CHECK:      }
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