65 lines · c
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 %t13// RUN: split-file %s %t14 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.pcm18 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.pcm22 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.pcm28 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: -Wmodule-file-mapping-mismatch -verify %s 35 36 37#include <A/A.h>38#include <B/B.h> // expected-warning {{conflicts with imported file}} \39 // expected-note {{imported by module 'B'}} \40 // expected-error {{out of date and needs to be rebuilt}}41 42//--- Sysroot/usr/include/A/module.modulemap43module A [system] {44 umbrella header "A.h"45}46//--- Sysroot/usr/include/A/A.h47typedef int A_t;48 49//--- Sysroot/usr/include/B/module.modulemap50module B [system] {51 umbrella header "B.h"52}53 54//--- Sysroot/usr/include/B/B.h55#include <A/A.h>56typedef int B_t;57 58//--- BuildDir/A/module.modulemap59module A [system] {60 umbrella header "A.h"61}62 63//--- BuildDir/A/A.h64typedef int A_t;65