110 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/Invisible.cppm -emit-module-interface -o %t/Invisible.pcm6// RUN: %clang_cc1 -std=c++20 %t/Other.cppm -emit-module-interface -fprebuilt-module-path=%t \7// RUN: -o %t/Other.pcm8// RUN: %clang_cc1 -std=c++20 %t/Another.cppm -emit-module-interface -o %t/Another.pcm9// RUN: %clang_cc1 -std=c++20 %t/A-interface.cppm -emit-module-interface \10// RUN: -fprebuilt-module-path=%t -o %t/A-interface.pcm11// RUN: %clang_cc1 -std=c++20 %t/A-interface2.cppm -emit-module-interface \12// RUN: -fprebuilt-module-path=%t -o %t/A-interface2.pcm13// RUN: %clang_cc1 -std=c++20 %t/A-interface3.cppm -emit-module-interface \14// RUN: -fprebuilt-module-path=%t -o %t/A-interface3.pcm15// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface \16// RUN: -fprebuilt-module-path=%t -o %t/A.pcm17 18// RUN: %clang_cc1 -std=c++20 %t/A.cpp -fprebuilt-module-path=%t -fsyntax-only -verify19// RUN: %clang_cc1 -std=c++20 %t/A-impl.cppm -fprebuilt-module-path=%t -fsyntax-only -verify20 21// RUN: %clang_cc1 -std=c++20 %t/A-impl2.cppm -fprebuilt-module-path=%t -fsyntax-only -verify22 23//--- Invisible.cppm24export module Invisible;25export void invisible() {}26 27//--- Other.cppm28export module Other;29import Invisible;30export void other() {}31 32//--- Another.cppm33export module Another;34export void another() {}35 36//--- A-interface.cppm37export module A:interface;38import Other;39export void a_interface() {}40 41//--- A-interface2.cppm42export module A:interface2;43import Another;44export void a_interface2() {}45 46//--- A-interface3.cppm47export module A:interface3;48import :interface;49import :interface2;50export void a_interface3() {}51 52//--- A.cppm53export module A;54import Another;55import :interface;56import :interface2;57import :interface3;58 59export void a() {}60export void impl();61 62//--- A.cpp63module A;64void impl() {65 a_interface();66 a_interface2();67 a_interface3();68 69 other();70 another();71 72 invisible(); // expected-error {{declaration of 'invisible' must be imported from module 'Invisible' before it is required}}73 // expected-note@* {{declaration here is not visible}}74}75 76//--- A-impl.cppm77module A:impl;78import :interface3;79 80void impl_part() {81 a_interface();82 a_interface2();83 a_interface3();84 85 other();86 another();87 88 invisible(); // expected-error {{declaration of 'invisible' must be imported from module 'Invisible' before it is required}}89 // expected-note@* {{declaration here is not visible}}90}91 92//--- A-impl2.cppm93module A:impl2;94import A;95 96void impl_part2() {97 a();98 impl();99 100 a_interface();101 a_interface2();102 a_interface3();103 104 other();105 another();106 107 invisible(); // expected-error {{declaration of 'invisible' must be imported from module 'Invisible' before it is required}}108 // expected-note@* {{declaration here is not visible}}109}110