diff options
| -rw-r--r-- | clang/include/clang/Driver/Options.td | 4 | ||||
| -rw-r--r-- | clang/include/clang/Frontend/FrontendOptions.h | 25 | ||||
| -rw-r--r-- | clang/lib/ARCMigrate/ObjCMT.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 4 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-arc-cf-annotations.m | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-arc-cf-annotations.m.result | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-instancetype-2.m | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-instancetype-2.m.result | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-instancetype.m | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-instancetype.m.result | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-ns-macros.m | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-ns-macros.m.result | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-property.m | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-property.m.result | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-protocol-conformance.m | 2 | ||||
| -rw-r--r-- | clang/test/ARCMT/objcmt-protocol-conformance.m.result | 2 |
18 files changed, 46 insertions, 21 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index a2be903a94e..72f81afb751 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -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]>; diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h index 9092adce208..3b02f8f3ce2 100644 --- a/clang/include/clang/Frontend/FrontendOptions.h +++ b/clang/include/clang/Frontend/FrontendOptions.h @@ -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; diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index 54e5662fae2..a6aa4c74024 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -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, diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 58a6e25d5ca..3386b3fc8dd 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -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) { diff --git a/clang/test/ARCMT/objcmt-arc-cf-annotations.m b/clang/test/ARCMT/objcmt-arc-cf-annotations.m index f0304a6d1a8..029eaaf7794 100644 --- a/clang/test/ARCMT/objcmt-arc-cf-annotations.m +++ b/clang/test/ARCMT/objcmt-arc-cf-annotations.m @@ -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 diff --git a/clang/test/ARCMT/objcmt-arc-cf-annotations.m.result b/clang/test/ARCMT/objcmt-arc-cf-annotations.m.result index 9a744d6f5f1..45f4f8316bc 100644 --- a/clang/test/ARCMT/objcmt-arc-cf-annotations.m.result +++ b/clang/test/ARCMT/objcmt-arc-cf-annotations.m.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 diff --git a/clang/test/ARCMT/objcmt-instancetype-2.m b/clang/test/ARCMT/objcmt-instancetype-2.m index bf91e6223bb..b19160e3dc4 100644 --- a/clang/test/ARCMT/objcmt-instancetype-2.m +++ b/clang/test/ARCMT/objcmt-instancetype-2.m @@ -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 diff --git a/clang/test/ARCMT/objcmt-instancetype-2.m.result b/clang/test/ARCMT/objcmt-instancetype-2.m.result index 460bf0d0476..90a3f5ec9aa 100644 --- a/clang/test/ARCMT/objcmt-instancetype-2.m.result +++ b/clang/test/ARCMT/objcmt-instancetype-2.m.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 diff --git a/clang/test/ARCMT/objcmt-instancetype.m b/clang/test/ARCMT/objcmt-instancetype.m index 80b19af0bb5..d8fc88a88a5 100644 --- a/clang/test/ARCMT/objcmt-instancetype.m +++ b/clang/test/ARCMT/objcmt-instancetype.m @@ -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 diff --git a/clang/test/ARCMT/objcmt-instancetype.m.result b/clang/test/ARCMT/objcmt-instancetype.m.result index 6aedce211bd..9f409139054 100644 --- a/clang/test/ARCMT/objcmt-instancetype.m.result +++ b/clang/test/ARCMT/objcmt-instancetype.m.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 diff --git a/clang/test/ARCMT/objcmt-ns-macros.m b/clang/test/ARCMT/objcmt-ns-macros.m index 4ce33ef7640..14af8cbda17 100644 --- a/clang/test/ARCMT/objcmt-ns-macros.m +++ b/clang/test/ARCMT/objcmt-ns-macros.m @@ -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 diff --git a/clang/test/ARCMT/objcmt-ns-macros.m.result b/clang/test/ARCMT/objcmt-ns-macros.m.result index ed74748beac..2c3fcf8c34e 100644 --- a/clang/test/ARCMT/objcmt-ns-macros.m.result +++ b/clang/test/ARCMT/objcmt-ns-macros.m.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 diff --git a/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m b/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m index 83b5a48d2eb..ce8c2c65a49 100644 --- a/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m +++ b/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m @@ -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 diff --git a/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result b/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result index 57f6a3ae281..95df805ee4f 100644 --- a/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result +++ b/clang/test/ARCMT/objcmt-ns-returns-inner-pointer.m.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 diff --git a/clang/test/ARCMT/objcmt-property.m b/clang/test/ARCMT/objcmt-property.m index 3de23526095..60716c6a98a 100644 --- a/clang/test/ARCMT/objcmt-property.m +++ b/clang/test/ARCMT/objcmt-property.m @@ -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 diff --git a/clang/test/ARCMT/objcmt-property.m.result b/clang/test/ARCMT/objcmt-property.m.result index a27e02ac6e5..7238b7c88a2 100644 --- a/clang/test/ARCMT/objcmt-property.m.result +++ b/clang/test/ARCMT/objcmt-property.m.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 diff --git a/clang/test/ARCMT/objcmt-protocol-conformance.m b/clang/test/ARCMT/objcmt-protocol-conformance.m index f845b0e3e4c..a0a160e917f 100644 --- a/clang/test/ARCMT/objcmt-protocol-conformance.m +++ b/clang/test/ARCMT/objcmt-protocol-conformance.m @@ -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 diff --git a/clang/test/ARCMT/objcmt-protocol-conformance.m.result b/clang/test/ARCMT/objcmt-protocol-conformance.m.result index 6283ac24a0d..d6cd44483cb 100644 --- a/clang/test/ARCMT/objcmt-protocol-conformance.m.result +++ b/clang/test/ARCMT/objcmt-protocol-conformance.m.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 |

