File: versioned.m

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (187 lines) | stat: -rw-r--r-- 10,637 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// RUN: rm -rf %t && mkdir -p %t

// Build and check the unversioned module file.
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Unversioned -fdisable-module-hash -fapinotes-modules  -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s
// RUN: %clang_cc1 -ast-print %t/ModulesCache/Unversioned/VersionedKit.pcm | FileCheck -check-prefix=CHECK-UNVERSIONED %s
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Unversioned -fdisable-module-hash -fapinotes-modules  -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -ast-dump -ast-dump-filter 'DUMP' | FileCheck -check-prefix=CHECK-DUMP -check-prefix=CHECK-UNVERSIONED-DUMP %s

// Build and check the versioned module file.
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Versioned -fdisable-module-hash -fapinotes-modules  -fapinotes-swift-version=3 -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s
// RUN: %clang_cc1 -ast-print %t/ModulesCache/Versioned/VersionedKit.pcm | FileCheck -check-prefix=CHECK-VERSIONED %s
// RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache/Versioned -fdisable-module-hash -fapinotes-modules  -fapinotes-swift-version=3 -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -ast-dump -ast-dump-filter 'DUMP' | FileCheck -check-prefix=CHECK-DUMP -check-prefix=CHECK-VERSIONED-DUMP %s

#import <VersionedKit/VersionedKit.h>

// CHECK-UNVERSIONED: void moveToPointDUMP(double x, double y) __attribute__((swift_name("moveTo(x:y:)")));
// CHECK-VERSIONED: void moveToPointDUMP(double x, double y) __attribute__((swift_name("moveTo(a:b:)")));

// CHECK-DUMP-LABEL: Dumping moveToPointDUMP
// CHECK-VERSIONED-DUMP: SwiftVersionedAttr {{.+}} Implicit 3.0 IsReplacedByActive{{$}}
// CHECK-VERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} "moveTo(x:y:)"
// CHECK-VERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "moveTo(a:b:)"
// CHECK-UNVERSIONED-DUMP: SwiftNameAttr {{.+}} "moveTo(x:y:)"
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftVersionedAttr {{.+}} Implicit 3.0{{$}}
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "moveTo(a:b:)"
// CHECK-DUMP-NOT: Attr

// CHECK-DUMP-LABEL: Dumping unversionedRenameDUMP
// CHECK-DUMP: in VersionedKit unversionedRenameDUMP
// CHECK-DUMP-NEXT: SwiftVersionedAttr {{.+}} Implicit 0 IsReplacedByActive{{$}}
// CHECK-DUMP-NEXT: SwiftNameAttr {{.+}} "unversionedRename_HEADER()"
// CHECK-DUMP-NEXT: SwiftNameAttr {{.+}} "unversionedRename_NOTES()"
// CHECK-DUMP-NOT: Attr

// CHECK-DUMP-LABEL: Dumping TestGenericDUMP
// CHECK-VERSIONED-DUMP: SwiftImportAsNonGenericAttr {{.+}} <<invalid sloc>>
// CHECK-UNVERSIONED-DUMP: SwiftVersionedAttr {{.+}} Implicit 3.0{{$}}
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftImportAsNonGenericAttr {{.+}} <<invalid sloc>>
// CHECK-DUMP-NOT: Attr

// CHECK-DUMP-LABEL: Dumping Swift3RenamedOnlyDUMP
// CHECK-DUMP: in VersionedKit Swift3RenamedOnlyDUMP
// CHECK-VERSIONED-DUMP-NEXT: SwiftVersionedRemovalAttr {{.+}} Implicit 3.0 {{[0-9]+}} IsReplacedByActive{{$}}
// CHECK-VERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} "SpecialSwift3Name"
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftVersionedAttr {{.+}} Implicit 3.0{{$}}
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "SpecialSwift3Name"
// CHECK-DUMP-NOT: Attr

