-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang][modules] Invalidate module cache when SDKSettings.json changes #139751
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
jansvoboda11
merged 4 commits into
llvm:main
from
jansvoboda11:sdk-settings-json-invalidation
May 13, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ca3f33c
[clang][modules] Invalidate module cache when SDKSettings.json changes
jansvoboda11 12f3bbc
Avoid opening file with content validation disabled
jansvoboda11 406357f
Check for error messages
jansvoboda11 ef76192
Don't omit `()` in lambda with explicit return type
jansvoboda11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// This test checks that the module cache gets invalidated when the SDKSettings.json file changes. | ||
|
||
// RUN: rm -rf %t | ||
// RUN: split-file %s %t | ||
|
||
//--- AppleTVOS15.0.sdk/SDKSettings-old.json | ||
{ | ||
"DisplayName": "tvOS 15.0", | ||
"Version": "15.0", | ||
"CanonicalName": "appletvos15.0", | ||
"MaximumDeploymentTarget": "15.0.99", | ||
"PropertyConditionFallbackNames": [] | ||
} | ||
//--- AppleTVOS15.0.sdk/SDKSettings-new.json | ||
{ | ||
"DisplayName": "tvOS 15.0", | ||
"Version": "15.0", | ||
"CanonicalName": "appletvos15.0", | ||
"MaximumDeploymentTarget": "15.0.99", | ||
"PropertyConditionFallbackNames": [], | ||
"VersionMap": { | ||
"iOS_tvOS": { | ||
"13.2": "13.1" | ||
}, | ||
"tvOS_iOS": { | ||
"13.1": "13.2" | ||
} | ||
} | ||
} | ||
//--- module.modulemap | ||
module M { header "M.h" } | ||
//--- M.h | ||
void foo(void) __attribute__((availability(iOS, obsoleted = 13.2))); | ||
void test() { foo(); } | ||
|
||
//--- tu.m | ||
#include "M.h" | ||
|
||
// Compiling for tvOS 13.1 without "VersionMap" should succeed, since by default iOS 13.2 gets mapped to tvOS 13.2, | ||
// and \c foo is therefore **not** deprecated. | ||
// RUN: cp %t/AppleTVOS15.0.sdk/SDKSettings-old.json %t/AppleTVOS15.0.sdk/SDKSettings.json | ||
// RUN: %clang -target x86_64-apple-tvos13.1 -isysroot %t/AppleTVOS15.0.sdk \ | ||
// RUN: -fsyntax-only %t/tu.m -o %t/tu.o -fmodules -Xclang -fdisable-module-hash -fmodules-cache-path=%t/cache | ||
|
||
// Compiling for tvOS 13.1 with "VersionMap" saying it maps to iOS 13.2 should fail, since \c foo is now deprecated. | ||
// RUN: sleep 1 | ||
// RUN: cp %t/AppleTVOS15.0.sdk/SDKSettings-new.json %t/AppleTVOS15.0.sdk/SDKSettings.json | ||
// RUN: not %clang -target x86_64-apple-tvos13.1 -isysroot %t/AppleTVOS15.0.sdk \ | ||
// RUN: -fsyntax-only %t/tu.m -o %t/tu.o -fmodules -Xclang -fdisable-module-hash -fmodules-cache-path=%t/cache 2>&1 \ | ||
// RUN: | FileCheck %s | ||
// CHECK: M.h:2:15: error: 'foo' is unavailable: obsoleted in tvOS 13.1 | ||
// CHECK: M.h:1:6: note: 'foo' has been explicitly marked unavailable here | ||
// CHECK: tu.m:1:10: fatal error: could not build module 'M' |
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
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.