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