| 1 |
// This test checks that the module cache gets invalidated when the SDKSettings.json file changes. |
| 2 |
|
| 3 |
// RUN: rm -rf %t |
| 4 |
// RUN: split-file %s %t |
| 5 |
|
| 6 |
//--- AppleTVOS15.0.sdk/SDKSettings-old.json |
| 7 |
{ |
| 8 |
"DisplayName": "tvOS 15.0", |
| 9 |
"Version": "15.0", |
| 10 |
"CanonicalName": "appletvos15.0", |
| 11 |
"MaximumDeploymentTarget": "15.0.99", |
| 12 |
"PropertyConditionFallbackNames": [], |
| 13 |
"SupportedTargets": { |
| 14 |
"appletvos": { |
| 15 |
"Archs": ["arm64e", "arm64"], |
| 16 |
"LLVMTargetTripleVendor": "apple", |
| 17 |
"LLVMTargetTripleSys": "tvos", |
| 18 |
"LLVMTargetTripleEnvironment": "" |
| 19 |
} |
| 20 |
}, |
| 21 |
} |
| 22 |
//--- AppleTVOS15.0.sdk/SDKSettings-new.json |
| 23 |
{ |
| 24 |
"DisplayName": "tvOS 15.0", |
| 25 |
"Version": "15.0", |
| 26 |
"CanonicalName": "appletvos15.0", |
| 27 |
"MaximumDeploymentTarget": "15.0.99", |
| 28 |
"PropertyConditionFallbackNames": [], |
| 29 |
"SupportedTargets": { |
| 30 |
"appletvos": { |
| 31 |
"Archs": ["arm64e", "arm64"], |
| 32 |
"LLVMTargetTripleVendor": "apple", |
| 33 |
"LLVMTargetTripleSys": "tvos", |
| 34 |
"LLVMTargetTripleEnvironment": "" |
| 35 |
} |
| 36 |
}, |
| 37 |
"VersionMap": { |
| 38 |
"iOS_tvOS": { |
| 39 |
"13.2": "13.1" |
| 40 |
}, |
| 41 |
"tvOS_iOS": { |
| 42 |
"13.1": "13.2" |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
//--- module.modulemap |
| 47 |
module M { header "M.h" } |
| 48 |
//--- M.h |
| 49 |
void foo(void) __attribute__((availability(iOS, obsoleted = 13.2))); |
| 50 |
void test() { foo(); } |
| 51 |
|
| 52 |
//--- tu.m |
| 53 |
#include "M.h" |
| 54 |
|
| 55 |
// Compiling for tvOS 13.1 without "VersionMap" should succeed, since by default iOS 13.2 gets mapped to tvOS 13.2, |
| 56 |
// and \c foo is therefore **not** deprecated. |
| 57 |
// RUN: cp %t/AppleTVOS15.0.sdk/SDKSettings-old.json %t/AppleTVOS15.0.sdk/SDKSettings.json |
| 58 |
// RUN: %clang -target x86_64-apple-tvos13.1 -isysroot %t/AppleTVOS15.0.sdk \ |
| 59 |
// RUN: -fsyntax-only %t/tu.m -o %t/tu.o -fmodules -Xclang -fdisable-module-hash -fmodules-cache-path=%t/cache |
| 60 |
|
| 61 |
// Compiling for tvOS 13.1 with "VersionMap" saying it maps to iOS 13.2 should fail, since \c foo is now deprecated. |
| 62 |
// RUN: sleep 1 |
| 63 |
// RUN: cp %t/AppleTVOS15.0.sdk/SDKSettings-new.json %t/AppleTVOS15.0.sdk/SDKSettings.json |
| 64 |
// RUN: not %clang -target x86_64-apple-tvos13.1 -isysroot %t/AppleTVOS15.0.sdk \ |
| 65 |
// RUN: -fsyntax-only %t/tu.m -o %t/tu.o -fmodules -Xclang -fdisable-module-hash -fmodules-cache-path=%t/cache 2>&1 \ |
| 66 |
// RUN: | FileCheck %s |
| 67 |
// CHECK: M.h:2:15: error: 'foo' is unavailable: obsoleted in tvOS 13.1 |
| 68 |
// CHECK: M.h:1:6: note: 'foo' has been explicitly marked unavailable here |
| 69 |
// CHECK: tu.m:1:10: fatal error: could not build module 'M' |