void migrateObjCInterfaceDecl(ASTContext &Ctx, ObjCContainerDecl *D);
void migrateProtocolConformance(ASTContext &Ctx,
const ObjCImplementationDecl *ImpDecl);
- void migrateNSEnumDecl(ASTContext &Ctx, const EnumDecl *EnumDcl,
+ bool migrateNSEnumDecl(ASTContext &Ctx, const EnumDecl *EnumDcl,
const TypedefDecl *TypedefDcl);
void migrateAllMethodInstaceType(ASTContext &Ctx, ObjCContainerDecl *CDecl);
void migrateMethodInstanceType(ASTContext &Ctx, ObjCContainerDecl *CDecl,
Editor->commit(commit);
}
-void ObjCMigrateASTConsumer::migrateNSEnumDecl(ASTContext &Ctx,
+bool ObjCMigrateASTConsumer::migrateNSEnumDecl(ASTContext &Ctx,
const EnumDecl *EnumDcl,
const TypedefDecl *TypedefDcl) {
if (!EnumDcl->isCompleteDefinition() || EnumDcl->getIdentifier() ||
!TypedefDcl->getIdentifier() ||
EnumDcl->isDeprecated() || TypedefDcl->isDeprecated())
- return;
+ return false;
QualType qt = TypedefDcl->getTypeSourceInfo()->getType();
bool IsNSIntegerType = NSAPIObj->isObjCNSIntegerType(qt);
bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl);
if (NSOptions) {
if (!Ctx.Idents.get("NS_OPTIONS").hasMacroDefinition())
- return;
+ return false;
}
else if (!Ctx.Idents.get("NS_ENUM").hasMacroDefinition())
- return;
+ return false;
edit::Commit commit(*Editor);
rewriteToNSMacroDecl(EnumDcl, TypedefDcl, *NSAPIObj, commit, !NSOptions);
Editor->commit(commit);
}
}
- return;
+ return false;
}
// We may still use NS_OPTIONS based on what we find in the enumertor list.
bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl);
// NS_ENUM must be available.
if (IsNSIntegerType && !Ctx.Idents.get("NS_ENUM").hasMacroDefinition())
- return;
+ return false;
// NS_OPTIONS must be available.
if (IsNSUIntegerType && !Ctx.Idents.get("NS_OPTIONS").hasMacroDefinition())
- return;
+ return false;
edit::Commit commit(*Editor);
rewriteToNSEnumDecl(EnumDcl, TypedefDcl, *NSAPIObj, commit, IsNSIntegerType, NSOptions);
Editor->commit(commit);
+ return true;
}
static void ReplaceWithInstancetype(const ObjCMigrateASTConsumer &ASTC,
++N;
if (N != DEnd)
if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*N)) {
- if (ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros)
- migrateNSEnumDecl(Ctx, ED, TD);
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros) {
+ if (migrateNSEnumDecl(Ctx, ED, TD))
+ D++;
+ }
+ }
+ }
+ else if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*D)) {
+ DeclContext::decl_iterator N = D;
+ ++N;
+ if (N != DEnd)
+ if (const EnumDecl *ED = dyn_cast<EnumDecl>(*N)) {
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros) {
+ if (migrateNSEnumDecl(Ctx, ED, TD))
+ ++D;
+ }
}
}
else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*D)) {
NSModalResponseContinue = (-1002),
} NS_ENUM_AVAILABLE_MAC(10.9);
typedef NSInteger NSModalResponse NS_AVAILABLE_MAC(10.9);
+
+// rdar://15200915
+typedef NSUInteger NSWorkspaceLaunchOptions;
+enum {
+ NSWorkspaceLaunchAndPrint = 0x00000002,
+ NSWorkspaceLaunchWithErrorPresentation = 0x00000040,
+ NSWorkspaceLaunchInhibitingBackgroundOnly = 0x00000080,
+ NSWorkspaceLaunchWithoutAddingToRecents = 0x00000100,
+ NSWorkspaceLaunchWithoutActivation = 0x00000200,
+ NSWorkspaceLaunchAsync = 0x00010000,
+ NSWorkspaceLaunchAllowingClassicStartup = 0x00020000,
+ NSWorkspaceLaunchPreferringClassic = 0x00040000,
+ NSWorkspaceLaunchNewInstance = 0x00080000,
+ NSWorkspaceLaunchAndHide = 0x00100000,
+ NSWorkspaceLaunchAndHideOthers = 0x00200000,
+ NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync |
+NSWorkspaceLaunchAllowingClassicStartup
+};
+
+typedef NSUInteger NSWorkspaceIconCreationOptions;
+enum {
+ NSExcludeQuickDrawElementsIconCreationOption = 1 << 1,
+ NSExclude10_4ElementsIconCreationOption = 1 << 2
+};
+
+typedef NSUInteger NSWorkspaceCreationOptions;
+enum {
+ NSExcludeQuickDrawElementsCreationOption = 1 << 1,
+ NSExclude10_4ElementsCreationOption = 1 << 2
+};
+
+enum {
+ NSExcludeQuickDrawElementsIconOption = 1 << 1,
+ NSExclude10_4ElementsIconOption = 1 << 2
+};
+typedef NSUInteger NSWorkspaceIconOptions;
NSModalResponseAbort = (-1001),
NSModalResponseContinue = (-1002),
} NS_ENUM_AVAILABLE_MAC(10.9);
+
+// rdar://15200915
+typedef NS_OPTIONS(NSUInteger, NSWorkspaceLaunchOptions) {
+ NSWorkspaceLaunchAndPrint = 0x00000002,
+ NSWorkspaceLaunchWithErrorPresentation = 0x00000040,
+ NSWorkspaceLaunchInhibitingBackgroundOnly = 0x00000080,
+ NSWorkspaceLaunchWithoutAddingToRecents = 0x00000100,
+ NSWorkspaceLaunchWithoutActivation = 0x00000200,
+ NSWorkspaceLaunchAsync = 0x00010000,
+ NSWorkspaceLaunchAllowingClassicStartup = 0x00020000,
+ NSWorkspaceLaunchPreferringClassic = 0x00040000,
+ NSWorkspaceLaunchNewInstance = 0x00080000,
+ NSWorkspaceLaunchAndHide = 0x00100000,
+ NSWorkspaceLaunchAndHideOthers = 0x00200000,
+ NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync |
+NSWorkspaceLaunchAllowingClassicStartup
+};
+
+typedef NS_OPTIONS(NSUInteger, NSWorkspaceIconCreationOptions) {
+ NSExcludeQuickDrawElementsIconCreationOption = 1 << 1,
+ NSExclude10_4ElementsIconCreationOption = 1 << 2
+};
+
+typedef NS_OPTIONS(NSUInteger, NSWorkspaceCreationOptions) {
+ NSExcludeQuickDrawElementsCreationOption = 1 << 1,
+ NSExclude10_4ElementsCreationOption = 1 << 2
+};
+
+typedef NS_OPTIONS(NSUInteger, NSWorkspaceIconOptions) {
+ NSExcludeQuickDrawElementsIconOption = 1 << 1,
+ NSExclude10_4ElementsIconOption = 1 << 2
+};