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">;
+def objcmt_ns_nonatomic_iosonly: Flag<["-"], "objcmt-ns-nonatomic-iosonly">, Flags<[CC1Option]>,
+ HelpText<"Enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's 'atomic' attribute">;
// Make sure all other -ccc- options are rejected.
def ccc_ : Joined<["-"], "ccc-">, Group<internal_Group>, Flags<[Unsupported]>;
ObjCMT_AtomicProperty = 0x100,
/// \brief annotate property with NS_RETURNS_INNER_POINTER
ObjCMT_ReturnsInnerPointerProperty = 0x200,
+ /// \brief use NS_NONATOMIC_IOSONLY for property 'atomic' attribute
+ ObjCMT_NsAtomicIOSOnlyProperty = 0x400,
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_NsAtomicIOSOnlyProperty),
+ ObjCMT_MigrateAll = (ObjCMT_Literals | ObjCMT_Subscripting | ObjCMT_MigrateDecls)
};
unsigned ObjCMTAction;
const ObjCMethodDecl *Setter,
const NSAPI &NS, edit::Commit &commit,
unsigned LengthOfPrefix,
- bool Atomic, bool AvailabilityArgsMatch) {
+ bool Atomic, bool UseNsIosOnlyMacro,
+ bool AvailabilityArgsMatch) {
ASTContext &Context = NS.getASTContext();
bool LParenAdded = false;
std::string PropertyString = "@property ";
- if (Context.Idents.get("NS_NONATOMIC_IOSONLY").hasMacroDefinition()) {
+ if (UseNsIosOnlyMacro && Context.Idents.get("NS_NONATOMIC_IOSONLY").hasMacroDefinition()) {
PropertyString += "(NS_NONATOMIC_IOSONLY";
LParenAdded = true;
} else if (!Atomic) {
LengthOfPrefix,
(ASTMigrateActions &
FrontendOptions::ObjCMT_AtomicProperty) != 0,
+ (ASTMigrateActions &
+ FrontendOptions::ObjCMT_NsAtomicIOSOnlyProperty) != 0,
AvailabilityArgsMatch);
Editor->commit(commit);
return true;
LengthOfPrefix,
(ASTMigrateActions &
FrontendOptions::ObjCMT_AtomicProperty) != 0,
+ (ASTMigrateActions &
+ FrontendOptions::ObjCMT_NsAtomicIOSOnlyProperty) != 0,
/*AvailabilityArgsMatch*/false);
Editor->commit(commit);
return true;
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ProtocolConformance;
if (Args.hasArg(OPT_objcmt_atomic_property))
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_AtomicProperty;
+ if (Args.hasArg(OPT_objcmt_ns_nonatomic_iosonly))
+ Opts.ObjCMTAction |= FrontendOptions::ObjCMT_NsAtomicIOSOnlyProperty;
if (Args.hasArg(OPT_objcmt_migrate_all))
Opts.ObjCMTAction |= FrontendOptions::ObjCMT_MigrateDecls;
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -objcmt-atomic-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
+// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -objcmt-ns-nonatomic-iosonly -objcmt-migrate-readonly-property -objcmt-atomic-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 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -objcmt-atomic-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
+// RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -objcmt-ns-nonatomic-iosonly -objcmt-migrate-readonly-property -objcmt-atomic-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 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result