| 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/impl.cppm -emit-reduced-module-interface -o %t/impl.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 %t/impl.v2.cppm -emit-reduced-module-interface -o %t/impl.v2.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-reduced-module-interface -o %t/m.pcm \ |
| 8 |
// RUN: -fmodule-file=impl=%t/impl.pcm |
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-reduced-module-interface -o %t/m.v2.pcm \ |
| 10 |
// RUN: -fmodule-file=impl=%t/impl.v2.pcm |
| 11 |
|
| 12 |
// Since m only uses impl in the definition, the change in impl shouldn't affect m. |
| 13 |
// RUN: diff %t/m.pcm %t/m.v2.pcm &> /dev/null |
| 14 |
|
| 15 |
//--- impl.cppm |
| 16 |
export module impl; |
| 17 |
export struct Impl { |
| 18 |
Impl() {} |
| 19 |
Impl(const Impl &) {} |
| 20 |
~Impl() {} |
| 21 |
int get() { |
| 22 |
return 43; |
| 23 |
} |
| 24 |
}; |
| 25 |
|
| 26 |
//--- impl.v2.cppm |
| 27 |
export module impl; |
| 28 |
export struct Impl { |
| 29 |
Impl() {} |
| 30 |
Impl(const Impl &) {} |
| 31 |
~Impl() {} |
| 32 |
int get() { |
| 33 |
return 43; |
| 34 |
} |
| 35 |
}; |
| 36 |
|
| 37 |
export struct ImplV2 { |
| 38 |
int get() { |
| 39 |
return 43; |
| 40 |
} |
| 41 |
}; |
| 42 |
|
| 43 |
//--- m.cppm |
| 44 |
export module m; |
| 45 |
import impl; |
| 46 |
|
| 47 |
export int interface() { |
| 48 |
Impl impl; |
| 49 |
return impl.get(); |
| 50 |
}; |