ObjectiveC migrator. Starting distiguising different
migrations under their own option. wip and // rdar://15003157 llvm-svn: 191855
This commit is contained in:
parent
5ea993bb59
commit
c121386170
|
@ -165,8 +165,12 @@ def objcmt_migrate_subscripting : Flag<["-"], "objcmt-migrate-subscripting">, Fl
|
|||
HelpText<"Enable migration to modern ObjC subscripting">;
|
||||
def objcmt_migrate_property : Flag<["-"], "objcmt-migrate-property">, Flags<[CC1Option]>,
|
||||
HelpText<"Enable migration to modern ObjC property">;
|
||||
def objcmt_migrate_all : Flag<["-"], "objcmt-migrate-all">, Flags<[CC1Option]>,
|
||||
HelpText<"Enable migration to modern ObjC">;
|
||||
def objcmt_migrate_readonly_property : Flag<["-"], "objcmt-migrate-readonly-property">, Flags<[CC1Option]>,
|
||||
HelpText<"Enable migration to modern ObjC readonly property">;
|
||||
def objcmt_migrate_readwrite_property : Flag<["-"], "objcmt-migrate-readwrite-property">, Flags<[CC1Option]>,
|
||||
HelpText<"Enable migration to modern ObjC readwrite property">;
|
||||
// Make sure all other -ccc- options are rejected.
|
||||
def ccc_ : Joined<["-"], "ccc-">, Group<internal_Group>, Flags<[Unsupported]>;
|
||||
|
||||
|
|
|
@ -160,12 +160,27 @@ public:
|
|||
ObjCMT_Literals = 0x1,
|
||||
/// \brief Enable migration to modern ObjC subscripting.
|
||||
ObjCMT_Subscripting = 0x2,
|
||||
/// \brief Enable migration to modern ObjC property.
|
||||
ObjCMT_Property = 0x4,
|
||||
/// \brief Enable migration to modern ObjC readonly property.
|
||||
ObjCMT_ReadonlyProperty = 0x8,
|
||||
ObjCMT_All = (ObjCMT_Literals | ObjCMT_Subscripting |
|
||||
ObjCMT_Property | ObjCMT_ReadonlyProperty)
|
||||
ObjCMT_ReadonlyProperty = 0x4,
|
||||
/// \brief Enable migration to modern ObjC readwrite property.
|
||||
ObjCMT_ReadwriteProperty = 0x8,
|
||||
/// \brief Enable migration to modern ObjC property.
|
||||
ObjCMT_Property = (ObjCMT_ReadonlyProperty | ObjCMT_ReadwriteProperty),
|
||||
/// \brief Enable annotation of ObjCMethods of all kinds.
|
||||
ObjCMT_Annotation = 0x10,
|
||||
/// \brief Enable migration of ObjC methods to 'instancetype'.
|
||||
ObjCMT_Instancetype = 0x20,
|
||||
/// \brief Enable migration to NS_ENUM/NS_OPTIONS macros.
|
||||
ObjCMT_NsMacros = 0x40,
|
||||
/// \brief Enable migration to add conforming protocols.
|
||||
ObjCMT_ProtocolConformance = 0x80,
|
||||
ObjCMT_MigrateDecls = (ObjCMT_ReadonlyProperty | ObjCMT_ReadwriteProperty |
|
||||
ObjCMT_Annotation | ObjCMT_Instancetype |
|
||||
ObjCMT_NsMacros | ObjCMT_ProtocolConformance),
|
||||
ObjCMT_MigrateAll = (ObjCMT_Literals | ObjCMT_Subscripting |
|
||||
ObjCMT_ReadonlyProperty | ObjCMT_ReadwriteProperty |
|
||||
ObjCMT_Annotation | ObjCMT_Instancetype |
|
||||
ObjCMT_NsMacros | ObjCMT_ProtocolConformance)
|
||||
};
|
||||
unsigned ObjCMTAction;
|
||||
|
||||
|
|
|
@ -806,6 +806,8 @@ bool ObjCMigrateASTConsumer::migrateProperty(ASTContext &Ctx,
|
|||
}
|
||||
|
||||
if (SetterMethod) {
|
||||
if ((ASTMigrateActions & FrontendOptions::ObjCMT_ReadwriteProperty) == 0)
|
||||
return false;
|
||||
if (SetterMethod->isDeprecated() ||
|
||||
!AttributesMatch(Method, SetterMethod))
|
||||
return false;
|
||||
|
@ -1324,7 +1326,7 @@ IsReallyASystemHeader(ASTContext &Ctx, const FileEntry *file, FileID FID) {
|
|||
void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
|
||||
|
||||
TranslationUnitDecl *TU = Ctx.getTranslationUnitDecl();
|
||||
if (ASTMigrateActions & FrontendOptions::ObjCMT_Property) {
|
||||
if (ASTMigrateActions & FrontendOptions::ObjCMT_MigrateDecls) {
|
||||
for (DeclContext::decl_iterator D = TU->decls_begin(), DEnd = TU->decls_end();
|
||||
D != DEnd; ++D) {
|
||||
if (unsigned FID =
|
||||
|
@ -1402,7 +1404,7 @@ ASTConsumer *MigrateSourceAction::CreateASTConsumer(CompilerInstance &CI,
|
|||
PPRec = new PPConditionalDirectiveRecord(CI.getSourceManager());
|
||||
CI.getPreprocessor().addPPCallbacks(PPRec);
|
||||
return new ObjCMigrateASTConsumer(CI.getFrontendOpts().OutputFile,
|
||||
FrontendOptions::ObjCMT_All,
|
||||
FrontendOptions::ObjCMT_MigrateAll,
|
||||
Remapper,
|
||||
CI.getFileManager(),
|
||||
PPRec,
|
||||
|
|
|
@ -801,6 +801,10 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
|||
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Property;
|
||||
if (Args.hasArg(OPT_objcmt_migrate_readonly_property))
|
||||
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ReadonlyProperty;
|
||||
if (Args.hasArg(OPT_objcmt_migrate_readwrite_property))
|
||||
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ReadwriteProperty;
|
||||
if (Args.hasArg(OPT_objcmt_migrate_all))
|
||||
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_MigrateDecls;
|
||||
|
||||
if (Opts.ARCMTAction != FrontendOptions::ARCMT_None &&
|
||||
Opts.ObjCMTAction != FrontendOptions::ObjCMT_None) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fblocks -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -mt-migrate-directory %t %s -x objective-c -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fblocks -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -mt-migrate-directory %t %s -x objective-c -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -objcmt-migrate-readonly-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -objcmt-migrate-readonly-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
|
||||
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
|
||||
|
||||
|
|
Loading…
Reference in New Issue