| 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/a.cppm -emit-module-interface -o %t/a.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify |
| 7 |
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=a=%t/a.pcm -fsyntax-only -verify |
| 8 |
// |
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/M-Part.cppm -emit-module-interface -o %t/M-Part.pcm |
| 10 |
// RUN: %clang_cc1 -std=c++20 %t/M.cppm -fmodule-file=M:Part=%t/M-Part.pcm -fsyntax-only -verify |
| 11 |
|
| 12 |
//--- a.cppm |
| 13 |
export module a; |
| 14 |
export int foo() { return 43; } |
| 15 |
|
| 16 |
//--- b.cppm |
| 17 |
// expected-no-diagnostics |
| 18 |
export module b; |
| 19 |
import a; |
| 20 |
export int b() { |
| 21 |
return foo(); |
| 22 |
} |
| 23 |
|
| 24 |
//--- use.cpp |
| 25 |
// expected-no-diagnostics |
| 26 |
import a; |
| 27 |
int Use() { |
| 28 |
return foo(); |
| 29 |
} |
| 30 |
|
| 31 |
//--- M-Part.cppm |
| 32 |
export module M:Part; |
| 33 |
|
| 34 |
//--- M.cppm |
| 35 |
// expected-no-diagnostics |
| 36 |
export module M; |
| 37 |
import :Part; |