1*f1d81dbdSIlya Biryukov // Same as prune-non-affecting-module-map-repeated.cpp, but check that textual-only 2*f1d81dbdSIlya Biryukov // inclusions do not cause duplication of the module map files they are defined in. 3*f1d81dbdSIlya Biryukov 4*f1d81dbdSIlya Biryukov // RUN: rm -rf %t && mkdir %t 5*f1d81dbdSIlya Biryukov // RUN: split-file %s %t 6*f1d81dbdSIlya Biryukov 7*f1d81dbdSIlya Biryukov // RUN: %clang_cc1 -xc++ -fmodules -fno-implicit-modules \ 8*f1d81dbdSIlya Biryukov // RUN: -fmodule-map-file=%t/base.map -fmodule-map-file=%t/mixed.map\ 9*f1d81dbdSIlya Biryukov // RUN: -fmodule-map-file=%t/mod1.map \ 10*f1d81dbdSIlya Biryukov // RUN: -fmodule-name=mod1 -emit-module %t/mod1.map -o %t/mod1.pcm 11*f1d81dbdSIlya Biryukov // RUN: %clang_cc1 -xc++ -fmodules -fno-implicit-modules \ 12*f1d81dbdSIlya Biryukov // RUN: -fmodule-map-file=%t/mixed.map\ 13*f1d81dbdSIlya Biryukov // RUN: -fmodule-name=mixed -emit-module %t/mixed.map -o %t/mixed.pcm 14*f1d81dbdSIlya Biryukov // RUN: %clang_cc1 -xc++ -fmodules -fno-implicit-modules \ 15*f1d81dbdSIlya Biryukov // RUN: -fmodule-map-file=%t/base.map -fmodule-map-file=%t/mod1.map -fmodule-map-file=%t/mod2.map \ 16*f1d81dbdSIlya Biryukov // RUN: -fmodule-file=%t/mod1.pcm -fmodule-file=%t/mixed.pcm \ 17*f1d81dbdSIlya Biryukov // RUN: -fmodule-name=mod2 -emit-module %t/mod2.map -o %t/mod2.pcm 18*f1d81dbdSIlya Biryukov // RUN: %clang_cc1 -xc++ -fmodules -fno-implicit-modules \ 19*f1d81dbdSIlya Biryukov // RUN: -fmodule-map-file=%t/base.map -fmodule-map-file=%t/mod2.map -fmodule-map-file=%t/mod3.map \ 20*f1d81dbdSIlya Biryukov // RUN: -fmodule-file=%t/mod2.pcm -fmodule-file=%t/mixed.pcm \ 21*f1d81dbdSIlya Biryukov // RUN: -fmodule-name=mod3 -emit-module %t/mod3.map -o %t/mod3.pcm 22*f1d81dbdSIlya Biryukov // RUN: %clang_cc1 -xc++ -fmodules -fno-implicit-modules \ 23*f1d81dbdSIlya Biryukov // RUN: -fmodule-map-file=%t/base.map -fmodule-map-file=%t/mod3.map -fmodule-map-file=%t/mod4.map \ 24*f1d81dbdSIlya Biryukov // RUN: -fmodule-file=%t/mod3.pcm \ 25*f1d81dbdSIlya Biryukov // RUN: -fmodule-name=mod4 -emit-module %t/mod4.map -o %t/mod4.pcm 26*f1d81dbdSIlya Biryukov // RUN: %clang_cc1 -xc++ -fmodules -fno-implicit-modules -fmodule-map-file=%t/base.map -fmodule-map-file=%t/mod4.map -fmodule-file=%t/mod4.pcm -fsyntax-only -verify %t/check_slocs.cc 27*f1d81dbdSIlya Biryukov 28*f1d81dbdSIlya Biryukov //--- base.map 29*f1d81dbdSIlya Biryukov module base { textual header "vector.h" } 30*f1d81dbdSIlya Biryukov //--- mixed.map 31*f1d81dbdSIlya Biryukov module mixed { textual header "mixed_text.h" header "mixed_mod.h"} 32*f1d81dbdSIlya Biryukov //--- mod1.map 33*f1d81dbdSIlya Biryukov module mod1 { header "mod1.h" } 34*f1d81dbdSIlya Biryukov //--- mod2.map 35*f1d81dbdSIlya Biryukov module mod2 { header "mod2.h" } 36*f1d81dbdSIlya Biryukov //--- mod3.map 37*f1d81dbdSIlya Biryukov module mod3 { header "mod3.h" } 38*f1d81dbdSIlya Biryukov //--- mod4.map 39*f1d81dbdSIlya Biryukov module mod4 { header "mod4.h" } 40*f1d81dbdSIlya Biryukov //--- check_slocs.cc 41*f1d81dbdSIlya Biryukov #include "mod4.h" 42*f1d81dbdSIlya Biryukov #include "vector.h" 43*f1d81dbdSIlya Biryukov #pragma clang __debug sloc_usage // expected-remark {{source manager location address space usage}} 44*f1d81dbdSIlya Biryukov // expected-note@* {{% of available space}} 45*f1d81dbdSIlya Biryukov 46*f1d81dbdSIlya Biryukov // base.map must only be present once, despite being used in each module. 47*f1d81dbdSIlya Biryukov // Because its location in every module compile should be non-affecting. 48*f1d81dbdSIlya Biryukov 49*f1d81dbdSIlya Biryukov // expected-note@base.map:1 {{file entered 1 time}} 50*f1d81dbdSIlya Biryukov 51*f1d81dbdSIlya Biryukov // different modules use either only textual header from mixed.map or both textual and modular 52*f1d81dbdSIlya Biryukov // headers. Either combination must lead to only 1 use at the end, because the module is ultimately 53*f1d81dbdSIlya Biryukov // in the import chain and any textual uses should not change that. 54*f1d81dbdSIlya Biryukov 55*f1d81dbdSIlya Biryukov // expected-note@mixed.map:1 {{file entered 1 time}} 56*f1d81dbdSIlya Biryukov 57*f1d81dbdSIlya Biryukov // expected-note@* + {{file entered}} 58*f1d81dbdSIlya Biryukov 59*f1d81dbdSIlya Biryukov 60*f1d81dbdSIlya Biryukov //--- vector.h 61*f1d81dbdSIlya Biryukov #ifndef VECTOR_H 62*f1d81dbdSIlya Biryukov #define VECTOR_H 63*f1d81dbdSIlya Biryukov #endif 64*f1d81dbdSIlya Biryukov 65*f1d81dbdSIlya Biryukov //--- mixed_text.h 66*f1d81dbdSIlya Biryukov #ifndef MIXED_TEXT_H 67*f1d81dbdSIlya Biryukov #define MIXED_TEXT_H 68*f1d81dbdSIlya Biryukov #endif 69*f1d81dbdSIlya Biryukov //--- mixed_mod.h 70*f1d81dbdSIlya Biryukov #ifndef MIXED_MOD_H 71*f1d81dbdSIlya Biryukov #define MIXED_MOD_H 72*f1d81dbdSIlya Biryukov #endif 73*f1d81dbdSIlya Biryukov 74*f1d81dbdSIlya Biryukov //--- mod1.h 75*f1d81dbdSIlya Biryukov #ifndef MOD1 76*f1d81dbdSIlya Biryukov #define MOD1 77*f1d81dbdSIlya Biryukov #include "vector.h" 78*f1d81dbdSIlya Biryukov #include "mixed_text.h" 79*f1d81dbdSIlya Biryukov int mod1(); 80*f1d81dbdSIlya Biryukov #endif 81*f1d81dbdSIlya Biryukov //--- mod2.h 82*f1d81dbdSIlya Biryukov #ifndef MOD2 83*f1d81dbdSIlya Biryukov #define MOD2 84*f1d81dbdSIlya Biryukov #include "vector.h" 85*f1d81dbdSIlya Biryukov #include "mod1.h" 86*f1d81dbdSIlya Biryukov #include "mixed_mod.h" 87*f1d81dbdSIlya Biryukov int mod2(); 88*f1d81dbdSIlya Biryukov #endif 89*f1d81dbdSIlya Biryukov //--- mod3.h 90*f1d81dbdSIlya Biryukov #ifndef MOD3 91*f1d81dbdSIlya Biryukov #define MOD3 92*f1d81dbdSIlya Biryukov #include "vector.h" 93*f1d81dbdSIlya Biryukov #include "mod2.h" 94*f1d81dbdSIlya Biryukov #include "mixed_text.h" 95*f1d81dbdSIlya Biryukov #include "mixed_mod.h" 96*f1d81dbdSIlya Biryukov int mod3(); 97*f1d81dbdSIlya Biryukov #endif 98*f1d81dbdSIlya Biryukov //--- mod4.h 99*f1d81dbdSIlya Biryukov #ifndef MOD4 100*f1d81dbdSIlya Biryukov #define MOD4 101*f1d81dbdSIlya Biryukov #include "vector.h" 102*f1d81dbdSIlya Biryukov #include "mod3.h" 103*f1d81dbdSIlya Biryukov int mod4(); 104*f1d81dbdSIlya Biryukov #endif 105