|
| 1 | +// REQUIRES: OS=macosx |
| 2 | + |
| 3 | +// RUN: %empty-directory(%t) |
| 4 | +// RUN: mkdir -p %t/clang-module-cache |
| 5 | +// RUN: mkdir -p %t/inputs |
| 6 | + |
| 7 | +// Pre-build common mandatory deps |
| 8 | +// RUN: %target-swift-emit-pcm -target %target-cpu-apple-macosx12.0 -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm |
| 9 | +// RUN: %target-swift-emit-pcm -target %target-cpu-apple-macosx12.0 -module-name _SwiftConcurrencyShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/_SwiftConcurrencyShims.pcm |
| 10 | + |
| 11 | +// Pre-build the clang deps with versioned code |
| 12 | +// RUN: %target-swift-emit-pcm -target %target-cpu-apple-macosx12.0 -module-name Bar %S/Inputs/CHeaders/ExtraCModules/module.modulemap -o %t/inputs/Bar.pcm |
| 13 | + |
| 14 | +// -disable-implicit-concurrency-module-import |
| 15 | + |
| 16 | +// RUN: echo "[{" > %/t/inputs/map.json |
| 17 | +// RUN: echo "\"moduleName\": \"Bar\"," >> %/t/inputs/map.json |
| 18 | +// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json |
| 19 | +// RUN: echo "\"clangModuleMapPath\": \"%S/Inputs/CHeaders/ExtraCModules/module.modulemap\"," >> %/t/inputs/map.json |
| 20 | +// RUN: echo "\"clangModulePath\": \"%t/inputs/Bar.pcm\"" >> %/t/inputs/map.json |
| 21 | +// RUN: echo "}," >> %/t/inputs/map.json |
| 22 | +// RUN: echo "{" >> %/t/inputs/map.json |
| 23 | +// RUN: echo "\"moduleName\": \"Swift\"," >> %/t/inputs/map.json |
| 24 | +// RUN: echo "\"modulePath\": \"%/stdlib_module\"," >> %/t/inputs/map.json |
| 25 | +// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json |
| 26 | +// RUN: echo "}," >> %/t/inputs/map.json |
| 27 | +// RUN: echo "{" >> %/t/inputs/map.json |
| 28 | +// RUN: echo "\"moduleName\": \"SwiftOnoneSupport\"," >> %/t/inputs/map.json |
| 29 | +// RUN: echo "\"modulePath\": \"%/ononesupport_module\"," >> %/t/inputs/map.json |
| 30 | +// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json |
| 31 | +// RUN: echo "}," >> %/t/inputs/map.json |
| 32 | +// RUN: echo "{" >> %/t/inputs/map.json |
| 33 | +// RUN: echo "\"moduleName\": \"_StringProcessing\"," >> %/t/inputs/map.json |
| 34 | +// RUN: echo "\"modulePath\": \"%/string_processing_module\"," >> %/t/inputs/map.json |
| 35 | +// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json |
| 36 | +// RUN: echo "}," >> %/t/inputs/map.json |
| 37 | +// RUN: echo "{" >> %/t/inputs/map.json |
| 38 | +// RUN: echo "\"moduleName\": \"SwiftShims\"," >> %/t/inputs/map.json |
| 39 | +// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json |
| 40 | +// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %/t/inputs/map.json |
| 41 | +// RUN: echo "\"clangModulePath\": \"%t/inputs/SwiftShims.pcm\"" >> %/t/inputs/map.json |
| 42 | +// RUN: echo "}]" >> %/t/inputs/map.json |
| 43 | + |
| 44 | +// RUN: %swift-frontend -target %target-cpu-apple-macosx10.14 -O -emit-ir -disable-implicit-concurrency-module-import -disable-implicit-swift-modules -explicit-swift-module-map-file %t/inputs/map.json -o %t/explicit-clang-target-irgen.ll %s -clang-target %target-cpu-apple-macosx12.0 |
| 45 | +// RUN: %FileCheck %s < %t/explicit-clang-target-irgen.ll |
| 46 | + |
| 47 | +import Bar |
| 48 | +print(Bar.funcBar()) |
| 49 | + |
| 50 | +// Ensure that the platform version check is not optimized away, which it would, if we code-generate for '-clang-target' of macosx12.0 |
| 51 | +// CHECK: {{%[0-9]+}} = tail call i32 @__isPlatformVersionAtLeast(i32 1, i32 11, i32 0, i32 0) |
0 commit comments