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 6typedef long NSInteger; 7typedef unsigned long NSUInteger; 8 9#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 10#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 11#define DEPRECATED __attribute__((deprecated)) 12 13enum { 14 blah, 15 blarg 16}; 17typedef NSInteger wibble; 18 19enum { 20 UIViewAutoresizingNone = 0, 21 UIViewAutoresizingFlexibleLeftMargin, 22 UIViewAutoresizingFlexibleWidth, 23 UIViewAutoresizingFlexibleRightMargin, 24 UIViewAutoresizingFlexibleTopMargin, 25 UIViewAutoresizingFlexibleHeight, 26 UIViewAutoresizingFlexibleBottomMargin 27}; 28typedef NSUInteger UITableViewCellStyle; 29 30typedef enum { 31 UIViewAnimationTransitionNone, 32 UIViewAnimationTransitionFlipFromLeft, 33 UIViewAnimationTransitionFlipFromRight, 34 UIViewAnimationTransitionCurlUp, 35 UIViewAnimationTransitionCurlDown, 36} UIViewAnimationTransition; 37 38typedef enum { 39 UIViewOne = 0, 40 UIViewTwo = 1 << 0, 41 UIViewThree = 1 << 1, 42 UIViewFour = 1 << 2, 43 UIViewFive = 1 << 3, 44 UIViewSix = 1 << 4, 45 UIViewSeven = 1 << 5 46} UITableView; 47 48enum { 49 UIOne = 0, 50 UITwo = 0x1, 51 UIthree = 0x8, 52 UIFour = 0x100 53}; 54typedef NSInteger UI; 55 56typedef enum { 57 UIP2One = 0, 58 UIP2Two = 0x1, 59 UIP2three = 0x8, 60 UIP2Four = 0x100 61} UIPOWER2; 62 63enum { 64 UNOne, 65 UNTwo 66}; 67 68// Should use NS_ENUM even though it is all power of 2. 69enum { 70 UIKOne = 1, 71 UIKTwo = 2, 72}; 73typedef NSInteger UIK; 74 75typedef enum { 76 NSTickMarkBelow = 0, 77 NSTickMarkAbove = 1, 78 NSTickMarkLeft = NSTickMarkAbove, 79 NSTickMarkRight = NSTickMarkBelow 80} NSTickMarkPosition; 81 82enum { 83 UIViewNone = 0x0, 84 UIViewMargin = 0x1, 85 UIViewWidth = 0x2, 86 UIViewRightMargin = 0x3, 87 UIViewBottomMargin = 0xbadbeef 88}; 89typedef NSInteger UITableStyle; 90 91enum { 92 UIView0 = 0, 93 UIView1 = 0XBADBEEF 94}; 95typedef NSInteger UIStyle; 96 97enum { 98 NSTIFFFileType, 99 NSBMPFileType, 100 NSGIFFileType, 101 NSJPEGFileType, 102 NSPNGFileType, 103 NSJPEG2000FileType 104}; 105typedef NSUInteger NSBitmapImageFileType; 106 107enum { 108 NSWarningAlertStyle = 0, 109 NSInformationalAlertStyle = 1, 110 NSCriticalAlertStyle = 2 111}; 112typedef NSUInteger NSAlertStyle; 113 114enum { 115 D_NSTIFFFileType, 116 D_NSBMPFileType, 117 D_NSGIFFileType, 118 D_NSJPEGFileType, 119 D_NSPNGFileType, 120 D_NSJPEG2000FileType 121}; 122typedef NSUInteger D_NSBitmapImageFileType DEPRECATED; 123 124typedef enum { 125 D_NSTickMarkBelow = 0, 126 D_NSTickMarkAbove = 1 127} D_NSTickMarkPosition DEPRECATED; 128 129 130#define NS_ENUM_AVAILABLE(X,Y) 131 132enum { 133 NSFStrongMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 0), 134 NSFOpaqueMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 0), 135 NSFMallocMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 0), 136 NSFMachVirtualMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 0), 137 NSFWeakMemory NS_ENUM_AVAILABLE(10_8, 6_0) = (5UL << 0), 138 139 NSFObjectPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 8), 140 NSFOpaquePersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 8), 141 NSFObjectPointerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 8), 142 NSFCStringPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 8), 143 NSFStructPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 8), 144 NSFIntegerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (5UL << 8), 145 NSFCopyIn NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 16), 146}; 147 148typedef NSUInteger NSFOptions; 149 150typedef enum { 151 UIP0One = 0, 152 UIP0Two = 1, 153 UIP0Three = 2, 154 UIP0Four = 10, 155 UIP0Last = 0x100 156} UIP; 157 158typedef enum { 159 UIPZero = 0x0, 160 UIPOne = 0x1, 161 UIPTwo = 0x2, 162 UIP10 = 0x10, 163 UIPHundred = 0x100 164} UIP_3; 165 166typedef enum { 167 UIP4Zero = 0x0, 168 UIP4One = 0x1, 169 UIP4Two = 0x2, 170 UIP410 = 0x10, 171 UIP4Hundred = 100 172} UIP4_3; 173 174typedef enum { 175 UIP5Zero = 0x0, 176 UIP5Two = 0x2, 177 UIP510 = 0x3, 178 UIP5Hundred = 0x4 179} UIP5_3; 180 181typedef enum { 182 UIP6Zero = 0x0, 183 UIP6One = 0x1, 184 UIP6Two = 0x2, 185 UIP610 = 10, 186 UIP6Hundred = 0x100 187} UIP6_3; 188 189typedef enum { 190 UIP7Zero = 0x0, 191 UIP7One = 1, 192 UIP7Two = 0x2, 193 UIP710 = 10, 194 UIP7Hundred = 100 195} UIP7_3; 196 197 198typedef enum { 199 Random = 0, 200 Random1 = 2, 201 Random2 = 4, 202 Random3 = 0x12345, 203 Random4 = 0x3444444, 204 Random5 = 0xbadbeef, 205 Random6 206} UIP8_3; 207 208// rdar://15200602 209#define NS_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X))) 210#define NS_ENUM_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X))) 211 212enum { 213 NSModalResponseStop = (-1000), // Also used as the default response for sheets 214 NSModalResponseAbort = (-1001), 215 NSModalResponseContinue = (-1002), 216} NS_ENUM_AVAILABLE_MAC(10.9); 217typedef NSInteger NSModalResponse NS_AVAILABLE_MAC(10.9); 218 219// rdar://15201056 220typedef NSUInteger FarFarAwayOptions; 221 222// rdar://15200915 223typedef NSUInteger FarAwayOptions; 224enum { 225 NSWorkspaceLaunchAndPrint = 0x00000002, 226 NSWorkspaceLaunchWithErrorPresentation = 0x00000040, 227 NSWorkspaceLaunchInhibitingBackgroundOnly = 0x00000080, 228 NSWorkspaceLaunchWithoutAddingToRecents = 0x00000100, 229 NSWorkspaceLaunchWithoutActivation = 0x00000200, 230 NSWorkspaceLaunchAsync = 0x00010000, 231 NSWorkspaceLaunchAllowingClassicStartup = 0x00020000, 232 NSWorkspaceLaunchPreferringClassic = 0x00040000, 233 NSWorkspaceLaunchNewInstance = 0x00080000, 234 NSWorkspaceLaunchAndHide = 0x00100000, 235 NSWorkspaceLaunchAndHideOthers = 0x00200000, 236 NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync | 237 NSWorkspaceLaunchAllowingClassicStartup 238}; 239typedef NSUInteger NSWorkspaceLaunchOptions; 240 241enum { 242 NSExcludeQuickDrawElementsIconCreationOption = 1 << 1, 243 NSExclude10_4ElementsIconCreationOption = 1 << 2 244}; 245typedef NSUInteger NSExcludeOptions; 246 247enum { 248 NSExcludeQuickDrawElementsCreationOption = 1 << 1, 249 NSExclude10_4ElementsCreationOption = 1 << 2 250}; 251typedef NSUInteger NSExcludeCreationOption; 252 253enum { 254 FarAway1 = 1 << 1, 255 FarAway2 = 1 << 2 256}; 257 258enum { 259 NSExcludeQuickDrawElementsIconOption = 1 << 1, 260 NSExclude10_4ElementsIconOption = 1 << 2 261}; 262typedef NSUInteger NSExcludeIconOptions; 263 264@interface INTF { 265 NSExcludeIconOptions I1; 266 NSExcludeIconOptions I2; 267} 268@end 269 270enum { 271 FarFarAway1 = 1 << 1, 272 FarFarAway2 = 1 << 2 273}; 274 275// rdar://15200915 276typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) { 277 NSWindowOcclusionStateVisible = 1UL << 1, 278}; 279 280typedef NSUInteger NSWindowNumberListOptions; 281 282enum { 283 NSDirectSelection = 0, 284 NSSelectingNext, 285 NSSelectingPrevious 286}; 287typedef NSUInteger NSSelectionDirection; 288 289// standard window buttons 290enum { 291 NSWindowCloseButton, 292 NSWindowMiniaturizeButton, 293 NSWindowZoomButton, 294 NSWindowToolbarButton, 295 NSWindowDocumentIconButton 296}; 297