================ @@ -0,0 +1,62 @@ +/// This tests the expected error case when there is a mismatch between the pcm dependencies passed in +/// the command line with `fmodule-file` and whats encoded in the pcm. + +/// The steps are: +/// 1. Build module (A-1) with no dependencies. +/// 2. Build the same module with files that resolve from different search paths. (A-2). +/// 3. Build module (B) that depends on the earlier module (A-1). +/// 4. Build client that depends on both modules (A & B) but depends on a different version (A-2). + +// RUN: rm -rf %t +// RUN: split-file %s %t + +// RUN: %clang_cc1 -emit-module -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ +// RUN: -I%t/Sysroot/usr/include \ +// RUN: -fmodule-name=A %t/Sysroot/usr/include/A/module.modulemap -o %t/A-1.pcm + +// RUN: %clang_cc1 -emit-module -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ +// RUN: -I%t/BuildDir \ +// RUN: -fmodule-name=A %t/BuildDir/A/module.modulemap -o %t/A-2.pcm + +// RUN: %clang_cc1 -emit-module -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ +// RUN: -I%t/Sysroot/usr/include \ +// RUN: -fmodule-map-file=%t/Sysroot/usr/include/A/module.modulemap \ +// RUN: -fmodule-file=A=%t/A-1.pcm \ +// RUN: -fmodule-name=B %t/Sysroot/usr/include/B/module.modulemap -o %t/B-1.pcm + +// RUN: %clang_cc1 -x c -fmodules -fno-implicit-modules -isysroot %t/Sysroot \ +// RUN: -I%t/BuildDir -I%t/Sysroot/usr/include \ +// RUN: -fmodule-map-file=%t/BuildDir/A/module.modulemap \ +// RUN: -fmodule-map-file=%t/Sysroot/usr/include/B/module.modulemap \ +// RUN: -fmodule-file=A=%t/A-2.pcm -fmodule-file=B=%t/B-1.pcm \ +// RUN: -verify %s + + +#include <A/A.h> +#include <B/B.h> // expected-error {{out of date and needs to be rebuilt}} \ + // expected-note {{imported by module 'B'}} \ + // expected-note-re {{alternate module file {{.*}}A-1.pcm' was imported from 'B'}} ---------------- cyndyishida wrote:
Sure thing, this is what the example test generates. ``` /Users/cishida/Projects/llvm/monorepo/llvm-project/clang/test/Modules/invalid-module-dep.c:36:2: fatal error: module file '/Users/cishida/Builds/llvm-build/tools/clang/test/Modules/Output/invalid-module-dep.c.tmp/A-2.pcm' is out of date and needs to be rebuilt: module file has a different size than expected 36 | #include <B/B.h> // expected-error {{out of date and needs to be rebuilt}} \ | ^ /Users/cishida/Projects/llvm/monorepo/llvm-project/clang/test/Modules/invalid-module-dep.c:36:2: note: imported by module 'B' in '/Users/cishida/Builds/llvm-build/tools/clang/test/Modules/Output/invalid-module-dep.c.tmp/B-1.pcm' /Users/cishida/Projects/llvm/monorepo/llvm-project/clang/test/Modules/invalid-module-dep.c:36:2: note: alternate module file '/Users/cishida/Builds/llvm-build/tools/clang/test/Modules/Output/invalid-module-dep.c.tmp/A-1.pcm' was imported from 'B' 1 error generated. ``` https://github.com/llvm/llvm-project/pull/136612 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits