|
| 1 | +/// This tests the expected error case when there is a mismatch between the pcm dependencies passed in |
| 2 | +/// the command line with `fmodule-file` and whats encoded in the pcm. |
| 3 | + |
| 4 | +/// The steps are: |
| 5 | +/// 1. Build the module A with no dependencies. The first variant to build is A-1.pcm. |
| 6 | +/// 2. Build the same module with files that resolve from different search paths. |
| 7 | +/// This variant is named A-2.pcm. |
| 8 | +/// 3. Build module B that depends on the earlier module A-1.pcm. |
| 9 | +/// 4. Build client that directly depends on both modules (A & B), |
| 10 | +/// but depends on a incompatible variant of A (A-2.pcm) for B to use. |
| 11 | + |
| 12 | +// RUN: rm -rf %t |
| 13 | +// RUN: split-file %s %t |
| 14 | + |
| 15 | +// RUN: %clang_cc1 -emit-module -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ |
| 16 | +// RUN: -I%t/Sysroot/usr/include \ |
| 17 | +// RUN: -fmodule-name=A %t/Sysroot/usr/include/A/module.modulemap -o %t/A-1.pcm |
| 18 | + |
| 19 | +// RUN: %clang_cc1 -emit-module -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ |
| 20 | +// RUN: -I%t/BuildDir \ |
| 21 | +// RUN: -fmodule-name=A %t/BuildDir/A/module.modulemap -o %t/A-2.pcm |
| 22 | + |
| 23 | +// RUN: %clang_cc1 -emit-module -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ |
| 24 | +// RUN: -I%t/Sysroot/usr/include \ |
| 25 | +// RUN: -fmodule-map-file=%t/Sysroot/usr/include/A/module.modulemap \ |
| 26 | +// RUN: -fmodule-file=A=%t/A-1.pcm \ |
| 27 | +// RUN: -fmodule-name=B %t/Sysroot/usr/include/B/module.modulemap -o %t/B-1.pcm |
| 28 | + |
| 29 | +// RUN: %clang_cc1 -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ |
| 30 | +// RUN: -I%t/BuildDir -I%t/Sysroot/usr/include \ |
| 31 | +// RUN: -fmodule-map-file=%t/BuildDir/A/module.modulemap \ |
| 32 | +// RUN: -fmodule-map-file=%t/Sysroot/usr/include/B/module.modulemap \ |
| 33 | +// RUN: -fmodule-file=A=%t/A-2.pcm -fmodule-file=B=%t/B-1.pcm \ |
| 34 | +// RUN: -Wlazy-pcm-mismatch -verify %s |
| 35 | + |
| 36 | + |
| 37 | +#include <A/A.h> |
| 38 | +#include <B/B.h> // expected-warning {{conflicts with file discovered}} \ |
| 39 | + // expected-note {{imported by module 'B'}} \ |
| 40 | + // expected-error {{out of date and needs to be rebuilt}} \ |
| 41 | + // expected-note {{imported by module 'B'}} |
| 42 | + |
| 43 | +//--- Sysroot/usr/include/A/module.modulemap |
| 44 | +module A [system] { |
| 45 | + umbrella header "A.h" |
| 46 | +} |
| 47 | +//--- Sysroot/usr/include/A/A.h |
| 48 | +typedef int A_t; |
| 49 | + |
| 50 | +//--- Sysroot/usr/include/B/module.modulemap |
| 51 | +module B [system] { |
| 52 | + umbrella header "B.h" |
| 53 | +} |
| 54 | + |
| 55 | +//--- Sysroot/usr/include/B/B.h |
| 56 | +#include <A/A.h> |
| 57 | +typedef int B_t; |
| 58 | + |
| 59 | +//--- BuildDir/A/module.modulemap |
| 60 | +module A [system] { |
| 61 | + umbrella header "A.h" |
| 62 | +} |
| 63 | + |
| 64 | +//--- BuildDir/A/A.h |
| 65 | +typedef int A_t; |
0 commit comments