|
| 1 | +// REQUIRES: swift_feature_RegionBasedIsolation |
| 2 | +// REQUIRES: objc_interop |
| 3 | + |
| 4 | +// RUN: %empty-directory(%t) |
| 5 | +// RUN: split-file %s %t |
| 6 | + |
| 7 | +// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O -I %t \ |
| 8 | +// RUN: -disable-implicit-string-processing-module-import \ |
| 9 | +// RUN: %t/test.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas -module-load-mode prefer-serialized |
| 10 | + |
| 11 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd |
| 12 | +// RUN: %swift_frontend_plain @%t/shim.cmd |
| 13 | + |
| 14 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:_SwiftConcurrencyShims > %t/cshim.cmd |
| 15 | +// RUN: %swift_frontend_plain @%t/cshim.cmd |
| 16 | + |
| 17 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/A.cmd |
| 18 | +// RUN: %swift_frontend_plain @%t/A.cmd -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=CHECK --check-prefix=CACHE-MISS |
| 19 | + |
| 20 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/A.cmd |
| 21 | +// RUN: %swift_frontend_plain @%t/A.cmd -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=CHECK --check-prefix=CACHE-HIT |
| 22 | + |
| 23 | +// CACHE-MISS: remark: cache miss for input |
| 24 | +// CHECK: <module-includes>:1 |
| 25 | +// CHECK-SAME: note: in file included from <module-includes>:1: |
| 26 | +// CHECK: warning: warning a.h |
| 27 | +// CACHE-HIT: remark: replay output file |
| 28 | + |
| 29 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json |
| 30 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid |
| 31 | + |
| 32 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd |
| 33 | +// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd |
| 34 | +// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd |
| 35 | +// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd |
| 36 | +// RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd |
| 37 | + |
| 38 | +// RUN: %target-swift-frontend -cache-compile-job -module-name Test -O -cas-path %t/cas @%t/MyApp.cmd %t/test.swift \ |
| 39 | +// RUN: -emit-module -o %t/test.swiftmodule -require-explicit-sendable -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation |
| 40 | + |
| 41 | +//--- module.modulemap |
| 42 | +module A { |
| 43 | + header "a.h" |
| 44 | + export * |
| 45 | +} |
| 46 | + |
| 47 | +//--- a.h |
| 48 | +#warning warning a.h |
| 49 | + |
| 50 | +#pragma clang attribute push(__attribute__((swift_attr("@_nonSendable(_assumed)"))), apply_to = any(objc_interface, record, enum)) |
| 51 | +@protocol P |
| 52 | +@end |
| 53 | + |
| 54 | +@interface C |
| 55 | +@end |
| 56 | +#pragma clang attribute pop |
| 57 | + |
| 58 | +//--- test.swift |
| 59 | +import A |
| 60 | +import _Concurrency |
| 61 | + |
| 62 | +func acceptSendable<T: Sendable>(_: T) { |
| 63 | +} |
| 64 | + |
| 65 | +func testMe(c: C) { |
| 66 | + acceptSendable(c) |
| 67 | +} |
| 68 | + |
0 commit comments