xref: /llvm-project/clang/test/Modules/prune-non-affecting-module-map-files-textual.c (revision d33937b6236767137a1ec3393d0933f10eed4ffe)
1 // This test checks that a module map with a textual header can be marked as
2 // non-affecting.
3 
4 // RUN: rm -rf %t && mkdir %t
5 // RUN: split-file %s %t
6 
7 //--- X.modulemap
8 module X { textual header "X.h" }
9 //--- X.h
10 typedef int X_int;
11 
12 //--- Y.modulemap
13 module Y { textual header "Y.h" }
14 //--- Y.h
15 typedef int Y_int;
16 
17 //--- A.modulemap
18 module A { header "A.h" export * }
19 //--- A.h
20 #include "X.h"
21 
22 // RUN: %clang_cc1 -fmodules -emit-module %t/A.modulemap -fmodule-name=A -o %t/A0.pcm \
23 // RUN:   -fmodule-map-file=%t/X.modulemap
24 // RUN: %clang_cc1 -module-file-info %t/A0.pcm | FileCheck %s --check-prefix=A0 --implicit-check-not=Y.modulemap
25 // A0: Input file: {{.*}}X.modulemap
26 
27 // RUN: %clang_cc1 -fmodules -emit-module %t/A.modulemap -fmodule-name=A -o %t/A1.pcm \
28 // RUN:   -fmodule-map-file=%t/X.modulemap -fmodule-map-file=%t/Y.modulemap
29 // RUN: %clang_cc1 -module-file-info %t/A0.pcm | FileCheck %s --check-prefix=A1 \
30 // RUN:   --implicit-check-not=Y.modulemap
31 // A1: Input file: {{.*}}X.modulemap
32 
33 // RUN: diff %t/A0.pcm %t/A1.pcm
34 
35 //--- B.modulemap
36 module B { header "B.h" export * }
37 //--- B.h
38 #include "A.h"
39 typedef X_int B_int;
40 
41 // RUN: %clang_cc1 -fmodules -emit-module %t/B.modulemap -fmodule-name=B -o %t/B.pcm \
42 // RUN:   -fmodule-file=A=%t/A0.pcm \
43 // RUN:   -fmodule-map-file=%t/A.modulemap -fmodule-map-file=%t/X.modulemap -fmodule-map-file=%t/Y.modulemap
44 // RUN: %clang_cc1 -module-file-info %t/B.pcm | FileCheck %s --check-prefix=B \
45 // RUN:   --implicit-check-not=X.modulemap --implicit-check-not=Y.modulemap
46 // B: Input file: {{.*}}B.modulemap
47