1 | // RUN: rm -rf %t |
2 | // RUN: %clang_cc1 -objcmt-migrate-ns-macros -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11 |
3 | // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result |
4 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result |
5 | |
6 | typedef signed char int8_t; |
7 | typedef short int16_t; |
8 | typedef int int32_t; |
9 | typedef long NSInteger; |
10 | typedef long long int64_t; |
11 | |
12 | typedef unsigned char uint8_t; |
13 | typedef unsigned short uint16_t; |
14 | typedef unsigned int uint32_t; |
15 | typedef unsigned long NSUInteger; |
16 | typedef unsigned long long uint64_t; |
17 | |
18 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type |
19 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type |
20 | #define DEPRECATED __attribute__((deprecated)) |
21 | |
22 | enum { |
23 | blah, |
24 | blarg |
25 | }; |
26 | typedef NSInteger wibble; |
27 | |
28 | enum { |
29 | UIViewAutoresizingNone = 0, |
30 | UIViewAutoresizingFlexibleLeftMargin, |
31 | UIViewAutoresizingFlexibleWidth, |
32 | UIViewAutoresizingFlexibleRightMargin, |
33 | UIViewAutoresizingFlexibleTopMargin, |
34 | UIViewAutoresizingFlexibleHeight, |
35 | UIViewAutoresizingFlexibleBottomMargin |
36 | }; |
37 | typedef NSUInteger UITableViewCellStyle; |
38 | |
39 | typedef enum { |
40 | UIViewAnimationTransitionNone, |
41 | UIViewAnimationTransitionFlipFromLeft, |
42 | UIViewAnimationTransitionFlipFromRight, |
43 | UIViewAnimationTransitionCurlUp, |
44 | UIViewAnimationTransitionCurlDown, |
45 | } UIViewAnimationTransition; |
46 | |
47 | typedef enum { |
48 | UIViewOne = 0, |
49 | UIViewTwo = 1 << 0, |
50 | UIViewThree = 1 << 1, |
51 | UIViewFour = 1 << 2, |
52 | UIViewFive = 1 << 3, |
53 | UIViewSix = 1 << 4, |
54 | UIViewSeven = 1 << 5 |
55 | } UITableView; |
56 | |
57 | enum { |
58 | UIOne = 0, |
59 | UITwo = 0x1, |
60 | UIthree = 0x8, |
61 | UIFour = 0x100 |
62 | }; |
63 | typedef NSInteger UI; |
64 | |
65 | typedef enum { |
66 | UIP2One = 0, |
67 | UIP2Two = 0x1, |
68 | UIP2three = 0x8, |
69 | UIP2Four = 0x100 |
70 | } UIPOWER2; |
71 | |
72 | enum { |
73 | UNOne, |
74 | UNTwo |
75 | }; |
76 | |
77 | // Should use NS_ENUM even though it is all power of 2. |
78 | enum { |
79 | UIKOne = 1, |
80 | UIKTwo = 2, |
81 | }; |
82 | typedef NSInteger UIK; |
83 | |
84 | typedef enum { |
85 | NSTickMarkBelow = 0, |
86 | NSTickMarkAbove = 1, |
87 | NSTickMarkLeft = NSTickMarkAbove, |
88 | NSTickMarkRight = NSTickMarkBelow |
89 | } NSTickMarkPosition; |
90 | |
91 | enum { |
92 | UIViewNone = 0x0, |
93 | UIViewMargin = 0x1, |
94 | UIViewWidth = 0x2, |
95 | UIViewRightMargin = 0x3, |
96 | UIViewBottomMargin = 0xbadbeef |
97 | }; |
98 | typedef NSInteger UITableStyle; |
99 | |
100 | enum { |
101 | UIView0 = 0, |
102 | UIView1 = 0XBADBEEF |
103 | }; |
104 | typedef NSInteger UIStyle; |
105 | |
106 | enum { |
107 | NSTIFFFileType, |
108 | NSBMPFileType, |
109 | NSGIFFileType, |
110 | NSJPEGFileType, |
111 | NSPNGFileType, |
112 | NSJPEG2000FileType |
113 | }; |
114 | typedef NSUInteger NSBitmapImageFileType; |
115 | |
116 | enum { |
117 | NSWarningAlertStyle = 0, |
118 | NSInformationalAlertStyle = 1, |
119 | NSCriticalAlertStyle = 2 |
120 | }; |
121 | typedef NSUInteger NSAlertStyle; |
122 | |
123 | enum { |
124 | D_NSTIFFFileType, |
125 | D_NSBMPFileType, |
126 | D_NSGIFFileType, |
127 | D_NSJPEGFileType, |
128 | D_NSPNGFileType, |
129 | D_NSJPEG2000FileType |
130 | }; |
131 | typedef NSUInteger D_NSBitmapImageFileType DEPRECATED; |
132 | |
133 | typedef enum { |
134 | D_NSTickMarkBelow = 0, |
135 | D_NSTickMarkAbove = 1 |
136 | } D_NSTickMarkPosition DEPRECATED; |
137 | |
138 | |
139 | #define NS_ENUM_AVAILABLE(X,Y) |
140 | |
141 | enum { |
142 | NSFStrongMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 0), |
143 | NSFOpaqueMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 0), |
144 | NSFMallocMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 0), |
145 | NSFMachVirtualMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 0), |
146 | NSFWeakMemory NS_ENUM_AVAILABLE(10_8, 6_0) = (5UL << 0), |
147 | |
148 | NSFObjectPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 8), |
149 | NSFOpaquePersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 8), |
150 | NSFObjectPointerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 8), |
151 | NSFCStringPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 8), |
152 | NSFStructPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 8), |
153 | NSFIntegerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (5UL << 8), |
154 | NSFCopyIn NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 16), |
155 | }; |
156 | |
157 | typedef NSUInteger NSFOptions; |
158 | |
159 | typedef enum { |
160 | UIP0One = 0, |
161 | UIP0Two = 1, |
162 | UIP0Three = 2, |
163 | UIP0Four = 10, |
164 | UIP0Last = 0x100 |
165 | } UIP; |
166 | |
167 | typedef enum { |
168 | UIPZero = 0x0, |
169 | UIPOne = 0x1, |
170 | UIPTwo = 0x2, |
171 | UIP10 = 0x10, |
172 | UIPHundred = 0x100 |
173 | } UIP_3; |
174 | |
175 | typedef enum { |
176 | UIP4Zero = 0x0, |
177 | UIP4One = 0x1, |
178 | UIP4Two = 0x2, |
179 | UIP410 = 0x10, |
180 | UIP4Hundred = 100 |
181 | } UIP4_3; |
182 | |
183 | typedef enum { |
184 | UIP5Zero = 0x0, |
185 | UIP5Two = 0x2, |
186 | UIP510 = 0x3, |
187 | UIP5Hundred = 0x4 |
188 | } UIP5_3; |
189 | |
190 | typedef enum { |
191 | UIP6Zero = 0x0, |
192 | UIP6One = 0x1, |
193 | UIP6Two = 0x2, |
194 | UIP610 = 10, |
195 | UIP6Hundred = 0x100 |
196 | } UIP6_3; |
197 | |
198 | typedef enum { |
199 | UIP7Zero = 0x0, |
200 | UIP7One = 1, |
201 | UIP7Two = 0x2, |
202 | UIP710 = 10, |
203 | UIP7Hundred = 100 |
204 | } UIP7_3; |
205 | |
206 | |
207 | typedef enum { |
208 | Random = 0, |
209 | Random1 = 2, |
210 | Random2 = 4, |
211 | Random3 = 0x12345, |
212 | Random4 = 0x3444444, |
213 | Random5 = 0xbadbeef, |
214 | Random6 |
215 | } UIP8_3; |
216 | |
217 | // rdar://15200602 |
218 | #define NS_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X))) |
219 | #define NS_ENUM_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X))) |
220 | |
221 | enum { |
222 | NSModalResponseStop = (-1000), // Also used as the default response for sheets |
223 | NSModalResponseAbort = (-1001), |
224 | NSModalResponseContinue = (-1002), |
225 | } NS_ENUM_AVAILABLE_MAC(10.9); |
226 | typedef NSInteger NSModalResponse NS_AVAILABLE_MAC(10.9); |
227 | |
228 | // rdar://15201056 |
229 | typedef NSUInteger FarFarAwayOptions; |
230 | |
231 | // rdar://15200915 |
232 | typedef NSUInteger FarAwayOptions; |
233 | enum { |
234 | NSWorkspaceLaunchAndPrint = 0x00000002, |
235 | NSWorkspaceLaunchWithErrorPresentation = 0x00000040, |
236 | NSWorkspaceLaunchInhibitingBackgroundOnly = 0x00000080, |
237 | NSWorkspaceLaunchWithoutAddingToRecents = 0x00000100, |
238 | NSWorkspaceLaunchWithoutActivation = 0x00000200, |
239 | NSWorkspaceLaunchAsync = 0x00010000, |
240 | NSWorkspaceLaunchAllowingClassicStartup = 0x00020000, |
241 | NSWorkspaceLaunchPreferringClassic = 0x00040000, |
242 | NSWorkspaceLaunchNewInstance = 0x00080000, |
243 | NSWorkspaceLaunchAndHide = 0x00100000, |
244 | NSWorkspaceLaunchAndHideOthers = 0x00200000, |
245 | NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync | |
246 | NSWorkspaceLaunchAllowingClassicStartup |
247 | }; |
248 | typedef NSUInteger NSWorkspaceLaunchOptions; |
249 | |
250 | enum { |
251 | NSExcludeQuickDrawElementsIconCreationOption = 1 << 1, |
252 | NSExclude10_4ElementsIconCreationOption = 1 << 2 |
253 | }; |
254 | typedef NSUInteger NSExcludeOptions; |
255 | |
256 | enum { |
257 | NSExcludeQuickDrawElementsCreationOption = 1 << 1, |
258 | NSExclude10_4ElementsCreationOption = 1 << 2 |
259 | }; |
260 | typedef NSUInteger NSExcludeCreationOption; |
261 | |
262 | enum { |
263 | FarAway1 = 1 << 1, |
264 | FarAway2 = 1 << 2 |
265 | }; |
266 | |
267 | enum { |
268 | NSExcludeQuickDrawElementsIconOption = 1 << 1, |
269 | NSExclude10_4ElementsIconOption = 1 << 2 |
270 | }; |
271 | typedef NSUInteger NSExcludeIconOptions; |
272 | |
273 | @interface INTF { |
274 | NSExcludeIconOptions I1; |
275 | NSExcludeIconOptions I2; |
276 | } |
277 | @end |
278 | |
279 | enum { |
280 | FarFarAway1 = 1 << 1, |
281 | FarFarAway2 = 1 << 2 |
282 | }; |
283 | |
284 | // rdar://15200915 |
285 | typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) { |
286 | NSWindowOcclusionStateVisible = 1UL << 1, |
287 | }; |
288 | |
289 | typedef NSUInteger NSWindowNumberListOptions; |
290 | |
291 | enum { |
292 | NSDirectSelection = 0, |
293 | NSSelectingNext, |
294 | NSSelectingPrevious |
295 | }; |
296 | typedef NSUInteger NSSelectionDirection; |
297 | |
298 | // standard window buttons |
299 | enum { |
300 | NSWindowCloseButton, |
301 | NSWindowMiniaturizeButton, |
302 | NSWindowZoomButton, |
303 | NSWindowToolbarButton, |
304 | NSWindowDocumentIconButton |
305 | }; |
306 | |
307 | // rdar://18262255 |
308 | typedef enum : NSUInteger { |
309 | ThingOne, |
310 | ThingTwo, |
311 | ThingThree, |
312 | } Thing; |
313 | |
314 | // rdar://18498539 |
315 | typedef enum { |
316 | one = 1 |
317 | } NumericEnum; |
318 | |
319 | typedef enum { |
320 | Two = 2 |
321 | }NumericEnum2; |
322 | |
323 | typedef enum { |
324 | Three = 3 |
325 | } |
326 | NumericEnum3; |
327 | |
328 | typedef enum { |
329 | Four = 4 |
330 | } |
331 | |
332 | NumericEnum4; |
333 | |
334 | // rdar://18532199 |
335 | enum |
336 | { |
337 | UI8one = 1 |
338 | }; |
339 | typedef int8_t MyEnumeratedType; |
340 | |
341 | |
342 | enum { |
343 | UI16One = 0, |
344 | UI16Two = 0x1, |
345 | UI16three = 0x8, |
346 | UI16Four = 0x100 |
347 | }; |
348 | typedef int16_t UI16; |
349 | |
350 | enum { |
351 | UI32ViewAutoresizingNone = 0, |
352 | UI32ViewAutoresizingFlexibleLeftMargin, |
353 | UI32ViewAutoresizingFlexibleWidth, |
354 | UI32ViewAutoresizingFlexibleRightMargin, |
355 | UI32ViewAutoresizingFlexibleTopMargin, |
356 | UI32ViewAutoresizingFlexibleHeight, |
357 | UI32ViewAutoresizingFlexibleBottomMargin |
358 | }; |
359 | typedef uint32_t UI32TableViewCellStyle; |
360 | |
361 | enum |
362 | { |
363 | UIU8one = 1 |
364 | }; |
365 | typedef uint8_t UI8Type; |
366 | |
367 | // rdar://19352510 |
368 | typedef enum : NSInteger {zero} MyEnum; |
369 | |
370 | typedef enum : NSUInteger {two} MyEnumNSUInteger; |
371 | |
372 | typedef enum : int {three, four} MyEnumint; |
373 | |
374 | typedef enum : unsigned long {five} MyEnumlonglong; |
375 | |
376 | typedef enum : unsigned long long { |
377 | ll1, |
378 | ll2= 0xff, |
379 | ll3, |
380 | ll4 |
381 | } MyEnumunsignedlonglong; |
382 | |
383 | // rdar://19994496 |
384 | typedef enum : int8_t {int8_one} MyOneEnum; |
385 | |
386 | typedef enum : int16_t { |
387 | int16_t_one, |
388 | int16_t_two } Myint16_tEnum; |
389 | |