mirror of
https://github.com/intel/llvm.git
synced 2026-01-31 16:29:50 +08:00
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 llvm-svn: 194100
This commit is contained in:
@@ -181,6 +181,9 @@ def objcmt_migrate_protocol_conformance : Flag<["-"], "objcmt-migrate-protocol-c
|
||||
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]>;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -416,6 +416,9 @@ void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx,
|
||||
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;
|
||||
|
||||
@@ -805,6 +805,8 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
||||
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))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user