blob: 5bc390be58e1b217bedb65e6ca824b5605287b63 [file] [log] [blame]
Fariborz Jahanianbbbb0fe2013-07-18 20:11:45 +00001// RUN: rm -rf %t
Fariborz Jahanianb8941a12013-10-02 22:49:59 +00002// 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
Fariborz Jahanianbbbb0fe2013-07-18 20:11:45 +00003// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
Rafael Espindola14f98892013-09-27 20:21:48 +00004// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
Fariborz Jahanianbbbb0fe2013-07-18 20:11:45 +00005
Stephen Hines176edba2014-12-01 14:53:08 -08006typedef signed char int8_t;
7typedef short int16_t;
8typedef int int32_t;
Fariborz Jahanianbbbb0fe2013-07-18 20:11:45 +00009typedef long NSInteger;
Stephen Hines176edba2014-12-01 14:53:08 -080010typedef long long int64_t;
11
12typedef unsigned char uint8_t;
13typedef unsigned short uint16_t;
14typedef unsigned int uint32_t;
Fariborz Jahanian9f9e5432013-07-19 01:05:49 +000015typedef unsigned long NSUInteger;
Stephen Hines176edba2014-12-01 14:53:08 -080016typedef unsigned long long uint64_t;
Fariborz Jahanian9f9e5432013-07-19 01:05:49 +000017
Fariborz Jahanianbbbb0fe2013-07-18 20:11:45 +000018#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
Fariborz Jahanian9f9e5432013-07-19 01:05:49 +000019#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
Fariborz Jahanian641645f2013-09-17 21:56:04 +000020#define DEPRECATED __attribute__((deprecated))
Fariborz Jahanianbbbb0fe2013-07-18 20:11:45 +000021
22enum {
23 blah,
24 blarg
25};
26typedef NSInteger wibble;
Fariborz Jahanian9f9e5432013-07-19 01:05:49 +000027
28enum {
29 UIViewAutoresizingNone = 0,
Fariborz Jahaniane3069e22013-07-22 18:53:45 +000030 UIViewAutoresizingFlexibleLeftMargin,
31 UIViewAutoresizingFlexibleWidth,
32 UIViewAutoresizingFlexibleRightMargin,
33 UIViewAutoresizingFlexibleTopMargin,
34 UIViewAutoresizingFlexibleHeight,
35 UIViewAutoresizingFlexibleBottomMargin
Fariborz Jahanian9f9e5432013-07-19 01:05:49 +000036};
Fariborz Jahanian9f9e5432013-07-19 01:05:49 +000037typedef NSUInteger UITableViewCellStyle;
38
Fariborz Jahanianfaae53d2013-07-19 20:18:36 +000039typedef enum {
40 UIViewAnimationTransitionNone,
41 UIViewAnimationTransitionFlipFromLeft,
42 UIViewAnimationTransitionFlipFromRight,
43 UIViewAnimationTransitionCurlUp,
44 UIViewAnimationTransitionCurlDown,
45} UIViewAnimationTransition;
46
Fariborz Jahaniane3069e22013-07-22 18:53:45 +000047typedef 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
57enum {
58 UIOne = 0,
59 UITwo = 0x1,
60 UIthree = 0x8,
61 UIFour = 0x100
62};
63typedef NSInteger UI;
64
65typedef enum {
66 UIP2One = 0,
67 UIP2Two = 0x1,
68 UIP2three = 0x8,
69 UIP2Four = 0x100
70} UIPOWER2;
71
Fariborz Jahanian72685632013-07-19 17:44:32 +000072enum {
73 UNOne,
74 UNTwo
75};
76
Fariborz Jahanian0b5941c2013-08-15 18:46:37 +000077// Should use NS_ENUM even though it is all power of 2.
78enum {
Fariborz Jahanianad162e92013-08-30 00:10:37 +000079 UIKOne = 1,
80 UIKTwo = 2,
Fariborz Jahanian0b5941c2013-08-15 18:46:37 +000081};
82typedef NSInteger UIK;
Fariborz Jahaniane1f1ff62013-08-15 19:27:42 +000083
84typedef enum {
85 NSTickMarkBelow = 0,
86 NSTickMarkAbove = 1,
87 NSTickMarkLeft = NSTickMarkAbove,
88 NSTickMarkRight = NSTickMarkBelow
89} NSTickMarkPosition;
Fariborz Jahanianad162e92013-08-30 00:10:37 +000090
91enum {
92 UIViewNone = 0x0,
93 UIViewMargin = 0x1,
94 UIViewWidth = 0x2,
95 UIViewRightMargin = 0x3,
96 UIViewBottomMargin = 0xbadbeef
97};
98typedef NSInteger UITableStyle;
99
100enum {
101 UIView0 = 0,
102 UIView1 = 0XBADBEEF
103};
104typedef NSInteger UIStyle;
Fariborz Jahanianc9820eb2013-08-30 17:46:01 +0000105
106enum {
107 NSTIFFFileType,
108 NSBMPFileType,
109 NSGIFFileType,
110 NSJPEGFileType,
111 NSPNGFileType,
112 NSJPEG2000FileType
113};
114typedef NSUInteger NSBitmapImageFileType;
115
116enum {
117 NSWarningAlertStyle = 0,
118 NSInformationalAlertStyle = 1,
119 NSCriticalAlertStyle = 2
120};
121typedef NSUInteger NSAlertStyle;
122
Fariborz Jahanian641645f2013-09-17 21:56:04 +0000123enum {
124 D_NSTIFFFileType,
125 D_NSBMPFileType,
126 D_NSGIFFileType,
127 D_NSJPEGFileType,
128 D_NSPNGFileType,
129 D_NSJPEG2000FileType
130};
131typedef NSUInteger D_NSBitmapImageFileType DEPRECATED;
132
133typedef enum {
134 D_NSTickMarkBelow = 0,
135 D_NSTickMarkAbove = 1
136} D_NSTickMarkPosition DEPRECATED;
137
Fariborz Jahanianbb2405f2013-09-17 23:32:51 +0000138
139#define NS_ENUM_AVAILABLE(X,Y)
140
141enum {
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
157typedef NSUInteger NSFOptions;
Fariborz Jahanianff89d062013-09-23 20:27:06 +0000158
159typedef enum {
160 UIP0One = 0,
161 UIP0Two = 1,
162 UIP0Three = 2,
163 UIP0Four = 10,
164 UIP0Last = 0x100
165} UIP;
166
167typedef enum {
168 UIPZero = 0x0,
169 UIPOne = 0x1,
170 UIPTwo = 0x2,
171 UIP10 = 0x10,
172 UIPHundred = 0x100
173} UIP_3;
174
175typedef enum {
176 UIP4Zero = 0x0,
177 UIP4One = 0x1,
178 UIP4Two = 0x2,
179 UIP410 = 0x10,
180 UIP4Hundred = 100
181} UIP4_3;
182
183typedef enum {
184 UIP5Zero = 0x0,
185 UIP5Two = 0x2,
186 UIP510 = 0x3,
187 UIP5Hundred = 0x4
188} UIP5_3;
189
190typedef enum {
191 UIP6Zero = 0x0,
192 UIP6One = 0x1,
193 UIP6Two = 0x2,
194 UIP610 = 10,
195 UIP6Hundred = 0x100
196} UIP6_3;
197
198typedef enum {
199 UIP7Zero = 0x0,
200 UIP7One = 1,
201 UIP7Two = 0x2,
202 UIP710 = 10,
203 UIP7Hundred = 100
204} UIP7_3;
205
206
207typedef enum {
208 Random = 0,
209 Random1 = 2,
210 Random2 = 4,
211 Random3 = 0x12345,
212 Random4 = 0x3444444,
213 Random5 = 0xbadbeef,
214 Random6
215} UIP8_3;
Fariborz Jahanian1f9a09d2013-10-11 17:35:22 +0000216
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
221enum {
222 NSModalResponseStop = (-1000), // Also used as the default response for sheets
223 NSModalResponseAbort = (-1001),
224 NSModalResponseContinue = (-1002),
225} NS_ENUM_AVAILABLE_MAC(10.9);
226typedef NSInteger NSModalResponse NS_AVAILABLE_MAC(10.9);
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000227
Fariborz Jahanianb3c71fa2013-10-15 00:00:28 +0000228// rdar://15201056
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000229typedef NSUInteger FarFarAwayOptions;
Fariborz Jahanianb3c71fa2013-10-15 00:00:28 +0000230
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000231// rdar://15200915
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000232typedef NSUInteger FarAwayOptions;
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000233enum {
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 |
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000246 NSWorkspaceLaunchAllowingClassicStartup
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000247};
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000248typedef NSUInteger NSWorkspaceLaunchOptions;
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000249
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000250enum {
251 NSExcludeQuickDrawElementsIconCreationOption = 1 << 1,
252 NSExclude10_4ElementsIconCreationOption = 1 << 2
253};
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000254typedef NSUInteger NSExcludeOptions;
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000255
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000256enum {
257 NSExcludeQuickDrawElementsCreationOption = 1 << 1,
258 NSExclude10_4ElementsCreationOption = 1 << 2
259};
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000260typedef NSUInteger NSExcludeCreationOption;
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000261
262enum {
Fariborz Jahanianb3c71fa2013-10-15 00:00:28 +0000263 FarAway1 = 1 << 1,
264 FarAway2 = 1 << 2
265};
266
267enum {
Fariborz Jahaniand2dab642013-10-11 21:34:56 +0000268 NSExcludeQuickDrawElementsIconOption = 1 << 1,
269 NSExclude10_4ElementsIconOption = 1 << 2
270};
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000271typedef NSUInteger NSExcludeIconOptions;
Fariborz Jahanianb3c71fa2013-10-15 00:00:28 +0000272
273@interface INTF {
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000274 NSExcludeIconOptions I1;
275 NSExcludeIconOptions I2;
Fariborz Jahanianb3c71fa2013-10-15 00:00:28 +0000276}
277@end
278
279enum {
Fariborz Jahanianf98f12f2013-10-17 22:23:32 +0000280 FarFarAway1 = 1 << 1,
281 FarFarAway2 = 1 << 2
282};
283
284// rdar://15200915
285typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) {
286 NSWindowOcclusionStateVisible = 1UL << 1,
287};
288
289typedef NSUInteger NSWindowNumberListOptions;
290
291enum {
292 NSDirectSelection = 0,
293 NSSelectingNext,
294 NSSelectingPrevious
295};
296typedef NSUInteger NSSelectionDirection;
297
298// standard window buttons
299enum {
300 NSWindowCloseButton,
301 NSWindowMiniaturizeButton,
302 NSWindowZoomButton,
303 NSWindowToolbarButton,
304 NSWindowDocumentIconButton
Fariborz Jahanianb3c71fa2013-10-15 00:00:28 +0000305};
Stephen Hines176edba2014-12-01 14:53:08 -0800306
307// rdar://18262255
308typedef enum : NSUInteger {
309 ThingOne,
310 ThingTwo,
311 ThingThree,
312} Thing;
313
314// rdar://18498539
315typedef enum {
316 one = 1
317} NumericEnum;
318
319typedef enum {
320 Two = 2
321}NumericEnum2;
322
323typedef enum {
324 Three = 3
325}
326NumericEnum3;
327
328typedef enum {
329 Four = 4
330}
331
332 NumericEnum4;
333
334// rdar://18532199
335enum
336{
337 UI8one = 1
338};
339typedef int8_t MyEnumeratedType;
340
341
342enum {
343 UI16One = 0,
344 UI16Two = 0x1,
345 UI16three = 0x8,
346 UI16Four = 0x100
347};
348typedef int16_t UI16;
349
350enum {
351 UI32ViewAutoresizingNone = 0,
352 UI32ViewAutoresizingFlexibleLeftMargin,
353 UI32ViewAutoresizingFlexibleWidth,
354 UI32ViewAutoresizingFlexibleRightMargin,
355 UI32ViewAutoresizingFlexibleTopMargin,
356 UI32ViewAutoresizingFlexibleHeight,
357 UI32ViewAutoresizingFlexibleBottomMargin
358};
359typedef uint32_t UI32TableViewCellStyle;
360
361enum
362{
363 UIU8one = 1
364};
365typedef uint8_t UI8Type;
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700366
367// rdar://19352510
368typedef enum : NSInteger {zero} MyEnum;
369
370typedef enum : NSUInteger {two} MyEnumNSUInteger;
371
372typedef enum : int {three, four} MyEnumint;
373
374typedef enum : unsigned long {five} MyEnumlonglong;
375
376typedef enum : unsigned long long {
377 ll1,
378 ll2= 0xff,
379 ll3,
380 ll4
381} MyEnumunsignedlonglong;
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -0700382
383// rdar://19994496
384typedef enum : int8_t {int8_one} MyOneEnum;
385
386typedef enum : int16_t {
387 int16_t_one,
388 int16_t_two } Myint16_tEnum;