ObjectiveC migrator. In infering NS_ENUM/NS_OPTIONS
macros, prefer the typedef immediately following the enum declaration to the one preceeding it. // rdar://15200915 llvm-svn: 192927
This commit is contained in:
parent
db67ec3c27
commit
de79e81686
|
@ -745,6 +745,7 @@ bool ObjCMigrateASTConsumer::migrateNSEnumDecl(ASTContext &Ctx,
|
|||
edit::Commit commit(*Editor);
|
||||
rewriteToNSMacroDecl(EnumDcl, TypedefDcl, *NSAPIObj, commit, !NSOptions);
|
||||
Editor->commit(commit);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -1530,6 +1531,15 @@ void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
|
|||
DeclContext::decl_iterator N = D;
|
||||
if (++N != DEnd)
|
||||
if (const EnumDecl *ED = dyn_cast<EnumDecl>(*N)) {
|
||||
if (++N != DEnd) {
|
||||
if (const TypedefDecl *TD1 = dyn_cast<TypedefDecl>(*N)) {
|
||||
if (migrateNSEnumDecl(Ctx, ED, TD1)) {
|
||||
++D; ++D;
|
||||
CacheObjCNSIntegerTypedefed(TD);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (migrateNSEnumDecl(Ctx, ED, TD)) {
|
||||
++D;
|
||||
continue;
|
||||
|
|
|
@ -217,10 +217,10 @@ enum {
|
|||
typedef NSInteger NSModalResponse NS_AVAILABLE_MAC(10.9);
|
||||
|
||||
// rdar://15201056
|
||||
typedef NSUInteger FarAwayNSUInteger;
|
||||
typedef NSUInteger FarFarAwayOptions;
|
||||
|
||||
// rdar://15200915
|
||||
typedef NSUInteger NSWorkspaceLaunchOptions;
|
||||
typedef NSUInteger FarAwayOptions;
|
||||
enum {
|
||||
NSWorkspaceLaunchAndPrint = 0x00000002,
|
||||
NSWorkspaceLaunchWithErrorPresentation = 0x00000040,
|
||||
|
@ -234,20 +234,21 @@ enum {
|
|||
NSWorkspaceLaunchAndHide = 0x00100000,
|
||||
NSWorkspaceLaunchAndHideOthers = 0x00200000,
|
||||
NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync |
|
||||
NSWorkspaceLaunchAllowingClassicStartup
|
||||
NSWorkspaceLaunchAllowingClassicStartup
|
||||
};
|
||||
typedef NSUInteger NSWorkspaceLaunchOptions;
|
||||
|
||||
typedef NSUInteger NSWorkspaceIconCreationOptions;
|
||||
enum {
|
||||
NSExcludeQuickDrawElementsIconCreationOption = 1 << 1,
|
||||
NSExclude10_4ElementsIconCreationOption = 1 << 2
|
||||
};
|
||||
typedef NSUInteger NSExcludeOptions;
|
||||
|
||||
typedef NSUInteger NSWorkspaceCreationOptions;
|
||||
enum {
|
||||
NSExcludeQuickDrawElementsCreationOption = 1 << 1,
|
||||
NSExclude10_4ElementsCreationOption = 1 << 2
|
||||
};
|
||||
typedef NSUInteger NSExcludeCreationOption;
|
||||
|
||||
enum {
|
||||
FarAway1 = 1 << 1,
|
||||
|
@ -258,17 +259,38 @@ enum {
|
|||
NSExcludeQuickDrawElementsIconOption = 1 << 1,
|
||||
NSExclude10_4ElementsIconOption = 1 << 2
|
||||
};
|
||||
typedef NSUInteger NSWorkspaceIconOptions;
|
||||
|
||||
typedef NSInteger NSCollectionViewDropOperation;
|
||||
typedef NSUInteger NSExcludeIconOptions;
|
||||
|
||||
@interface INTF {
|
||||
NSCollectionViewDropOperation I1;
|
||||
NSCollectionViewDropOperation I2;
|
||||
NSExcludeIconOptions I1;
|
||||
NSExcludeIconOptions I2;
|
||||
}
|
||||
@end
|
||||
|
||||
enum {
|
||||
NotFarAway1 = 1 << 1,
|
||||
NotFarAway2 = 1 << 2
|
||||
FarFarAway1 = 1 << 1,
|
||||
FarFarAway2 = 1 << 2
|
||||
};
|
||||
|
||||
// rdar://15200915
|
||||
typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) {
|
||||
NSWindowOcclusionStateVisible = 1UL << 1,
|
||||
};
|
||||
|
||||
typedef NSUInteger NSWindowNumberListOptions;
|
||||
|
||||
enum {
|
||||
NSDirectSelection = 0,
|
||||
NSSelectingNext,
|
||||
NSSelectingPrevious
|
||||
};
|
||||
typedef NSUInteger NSSelectionDirection;
|
||||
|
||||
// standard window buttons
|
||||
enum {
|
||||
NSWindowCloseButton,
|
||||
NSWindowMiniaturizeButton,
|
||||
NSWindowZoomButton,
|
||||
NSWindowToolbarButton,
|
||||
NSWindowDocumentIconButton
|
||||
};
|
||||
|
|
|
@ -207,12 +207,13 @@ typedef NS_ENUM(NSInteger, NSModalResponse) {
|
|||
} NS_ENUM_AVAILABLE_MAC(10.9);
|
||||
|
||||
// rdar://15201056
|
||||
typedef NS_OPTIONS(NSUInteger, FarAwayNSUInteger) {
|
||||
typedef NSUInteger FarFarAwayOptions;
|
||||
|
||||
// rdar://15200915
|
||||
typedef NS_OPTIONS(NSUInteger, FarAwayOptions) {
|
||||
FarAway1 = 1 << 1,
|
||||
FarAway2 = 1 << 2
|
||||
};
|
||||
|
||||
// rdar://15200915
|
||||
typedef NS_OPTIONS(NSUInteger, NSWorkspaceLaunchOptions) {
|
||||
NSWorkspaceLaunchAndPrint = 0x00000002,
|
||||
NSWorkspaceLaunchWithErrorPresentation = 0x00000040,
|
||||
|
@ -226,33 +227,53 @@ typedef NS_OPTIONS(NSUInteger, NSWorkspaceLaunchOptions) {
|
|||
NSWorkspaceLaunchAndHide = 0x00100000,
|
||||
NSWorkspaceLaunchAndHideOthers = 0x00200000,
|
||||
NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync |
|
||||
NSWorkspaceLaunchAllowingClassicStartup
|
||||
NSWorkspaceLaunchAllowingClassicStartup
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSWorkspaceIconCreationOptions) {
|
||||
typedef NS_OPTIONS(NSUInteger, NSExcludeOptions) {
|
||||
NSExcludeQuickDrawElementsIconCreationOption = 1 << 1,
|
||||
NSExclude10_4ElementsIconCreationOption = 1 << 2
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSWorkspaceCreationOptions) {
|
||||
typedef NS_OPTIONS(NSUInteger, NSExcludeCreationOption) {
|
||||
NSExcludeQuickDrawElementsCreationOption = 1 << 1,
|
||||
NSExclude10_4ElementsCreationOption = 1 << 2
|
||||
};
|
||||
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSWorkspaceIconOptions) {
|
||||
typedef NS_OPTIONS(NSUInteger, NSExcludeIconOptions) {
|
||||
NSExcludeQuickDrawElementsIconOption = 1 << 1,
|
||||
NSExclude10_4ElementsIconOption = 1 << 2
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSCollectionViewDropOperation) {
|
||||
NotFarAway1 = 1 << 1,
|
||||
NotFarAway2 = 1 << 2
|
||||
};
|
||||
|
||||
@interface INTF {
|
||||
NSCollectionViewDropOperation I1;
|
||||
NSCollectionViewDropOperation I2;
|
||||
NSExcludeIconOptions I1;
|
||||
NSExcludeIconOptions I2;
|
||||
}
|
||||
@end
|
||||
|
||||
enum {
|
||||
FarFarAway1 = 1 << 1,
|
||||
FarFarAway2 = 1 << 2
|
||||
};
|
||||
|
||||
// rdar://15200915
|
||||
typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) {
|
||||
NSWindowOcclusionStateVisible = 1UL << 1,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, NSWindowNumberListOptions) {
|
||||
NSWindowCloseButton,
|
||||
NSWindowMiniaturizeButton,
|
||||
NSWindowZoomButton,
|
||||
NSWindowToolbarButton,
|
||||
NSWindowDocumentIconButton
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, NSSelectionDirection) {
|
||||
NSDirectSelection = 0,
|
||||
NSSelectingNext,
|
||||
NSSelectingPrevious
|
||||
};
|
||||
|
||||
// standard window buttons
|
||||
|
|
Loading…
Reference in New Issue