// CHECK-DUMP-LABEL: Dumping Swift3RenamedAlsoDUMP
// CHECK-DUMP: in VersionedKit Swift3RenamedAlsoDUMP
// CHECK-VERSIONED-DUMP-NEXT: SwiftVersionedAttr {{.+}} Implicit 3.0 IsReplacedByActive{{$}}
// CHECK-VERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} <line:{{.+}}, col:{{.+}}> "Swift4Name"
// CHECK-VERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} "SpecialSwift3Also"
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} <line:{{.+}}, col:{{.+}}> "Swift4Name"
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftVersionedAttr {{.+}} Implicit 3.0{{$}}
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "SpecialSwift3Also"
// CHECK-DUMP-NOT: Attr

// CHECK-DUMP-LABEL: Dumping Swift4RenamedDUMP
// CHECK-DUMP: in VersionedKit Swift4RenamedDUMP
// CHECK-VERSIONED-DUMP-NEXT: SwiftVersionedRemovalAttr {{.+}} Implicit 4 {{[0-9]+}} IsReplacedByActive{{$}}
// CHECK-VERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} "SpecialSwift4Name"
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftVersionedAttr {{.+}} Implicit 4{{$}}
// CHECK-UNVERSIONED-DUMP-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "SpecialSwift4Name"
// CHECK-DUMP-NOT: Attr

// CHECK-DUMP-NOT: Dumping

// CHECK-UNVERSIONED: void acceptClosure(void (^block)(void) __attribute__((noescape)));
// CHECK-VERSIONED: void acceptClosure(void (^block)(void));

// CHECK-UNVERSIONED: void privateFunc(void) __attribute__((swift_private));

// CHECK-UNVERSIONED: typedef double MyDoubleWrapper __attribute__((swift_wrapper("struct")));

// CHECK-UNVERSIONED:      enum __attribute__((ns_error_domain(MyErrorDomain))) MyErrorCode {
// CHECK-UNVERSIONED-NEXT:     MyErrorCodeFailed = 1
// CHECK-UNVERSIONED-NEXT: };

// CHECK-UNVERSIONED: __attribute__((swift_bridge("MyValueType")))
// CHECK-UNVERSIONED: @interface MyReferenceType

// CHECK-VERSIONED: void privateFunc(void);

// CHECK-VERSIONED: typedef double MyDoubleWrapper;

// CHECK-VERSIONED:      enum MyErrorCode {
// CHECK-VERSIONED-NEXT:     MyErrorCodeFailed = 1
// CHECK-VERSIONED-NEXT: };

// CHECK-VERSIONED-NOT: __attribute__((swift_bridge("MyValueType")))
// CHECK-VERSIONED: @interface MyReferenceType

// CHECK-UNVERSIONED: __attribute__((swift_objc_members)
// CHECK-UNVERSIONED-NEXT: @interface TestProperties
// CHECK-VERSIONED-NOT: __attribute__((swift_objc_members)
// CHECK-VERSIONED: @interface TestProperties

