2015-11-13 07:39:39 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -verify -Weverything %s
|
|
|
|
// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -fsyntax-only -verify -Weverything %s
|
2012-08-22 05:45:58 +08:00
|
|
|
// rdar://12103400
|
|
|
|
|
|
|
|
@class NSString;
|
|
|
|
|
|
|
|
@interface MyClass
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) NSString* addingMemoryModel;
|
|
|
|
|
2013-12-14 02:19:59 +08:00
|
|
|
@property (nonatomic, copy, readonly) NSString* matchingMemoryModel;
|
2012-08-22 05:45:58 +08:00
|
|
|
|
Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.
A 'readonly' Objective-C property declared in the primary class can
effectively be shadowed by a 'readwrite' property declared within an
extension of that class, so long as the types and attributes of the
two property declarations are compatible.
Previously, this functionality was implemented by back-patching the
original 'readonly' property to make it 'readwrite', destroying source
information and causing some hideously redundant, incorrect
code. Simplify the implementation to express how this should actually
be modeled: as a separate property declaration in the extension that
shadows (via the name lookup rules) the declaration in the primary
class. While here, correct some broken Fix-Its, eliminate a pile of
redundant code, clean up the ARC migrator's handling of properties
declared in extensions, and fix debug info's naming of methods that
come from categories.
A wonderous side effect of doing this write is that it eliminates the
"AddedObjCPropertyInClassExtension" method from the AST mutation
listener, which in turn eliminates the last place where we rewrite
entire declarations in a chained PCH file or a module file. This
change (which fixes rdar://problem/18475765) will allow us to
eliminate the rewritten-decls logic from the serialization library,
and fixes a crash (rdar://problem/23247794) illustrated by the
test/PCH/chain-categories.m example.
llvm-svn: 251874
2015-11-03 09:15:46 +08:00
|
|
|
@property (atomic, retain, readonly) NSString* addingNoNewMemoryModel;
|
2012-08-22 05:45:58 +08:00
|
|
|
|
|
|
|
@property (readonly) NSString* none;
|
|
|
|
@property (readonly) NSString* none1;
|
|
|
|
|
2013-12-14 02:19:59 +08:00
|
|
|
@property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}}
|
2012-08-22 05:45:58 +08:00
|
|
|
|
|
|
|
@property (readonly) __weak id weak_prop;
|
|
|
|
@property (readonly) __weak id weak_prop1;
|
|
|
|
|
2013-12-14 02:19:59 +08:00
|
|
|
@property (assign, readonly) NSString* assignProperty;
|
2012-08-22 05:45:58 +08:00
|
|
|
|
|
|
|
@property (readonly) NSString* readonlyProp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface MyClass ()
|
|
|
|
{
|
|
|
|
NSString* _name;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property (nonatomic, copy) NSString* addingMemoryModel;
|
|
|
|
@property (nonatomic, copy) NSString* matchingMemoryModel;
|
2012-09-18 07:57:35 +08:00
|
|
|
@property () NSString* addingNoNewMemoryModel;
|
|
|
|
@property () NSString* none;
|
2012-09-18 04:57:19 +08:00
|
|
|
@property (readwrite, retain) NSString* none1;
|
2012-08-22 05:45:58 +08:00
|
|
|
|
|
|
|
@property (retain) NSString* changeMemoryModel; // expected-warning {{property attribute in class extension does not match the primary class}}
|
2012-09-18 07:57:35 +08:00
|
|
|
@property () __weak id weak_prop;
|
|
|
|
@property (readwrite) __weak id weak_prop1;
|
2012-08-22 05:45:58 +08:00
|
|
|
|
2012-09-18 04:57:19 +08:00
|
|
|
@property (assign, readwrite) NSString* assignProperty;
|
2012-08-22 05:45:58 +08:00
|
|
|
@property (assign) NSString* readonlyProp;
|
|
|
|
@end
|
|
|
|
|
2012-09-18 04:57:19 +08:00
|
|
|
// rdar://12214070
|
|
|
|
@interface radar12214070
|
|
|
|
@property (nonatomic, atomic, readonly) float propertyName; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
|
Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.
A 'readonly' Objective-C property declared in the primary class can
effectively be shadowed by a 'readwrite' property declared within an
extension of that class, so long as the types and attributes of the
two property declarations are compatible.
Previously, this functionality was implemented by back-patching the
original 'readonly' property to make it 'readwrite', destroying source
information and causing some hideously redundant, incorrect
code. Simplify the implementation to express how this should actually
be modeled: as a separate property declaration in the extension that
shadows (via the name lookup rules) the declaration in the primary
class. While here, correct some broken Fix-Its, eliminate a pile of
redundant code, clean up the ARC migrator's handling of properties
declared in extensions, and fix debug info's naming of methods that
come from categories.
A wonderous side effect of doing this write is that it eliminates the
"AddedObjCPropertyInClassExtension" method from the AST mutation
listener, which in turn eliminates the last place where we rewrite
entire declarations in a chained PCH file or a module file. This
change (which fixes rdar://problem/18475765) will allow us to
eliminate the rewritten-decls logic from the serialization library,
and fixes a crash (rdar://problem/23247794) illustrated by the
test/PCH/chain-categories.m example.
llvm-svn: 251874
2015-11-03 09:15:46 +08:00
|
|
|
|
|
|
|
@property (nonatomic, readonly) float propertyName2; // expected-note {{property declared here}}
|
2012-09-18 04:57:19 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface radar12214070 ()
|
|
|
|
@property (atomic, nonatomic, readonly, readwrite) float propertyName; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}} \
|
|
|
|
// expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
|
Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.
A 'readonly' Objective-C property declared in the primary class can
effectively be shadowed by a 'readwrite' property declared within an
extension of that class, so long as the types and attributes of the
two property declarations are compatible.
Previously, this functionality was implemented by back-patching the
original 'readonly' property to make it 'readwrite', destroying source
information and causing some hideously redundant, incorrect
code. Simplify the implementation to express how this should actually
be modeled: as a separate property declaration in the extension that
shadows (via the name lookup rules) the declaration in the primary
class. While here, correct some broken Fix-Its, eliminate a pile of
redundant code, clean up the ARC migrator's handling of properties
declared in extensions, and fix debug info's naming of methods that
come from categories.
A wonderous side effect of doing this write is that it eliminates the
"AddedObjCPropertyInClassExtension" method from the AST mutation
listener, which in turn eliminates the last place where we rewrite
entire declarations in a chained PCH file or a module file. This
change (which fixes rdar://problem/18475765) will allow us to
eliminate the rewritten-decls logic from the serialization library,
and fixes a crash (rdar://problem/23247794) illustrated by the
test/PCH/chain-categories.m example.
llvm-svn: 251874
2015-11-03 09:15:46 +08:00
|
|
|
|
2015-12-10 06:57:32 +08:00
|
|
|
@property (atomic, readwrite) float propertyName2; // expected-warning {{'atomic' attribute on property 'propertyName2' does not match the property inherited from 'radar12214070'}}
|
2012-09-18 04:57:19 +08:00
|
|
|
@end
|
|
|
|
|