| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: cd %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 -emit-module-interface -o %t/b.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm -fsyntax-only -verify |
| 8 |
|
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm |
| 10 |
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -emit-reduced-module-interface -o %t/b.pcm -DREDUCED |
| 11 |
// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm -fsyntax-only -verify |
| 12 |
|
| 13 |
//--- a.cppm |
| 14 |
export module a; |
| 15 |
|
| 16 |
export template<typename T> |
| 17 |
void a(T x) { |
| 18 |
+x; |
| 19 |
} |
| 20 |
|
| 21 |
//--- b.h |
| 22 |
struct s { |
| 23 |
}; |
| 24 |
void operator+(s) { |
| 25 |
} |
| 26 |
|
| 27 |
//--- b.cppm |
| 28 |
module; |
| 29 |
#include "b.h" |
| 30 |
export module b; |
| 31 |
import a; |
| 32 |
|
| 33 |
export template<typename T> |
| 34 |
void b() { |
| 35 |
a(s()); |
| 36 |
} |
| 37 |
|
| 38 |
#ifdef REDUCED |
| 39 |
// Mention it to avoid the compiler optimizing it out. |
| 40 |
using ::operator+; |
| 41 |
#endif |
| 42 |
|
| 43 |
//--- c.cppm |
| 44 |
// expected-no-diagnostics |
| 45 |
export module c; |
| 46 |
import b; |
| 47 |
|
| 48 |
void c() { |
| 49 |
b<int>(); |
| 50 |
} |