// CHECK-UNVERSIONED-LABEL: enum __attribute__((flag_enum)) FlagEnum {
// CHECK-UNVERSIONED-NEXT:     FlagEnumA = 1,
// CHECK-UNVERSIONED-NEXT:     FlagEnumB = 2
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum __attribute__((flag_enum)) NewlyFlagEnum {
// CHECK-UNVERSIONED-NEXT:     NewlyFlagEnumA = 1,
// CHECK-UNVERSIONED-NEXT:     NewlyFlagEnumB = 2
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum __attribute__((flag_enum)) APINotedFlagEnum {
// CHECK-UNVERSIONED-NEXT:     APINotedFlagEnumA = 1,
// CHECK-UNVERSIONED-NEXT:     APINotedFlagEnumB = 2
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) OpenEnum {
// CHECK-UNVERSIONED-NEXT:     OpenEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) NewlyOpenEnum {
// CHECK-UNVERSIONED-NEXT:     NewlyOpenEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("closed"))) NewlyClosedEnum {
// CHECK-UNVERSIONED-NEXT:     NewlyClosedEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) ClosedToOpenEnum {
// CHECK-UNVERSIONED-NEXT:     ClosedToOpenEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("closed"))) OpenToClosedEnum {
// CHECK-UNVERSIONED-NEXT:     OpenToClosedEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) APINotedOpenEnum {
// CHECK-UNVERSIONED-NEXT:     APINotedOpenEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("closed"))) APINotedClosedEnum {
// CHECK-UNVERSIONED-NEXT:     APINotedClosedEnumA = 1
// CHECK-UNVERSIONED-NEXT: };

// CHECK-VERSIONED-LABEL: enum __attribute__((flag_enum)) FlagEnum {
// CHECK-VERSIONED-NEXT:     FlagEnumA = 1,
// CHECK-VERSIONED-NEXT:     FlagEnumB = 2
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum NewlyFlagEnum {
// CHECK-VERSIONED-NEXT:     NewlyFlagEnumA = 1,
// CHECK-VERSIONED-NEXT:     NewlyFlagEnumB = 2
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum __attribute__((flag_enum)) APINotedFlagEnum {
// CHECK-VERSIONED-NEXT:     APINotedFlagEnumA = 1,
// CHECK-VERSIONED-NEXT:     APINotedFlagEnumB = 2
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum __attribute__((enum_extensibility("open"))) OpenEnum {
// CHECK-VERSIONED-NEXT:     OpenEnumA = 1
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum NewlyOpenEnum {
// CHECK-VERSIONED-NEXT:     NewlyOpenEnumA = 1
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum NewlyClosedEnum {
// CHECK-VERSIONED-NEXT:     NewlyClosedEnumA = 1
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum __attribute__((enum_extensibility("closed"))) ClosedToOpenEnum {
// CHECK-VERSIONED-NEXT:     ClosedToOpenEnumA = 1
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum __attribute__((enum_extensibility("open"))) OpenToClosedEnum {
// CHECK-VERSIONED-NEXT:     OpenToClosedEnumA = 1
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum __attribute__((enum_extensibility("open"))) APINotedOpenEnum {
// CHECK-VERSIONED-NEXT:     APINotedOpenEnumA = 1
// CHECK-VERSIONED-NEXT: };
// CHECK-VERSIONED-LABEL: enum __attribute__((enum_extensibility("closed"))) APINotedClosedEnum {
// CHECK-VERSIONED-NEXT:     APINotedClosedEnumA = 1
// CHECK-VERSIONED-NEXT: };

// These don't actually have versioned information, so we just check them once.
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) SoonToBeCFEnum {
// CHECK-UNVERSIONED-NEXT:     SoonToBeCFEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) SoonToBeNSEnum {
// CHECK-UNVERSIONED-NEXT:     SoonToBeNSEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) __attribute__((flag_enum)) SoonToBeCFOptions {
// CHECK-UNVERSIONED-NEXT:     SoonToBeCFOptionsA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("open"))) __attribute__((flag_enum)) SoonToBeNSOptions {
// CHECK-UNVERSIONED-NEXT:     SoonToBeNSOptionsA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("closed"))) SoonToBeCFClosedEnum {
// CHECK-UNVERSIONED-NEXT:     SoonToBeCFClosedEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum  __attribute__((enum_extensibility("closed"))) SoonToBeNSClosedEnum {
// CHECK-UNVERSIONED-NEXT:     SoonToBeNSClosedEnumA = 1
// CHECK-UNVERSIONED-NEXT: };
// CHECK-UNVERSIONED-LABEL: enum UndoAllThatHasBeenDoneToMe {
// CHECK-UNVERSIONED-NEXT:     UndoAllThatHasBeenDoneToMeA = 1
// CHECK-UNVERSIONED-NEXT: };