50 lines · cpp
1// RUN: mkdir -p %t2// RUN: split-file %s %t3 4// All of the following should build without diagnostics.5//6// RUN: %clang_cc1 -std=c++20 %t/a.cpp -emit-module-interface -o %t/a.pcm7// R U N: %clang_cc1 -std=c++20 %t/a.pcm -emit-obj -o %t/a.o8//9// RUN: %clang_cc1 -std=c++20 %t/b.cpp -emit-module-interface -o %t/b.pcm \10// RUN: -fprebuilt-module-path=%t 11// R U N: %clang_cc1 -std=c++20 %t/b.pcm -emit-obj -o %t/b.o12//13// RUN: %clang_cc1 -std=c++20 %t/b-impl.cpp -emit-obj -o %t/b-impl.o \14// RUN: -fprebuilt-module-path=%t15//16// RUN: %clang_cc1 -std=c++20 %t/ab-main.cpp -fsyntax-only \17// RUN: -fprebuilt-module-path=%t18 19//--- a.cpp20 21export module a;22 23export int foo() {24 return 42;25}26 27//--- b.cpp28 29export module b;30import a;31 32export int bar();33 34//--- b-impl.cpp35 36module b;37 38int bar() {39 return foo();40}41 42//--- ab-main.cpp43 44import b;45 46int main() {47 return bar();48}49 50