|
1 | 1 | // RUN: %empty-directory(%t/src) |
2 | 2 | // RUN: split-file %s %t/src |
3 | 3 |
|
4 | | -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %t/src/main.swift \ |
| 4 | +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t/modules) -Xcc -DCGFLOAT_IN_COREFOUNDATION -DCGFLOAT_IN_COREFOUNDATION -emit-module -o %t/modules/CoreFoundation.swiftmodule %clang-importer-sdk-path/swift-modules/CoreFoundation.swift |
| 5 | +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t/modules) -Xcc -DCGFLOAT_IN_COREFOUNDATION -DCGFLOAT_IN_COREFOUNDATION -emit-module -o %t/modules/CoreGraphics.swiftmodule %clang-importer-sdk-path/swift-modules/CoreGraphics.swift |
| 6 | +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t/modules) -Xcc -DCGFLOAT_IN_COREFOUNDATION -DCGFLOAT_IN_COREFOUNDATION -emit-module -o %t/modules/Foundation.swiftmodule %clang-importer-sdk-path/swift-modules/Foundation.swift |
| 7 | + |
| 8 | +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk -I %t/modules) %t/src/main.swift \ |
5 | 9 | // RUN: -import-bridging-header %t/src/test.h \ |
6 | 10 | // RUN: -module-name main -I %t -emit-sil | %FileCheck %s |
7 | 11 |
|
|
10 | 14 | //--- test.h |
11 | 15 | #include <objc/objc.h> |
12 | 16 |
|
| 17 | +@import CoreFoundation; |
| 18 | +@import CoreGraphics; |
| 19 | +@import Foundation; |
| 20 | + |
13 | 21 | @interface MyClass : NSObject |
14 | 22 | @end |
15 | 23 |
|
16 | 24 | __attribute__((swift_name("MyClass.value"))) |
17 | 25 | static const int MyClassValue = -1; |
18 | 26 |
|
| 27 | +static const CGFloat myFloatConstValue = 42.0; |
| 28 | + |
| 29 | +typedef CGFloat MyFloatType __attribute__((swift_wrapper(struct))); |
| 30 | +static const MyFloatType MyFloatTypeValue1 = 10; |
| 31 | +static const MyFloatType MyFloatTypeValue2 = 20; |
| 32 | +static const MyFloatType MyFloatTypeValue3 = 30; |
| 33 | + |
19 | 34 | //--- main.swift |
20 | 35 | func foo() { |
21 | 36 | print(MyClass.value) |
| 37 | + print(myFloatConstValue) |
| 38 | + print(MyFloatType.value1) |
| 39 | + print(MyFloatType.value2) |
| 40 | + print(MyFloatType.value3) |
22 | 41 | } |
23 | 42 |
|
24 | | -// CHECK: sil shared [transparent] @$sSo7MyClassC5values5Int32VvgZ : $@convention(method) (@thick MyClass.Type) -> Int32 { |
| 43 | +// CHECK: // static MyClass.value.getter |
| 44 | +// CHECK-NEXT: // Isolation: nonisolated |
| 45 | +// CHECK-NEXT: sil shared [transparent] @$sSo7MyClassC5values5Int32VvgZ : $@convention(method) (@thick MyClass.Type) -> Int32 { |
25 | 46 | // CHECK-NEXT: // %0 "self" |
26 | 47 | // CHECK-NEXT: bb0(%0 : $@thick MyClass.Type): |
27 | 48 | // CHECK-NEXT: debug_value %0, let, name "self", argno 1 |
28 | 49 | // CHECK-NEXT: %2 = integer_literal $Builtin.Int32, -1 |
29 | 50 | // CHECK-NEXT: %3 = struct $Int32 (%2) |
30 | 51 | // CHECK-NEXT: return %3 |
31 | 52 | // CHECK-NEXT: } |
| 53 | + |
| 54 | +// CGFloats are not imported: |
| 55 | + |
| 56 | +// CHECK-NOT: // myFloatConstValue.getter |
| 57 | +// CHECK-NOT: // static MyFloatType.value1.getter |
| 58 | +// CHECK-NOT: // static MyFloatType.value2.getter |
| 59 | +// CHECK-NOT: // static MyFloatType.value3.getter |
0 commit comments