208 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3//4// Build module map with 40 modules; two layers with importing and re-exporting5// the previous layer.6//7// RUN: echo 'module a0 { header "a0.h" export * }' > %t/module.modulemap8// RUN: echo 'module b0 { header "b0.h" export * }' >> %t/module.modulemap9// RUN: echo 'module a1 { header "a1.h" export * }' >> %t/module.modulemap10// RUN: echo 'module b1 { header "b1.h" export * }' >> %t/module.modulemap11// RUN: echo 'module a2 { header "a2.h" export * }' >> %t/module.modulemap12// RUN: echo 'module b2 { header "b2.h" export * }' >> %t/module.modulemap13// RUN: echo 'module a3 { header "a3.h" export * }' >> %t/module.modulemap14// RUN: echo 'module b3 { header "b3.h" export * }' >> %t/module.modulemap15// RUN: echo 'module a4 { header "a4.h" export * }' >> %t/module.modulemap16// RUN: echo 'module b4 { header "b4.h" export * }' >> %t/module.modulemap17// RUN: echo 'module a5 { header "a5.h" export * }' >> %t/module.modulemap18// RUN: echo 'module b5 { header "b5.h" export * }' >> %t/module.modulemap19// RUN: echo 'module a6 { header "a6.h" export * }' >> %t/module.modulemap20// RUN: echo 'module b6 { header "b6.h" export * }' >> %t/module.modulemap21// RUN: echo 'module a7 { header "a7.h" export * }' >> %t/module.modulemap22// RUN: echo 'module b7 { header "b7.h" export * }' >> %t/module.modulemap23// RUN: echo 'module a8 { header "a8.h" export * }' >> %t/module.modulemap24// RUN: echo 'module b8 { header "b8.h" export * }' >> %t/module.modulemap25// RUN: echo 'module a9 { header "a9.h" export * }' >> %t/module.modulemap26// RUN: echo 'module b9 { header "b9.h" export * }' >> %t/module.modulemap27// RUN: echo 'module a10 { header "a10.h" export * }' >> %t/module.modulemap28// RUN: echo 'module b10 { header "b10.h" export * }' >> %t/module.modulemap29// RUN: echo 'module a11 { header "a11.h" export * }' >> %t/module.modulemap30// RUN: echo 'module b11 { header "b11.h" export * }' >> %t/module.modulemap31// RUN: echo 'module a12 { header "a12.h" export * }' >> %t/module.modulemap32// RUN: echo 'module b12 { header "b12.h" export * }' >> %t/module.modulemap33// RUN: echo 'module a13 { header "a13.h" export * }' >> %t/module.modulemap34// RUN: echo 'module b13 { header "b13.h" export * }' >> %t/module.modulemap35// RUN: echo 'module a14 { header "a14.h" export * }' >> %t/module.modulemap36// RUN: echo 'module b14 { header "b14.h" export * }' >> %t/module.modulemap37// RUN: echo 'module a15 { header "a15.h" export * }' >> %t/module.modulemap38// RUN: echo 'module b15 { header "b15.h" export * }' >> %t/module.modulemap39// RUN: echo 'module a16 { header "a16.h" export * }' >> %t/module.modulemap40// RUN: echo 'module b16 { header "b16.h" export * }' >> %t/module.modulemap41// RUN: echo 'module a17 { header "a17.h" export * }' >> %t/module.modulemap42// RUN: echo 'module b17 { header "b17.h" export * }' >> %t/module.modulemap43// RUN: echo 'module a18 { header "a18.h" export * }' >> %t/module.modulemap44// RUN: echo 'module b18 { header "b18.h" export * }' >> %t/module.modulemap45// RUN: echo 'module a19 { header "a19.h" export * }' >> %t/module.modulemap46// RUN: echo 'module b19 { header "b19.h" export * }' >> %t/module.modulemap47// RUN: echo 'module a20 { header "a20.h" export * }' >> %t/module.modulemap48// RUN: echo 'module b20 { header "b20.h" export * }' >> %t/module.modulemap49//50// Build the corresponding headers.51//52// RUN: echo 'template<int> struct X {}; extern X<0> x0;' > %t/x.h53// RUN: echo 'extern int n;' > %t/a0.h54// RUN: cp %t/a0.h %t/b0.h55// RUN: echo '#include "x.h"' > %t/a1.h56// RUN: echo '#include "a0.h"' >> %t/a1.h57// RUN: echo '#include "b0.h"' >> %t/a1.h58// RUN: cp %t/a1.h %t/b1.h59// RUN: echo '#include "x.h"' > %t/a2.h60// RUN: echo '#include "a1.h"' >> %t/a2.h61// RUN: echo '#include "b1.h"' >> %t/a2.h62// RUN: cp %t/a2.h %t/b2.h63// RUN: echo '#include "x.h"' > %t/a3.h64// RUN: echo '#include "a2.h"' >> %t/a3.h65// RUN: echo '#include "b2.h"' >> %t/a3.h66// RUN: cp %t/a3.h %t/b3.h67// RUN: echo '#include "x.h"' > %t/a4.h68// RUN: echo '#include "a3.h"' >> %t/a4.h69// RUN: echo '#include "b3.h"' >> %t/a4.h70// RUN: cp %t/a4.h %t/b4.h71// RUN: echo '#include "x.h"' > %t/a5.h72// RUN: echo '#include "a4.h"' >> %t/a5.h73// RUN: echo '#include "b4.h"' >> %t/a5.h74// RUN: cp %t/a5.h %t/b5.h75// RUN: echo '#include "x.h"' > %t/a6.h76// RUN: echo '#include "a5.h"' >> %t/a6.h77// RUN: echo '#include "b5.h"' >> %t/a6.h78// RUN: cp %t/a6.h %t/b6.h79// RUN: echo '#include "x.h"' > %t/a7.h80// RUN: echo '#include "a6.h"' >> %t/a7.h81// RUN: echo '#include "b6.h"' >> %t/a7.h82// RUN: cp %t/a7.h %t/b7.h83// RUN: echo '#include "x.h"' > %t/a8.h84// RUN: echo '#include "a7.h"' >> %t/a8.h85// RUN: echo '#include "b7.h"' >> %t/a8.h86// RUN: cp %t/a8.h %t/b8.h87// RUN: echo '#include "x.h"' > %t/a9.h88// RUN: echo '#include "a8.h"' >> %t/a9.h89// RUN: echo '#include "b8.h"' >> %t/a9.h90// RUN: cp %t/a9.h %t/b9.h91// RUN: echo '#include "x.h"' > %t/a10.h92// RUN: echo '#include "a9.h"' >> %t/a10.h93// RUN: echo '#include "b9.h"' >> %t/a10.h94// RUN: cp %t/a10.h %t/b10.h95// RUN: echo '#include "x.h"' > %t/a11.h96// RUN: echo '#include "a10.h"' >> %t/a11.h97// RUN: echo '#include "b10.h"' >> %t/a11.h98// RUN: cp %t/a11.h %t/b11.h99// RUN: echo '#include "x.h"' > %t/a12.h100// RUN: echo '#include "a11.h"' >> %t/a12.h101// RUN: echo '#include "b11.h"' >> %t/a12.h102// RUN: cp %t/a12.h %t/b12.h103// RUN: echo '#include "x.h"' > %t/a13.h104// RUN: echo '#include "a12.h"' >> %t/a13.h105// RUN: echo '#include "b12.h"' >> %t/a13.h106// RUN: cp %t/a13.h %t/b13.h107// RUN: echo '#include "x.h"' > %t/a14.h108// RUN: echo '#include "a13.h"' >> %t/a14.h109// RUN: echo '#include "b13.h"' >> %t/a14.h110// RUN: cp %t/a14.h %t/b14.h111// RUN: echo '#include "x.h"' > %t/a15.h112// RUN: echo '#include "a14.h"' >> %t/a15.h113// RUN: echo '#include "b14.h"' >> %t/a15.h114// RUN: cp %t/a15.h %t/b15.h115// RUN: echo '#include "x.h"' > %t/a16.h116// RUN: echo '#include "a15.h"' >> %t/a16.h117// RUN: echo '#include "b15.h"' >> %t/a16.h118// RUN: cp %t/a16.h %t/b16.h119// RUN: echo '#include "x.h"' > %t/a17.h120// RUN: echo '#include "a16.h"' >> %t/a17.h121// RUN: echo '#include "b16.h"' >> %t/a17.h122// RUN: cp %t/a17.h %t/b17.h123// RUN: echo '#include "x.h"' > %t/a18.h124// RUN: echo '#include "a17.h"' >> %t/a18.h125// RUN: echo '#include "b17.h"' >> %t/a18.h126// RUN: cp %t/a18.h %t/b18.h127// RUN: echo '#include "x.h"' > %t/a19.h128// RUN: echo '#include "a18.h"' >> %t/a19.h129// RUN: echo '#include "b18.h"' >> %t/a19.h130// RUN: cp %t/a19.h %t/b19.h131// RUN: echo '#include "x.h"' > %t/a20.h132// RUN: echo '#include "a19.h"' >> %t/a20.h133// RUN: echo '#include "b19.h"' >> %t/a20.h134// RUN: cp %t/a20.h %t/b20.h135//136// Explicitly build all the modules.137//138// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a0 -x c++ -emit-module %t/module.modulemap -o %t/a0.pcm139// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b0 -x c++ -emit-module %t/module.modulemap -o %t/b0.pcm140// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a1 -x c++ -emit-module %t/module.modulemap -o %t/a1.pcm -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm141// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b1 -x c++ -emit-module %t/module.modulemap -o %t/b1.pcm -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm142// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a2 -x c++ -emit-module %t/module.modulemap -o %t/a2.pcm -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm143// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b2 -x c++ -emit-module %t/module.modulemap -o %t/b2.pcm -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm144// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a3 -x c++ -emit-module %t/module.modulemap -o %t/a3.pcm -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm145// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b3 -x c++ -emit-module %t/module.modulemap -o %t/b3.pcm -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm146// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a4 -x c++ -emit-module %t/module.modulemap -o %t/a4.pcm -fmodule-file=%t/a3.pcm -fmodule-file=%t/b3.pcm147// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b4 -x c++ -emit-module %t/module.modulemap -o %t/b4.pcm -fmodule-file=%t/a3.pcm -fmodule-file=%t/b3.pcm148// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a5 -x c++ -emit-module %t/module.modulemap -o %t/a5.pcm -fmodule-file=%t/a4.pcm -fmodule-file=%t/b4.pcm149// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b5 -x c++ -emit-module %t/module.modulemap -o %t/b5.pcm -fmodule-file=%t/a4.pcm -fmodule-file=%t/b4.pcm150// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a6 -x c++ -emit-module %t/module.modulemap -o %t/a6.pcm -fmodule-file=%t/a5.pcm -fmodule-file=%t/b5.pcm151// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b6 -x c++ -emit-module %t/module.modulemap -o %t/b6.pcm -fmodule-file=%t/a5.pcm -fmodule-file=%t/b5.pcm152// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a7 -x c++ -emit-module %t/module.modulemap -o %t/a7.pcm -fmodule-file=%t/a6.pcm -fmodule-file=%t/b6.pcm153// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b7 -x c++ -emit-module %t/module.modulemap -o %t/b7.pcm -fmodule-file=%t/a6.pcm -fmodule-file=%t/b6.pcm154// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a8 -x c++ -emit-module %t/module.modulemap -o %t/a8.pcm -fmodule-file=%t/a7.pcm -fmodule-file=%t/b7.pcm155// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b8 -x c++ -emit-module %t/module.modulemap -o %t/b8.pcm -fmodule-file=%t/a7.pcm -fmodule-file=%t/b7.pcm156// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a9 -x c++ -emit-module %t/module.modulemap -o %t/a9.pcm -fmodule-file=%t/a8.pcm -fmodule-file=%t/b8.pcm157// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b9 -x c++ -emit-module %t/module.modulemap -o %t/b9.pcm -fmodule-file=%t/a8.pcm -fmodule-file=%t/b8.pcm158// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a10 -x c++ -emit-module %t/module.modulemap -o %t/a10.pcm -fmodule-file=%t/a9.pcm -fmodule-file=%t/b9.pcm159// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b10 -x c++ -emit-module %t/module.modulemap -o %t/b10.pcm -fmodule-file=%t/a9.pcm -fmodule-file=%t/b9.pcm160// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a11 -x c++ -emit-module %t/module.modulemap -o %t/a11.pcm -fmodule-file=%t/a10.pcm -fmodule-file=%t/b10.pcm161// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b11 -x c++ -emit-module %t/module.modulemap -o %t/b11.pcm -fmodule-file=%t/a10.pcm -fmodule-file=%t/b10.pcm162// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a12 -x c++ -emit-module %t/module.modulemap -o %t/a12.pcm -fmodule-file=%t/a11.pcm -fmodule-file=%t/b11.pcm163// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b12 -x c++ -emit-module %t/module.modulemap -o %t/b12.pcm -fmodule-file=%t/a11.pcm -fmodule-file=%t/b11.pcm164// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a13 -x c++ -emit-module %t/module.modulemap -o %t/a13.pcm -fmodule-file=%t/a12.pcm -fmodule-file=%t/b12.pcm165// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b13 -x c++ -emit-module %t/module.modulemap -o %t/b13.pcm -fmodule-file=%t/a12.pcm -fmodule-file=%t/b12.pcm166// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a14 -x c++ -emit-module %t/module.modulemap -o %t/a14.pcm -fmodule-file=%t/a13.pcm -fmodule-file=%t/b13.pcm167// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b14 -x c++ -emit-module %t/module.modulemap -o %t/b14.pcm -fmodule-file=%t/a13.pcm -fmodule-file=%t/b13.pcm168// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a15 -x c++ -emit-module %t/module.modulemap -o %t/a15.pcm -fmodule-file=%t/a14.pcm -fmodule-file=%t/b14.pcm169// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b15 -x c++ -emit-module %t/module.modulemap -o %t/b15.pcm -fmodule-file=%t/a14.pcm -fmodule-file=%t/b14.pcm170// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a16 -x c++ -emit-module %t/module.modulemap -o %t/a16.pcm -fmodule-file=%t/a15.pcm -fmodule-file=%t/b15.pcm171// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b16 -x c++ -emit-module %t/module.modulemap -o %t/b16.pcm -fmodule-file=%t/a15.pcm -fmodule-file=%t/b15.pcm172// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a17 -x c++ -emit-module %t/module.modulemap -o %t/a17.pcm -fmodule-file=%t/a16.pcm -fmodule-file=%t/b16.pcm173// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b17 -x c++ -emit-module %t/module.modulemap -o %t/b17.pcm -fmodule-file=%t/a16.pcm -fmodule-file=%t/b16.pcm174// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a18 -x c++ -emit-module %t/module.modulemap -o %t/a18.pcm -fmodule-file=%t/a17.pcm -fmodule-file=%t/b17.pcm175// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b18 -x c++ -emit-module %t/module.modulemap -o %t/b18.pcm -fmodule-file=%t/a17.pcm -fmodule-file=%t/b17.pcm176// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a19 -x c++ -emit-module %t/module.modulemap -o %t/a19.pcm -fmodule-file=%t/a18.pcm -fmodule-file=%t/b18.pcm177// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b19 -x c++ -emit-module %t/module.modulemap -o %t/b19.pcm -fmodule-file=%t/a18.pcm -fmodule-file=%t/b18.pcm178// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=a20 -x c++ -emit-module %t/module.modulemap -o %t/a20.pcm -fmodule-file=%t/a19.pcm -fmodule-file=%t/b19.pcm179// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fmodule-name=b20 -x c++ -emit-module %t/module.modulemap -o %t/b20.pcm -fmodule-file=%t/a19.pcm -fmodule-file=%t/b19.pcm180//181// Build, using all the modules.182// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%t -fsyntax-only %s \183// RUN: -fmodule-file=%t/a0.pcm -fmodule-file=%t/b0.pcm \184// RUN: -fmodule-file=%t/a1.pcm -fmodule-file=%t/b1.pcm \185// RUN: -fmodule-file=%t/a2.pcm -fmodule-file=%t/b2.pcm \186// RUN: -fmodule-file=%t/a3.pcm -fmodule-file=%t/b3.pcm \187// RUN: -fmodule-file=%t/a4.pcm -fmodule-file=%t/b4.pcm \188// RUN: -fmodule-file=%t/a5.pcm -fmodule-file=%t/b5.pcm \189// RUN: -fmodule-file=%t/a6.pcm -fmodule-file=%t/b6.pcm \190// RUN: -fmodule-file=%t/a7.pcm -fmodule-file=%t/b7.pcm \191// RUN: -fmodule-file=%t/a8.pcm -fmodule-file=%t/b8.pcm \192// RUN: -fmodule-file=%t/a9.pcm -fmodule-file=%t/b9.pcm \193// RUN: -fmodule-file=%t/a10.pcm -fmodule-file=%t/b10.pcm \194// RUN: -fmodule-file=%t/a11.pcm -fmodule-file=%t/b11.pcm \195// RUN: -fmodule-file=%t/a12.pcm -fmodule-file=%t/b12.pcm \196// RUN: -fmodule-file=%t/a13.pcm -fmodule-file=%t/b13.pcm \197// RUN: -fmodule-file=%t/a14.pcm -fmodule-file=%t/b14.pcm \198// RUN: -fmodule-file=%t/a15.pcm -fmodule-file=%t/b15.pcm \199// RUN: -fmodule-file=%t/a16.pcm -fmodule-file=%t/b16.pcm \200// RUN: -fmodule-file=%t/a17.pcm -fmodule-file=%t/b17.pcm \201// RUN: -fmodule-file=%t/a18.pcm -fmodule-file=%t/b18.pcm \202// RUN: -fmodule-file=%t/a19.pcm -fmodule-file=%t/b19.pcm \203// RUN: -fmodule-file=%t/a20.pcm -fmodule-file=%t/b20.pcm204 205#include "a20.h"206#include "b20.h"207int k = n;208