-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang][Modules] Diagnose mismatching pcm dependencies in explicit buiilds #137068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/// 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 the module A with no dependencies. The first variant to build is A-1.pcm. | ||
/// 2. Build the same module with files that resolve from different search paths. | ||
/// This variant is named A-2.pcm. | ||
/// 3. Build module B that depends on the earlier module A-1.pcm. | ||
/// 4. Build client that directly depends on both modules (A & B), | ||
/// but depends on a incompatible variant of A (A-2.pcm) for B to use. | ||
|
||
// 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: -Wmodule-file-mapping-mismatch -verify %s | ||
|
||
|
||
#include <A/A.h> | ||
#include <B/B.h> // expected-warning {{conflicts with imported file}} \ | ||
// expected-note {{imported by module 'B'}} \ | ||
// expected-error {{out of date and needs to be rebuilt}} | ||
|
||
//--- Sysroot/usr/include/A/module.modulemap | ||
module A [system] { | ||
umbrella header "A.h" | ||
} | ||
//--- Sysroot/usr/include/A/A.h | ||
typedef int A_t; | ||
|
||
//--- Sysroot/usr/include/B/module.modulemap | ||
module B [system] { | ||
umbrella header "B.h" | ||
} | ||
|
||
//--- Sysroot/usr/include/B/B.h | ||
#include <A/A.h> | ||
typedef int B_t; | ||
|
||
//--- BuildDir/A/module.modulemap | ||
module A [system] { | ||
umbrella header "A.h" | ||
} | ||
|
||
//--- BuildDir/A/A.h | ||
typedef int A_t; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.