1// RUN: rm -rf %t 2// RUN: mkdir -p %t 3// RUN: split-file %s %t 4// 5// RUN: %clang_cc1 -std=c++20 %t/Invisible.cppm -emit-module-interface -o %t/Invisible.pcm 6// RUN: %clang_cc1 -std=c++20 %t/Other.cppm -emit-module-interface -fprebuilt-module-path=%t \ 7// RUN: -o %t/Other.pcm 8// RUN: %clang_cc1 -std=c++20 %t/Another.cppm -emit-module-interface -o %t/Another.pcm 9// RUN: %clang_cc1 -std=c++20 %t/A-interface.cppm -emit-module-interface \ 10// RUN: -fprebuilt-module-path=%t -o %t/A-interface.pcm 11// RUN: %clang_cc1 -std=c++20 %t/A-interface2.cppm -emit-module-interface \ 12// RUN: -fprebuilt-module-path=%t -o %t/A-interface2.pcm 13// RUN: %clang_cc1 -std=c++20 %t/A-interface3.cppm -emit-module-interface \ 14// RUN: -fprebuilt-module-path=%t -o %t/A-interface3.pcm 15// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface \ 16// RUN: -fprebuilt-module-path=%t -o %t/A.pcm 17 18// RUN: %clang_cc1 -std=c++20 %t/A.cpp -fprebuilt-module-path=%t -fsyntax-only -verify 19// RUN: %clang_cc1 -std=c++20 %t/A-impl.cppm -fprebuilt-module-path=%t -fsyntax-only -verify 20 21// RUN: %clang_cc1 -std=c++20 %t/A-impl2.cppm -fprebuilt-module-path=%t -fsyntax-only -verify 22 23//--- Invisible.cppm 24export module Invisible; 25export void invisible() {} 26 27//--- Other.cppm 28export module Other; 29import Invisible; 30export void other() {} 31 32//--- Another.cppm 33export module Another; 34export void another() {} 35 36//--- A-interface.cppm 37export module A:interface; 38import Other; 39export void a_interface() {} 40 41//--- A-interface2.cppm 42export module A:interface2; 43import Another; 44export void a_interface2() {} 45 46//--- A-interface3.cppm 47export module A:interface3; 48import :interface; 49import :interface2; 50export void a_interface3() {} 51 52//--- A.cppm 53export module A; 54import Another; 55import :interface; 56import :interface2; 57import :interface3; 58 59export void a() {} 60export void impl(); 61 62//--- A.cpp 63module 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.cppm 77module 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.cppm 93module 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