r194100 - ObjectiveC migrator. Please annotation of properties with
Fariborz Jahanian
fjahanian at apple.com
Tue Nov 5 14:28:30 PST 2013
Author: fjahanian
Date: Tue Nov 5 16:28:30 2013
New Revision: 194100
URL: http://llvm.org/viewvc/llvm-project?rev=194100&view=rev
Log:
ObjectiveC migrator. Please annotation of properties with
NS_RETURNS_INNER_POINTER under -objcmt-returns-innerpointer-property
flag (off by default), as older compilers do not support such annotations.
// rdar://15396636
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m
cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=194100&r1=194099&r2=194100&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Nov 5 16:28:30 2013
@@ -181,6 +181,9 @@ def objcmt_migrate_protocol_conformance
def objcmt_atomic_property : Flag<["-"], "objcmt-atomic-property">,
Flags<[CC1Option]>,
HelpText<"Make migration to 'atomic' properties">;
+def objcmt_returns_innerpointer_property : Flag<["-"], "objcmt-returns-innerpointer-property">, Flags<[CC1Option]>,
+ HelpText<"Enable migration to annotate property with NS_RETURNS_INNER_POINTER">;
+
// Make sure all other -ccc- options are rejected.
def ccc_ : Joined<["-"], "ccc-">, Group<internal_Group>, Flags<[Unsupported]>;
Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=194100&r1=194099&r2=194100&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Tue Nov 5 16:28:30 2013
@@ -175,13 +175,16 @@ public:
ObjCMT_ProtocolConformance = 0x80,
/// \brief prefer 'atomic' property over 'nonatomic'.
ObjCMT_AtomicProperty = 0x100,
+ /// \brief annotate property with NS_RETURNS_INNER_POINTER
+ ObjCMT_ReturnsInnerPointerProperty = 0x200,
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)
+ ObjCMT_NsMacros | ObjCMT_ProtocolConformance |
+ ObjCMT_ReturnsInnerPointerProperty)
};
unsigned ObjCMTAction;
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=194100&r1=194099&r2=194100&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Nov 5 16:28:30 2013
@@ -416,6 +416,9 @@ void ObjCMigrateASTConsumer::migrateObjC
if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
migrateNsReturnsInnerPointer(Ctx, Method);
}
+ if (!(ASTMigrateActions & FrontendOptions::ObjCMT_ReturnsInnerPointerProperty))
+ return;
+
for (ObjCContainerDecl::prop_iterator P = D->prop_begin(),
E = D->prop_end(); P != E; ++P) {
ObjCPropertyDecl *Prop = *P;
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=194100&r1=194099&r2=194100&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Nov 5 16:28:30 2013
@@ -805,6 +805,8 @@ static InputKind ParseFrontendArgs(Front
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ReadwriteProperty;
if (Args.hasArg(OPT_objcmt_migrate_annotation))
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Annotation;
+ if (Args.hasArg(OPT_objcmt_returns_innerpointer_property))
+ Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ReturnsInnerPointerProperty;
if (Args.hasArg(OPT_objcmt_migrate_instancetype))
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Instancetype;
if (Args.hasArg(OPT_objcmt_migrate_nsmacros))
Modified: cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m?rev=194100&r1=194099&r2=194100&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m Tue Nov 5 16:28:30 2013
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -objcmt-migrate-annotation -objcmt-migrate-readwrite-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
+// RUN: %clang_cc1 -objcmt-returns-innerpointer-property -objcmt-migrate-annotation -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
Modified: cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result?rev=194100&r1=194099&r2=194100&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-returns-inner-pointer.m.result Tue Nov 5 16:28:30 2013
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -objcmt-migrate-annotation -objcmt-migrate-readwrite-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
+// RUN: %clang_cc1 -objcmt-returns-innerpointer-property -objcmt-migrate-annotation -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
More information about the cfe-commits
mailing list