diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
commit | b35a2aa71f76a334a9c98c0a3c3995b5d902d2b9 (patch) | |
tree | cdff4a5d1a715d4ad622fd8f190128b54bebe440 /test/Analysis/properties.m | |
parent | 3748d41833787fcbf59cc5624e8d2b042a8991bc (diff) | |
parent | 741e05796da92b46d4f7bcbee00702ff37df6489 (diff) |
Creating branches/google/stable and tags/google/stable/2019-05-14 from r360103upstream/google/stable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/stable@360714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/properties.m')
-rw-r--r-- | test/Analysis/properties.m | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Analysis/properties.m b/test/Analysis/properties.m index 461639f4c2..17b156035a 100644 --- a/test/Analysis/properties.m +++ b/test/Analysis/properties.m @@ -1005,3 +1005,38 @@ void testNoCrashWhenAccessPropertyAndThereAreNoDirectBindingsAtAll() { #endif // non-ARC +@interface ExplicitAccessorInCategory : NSObject +@property(readonly) int normal; +- (int)normal; +@property(readonly) int no_custom_accessor; +@end + +@interface ExplicitAccessorInCategory () +@property(readonly) int in_category; + +@property(readonly) int still_no_custom_accessor; +// This is an ordinary method, not a getter. +- (int)still_no_custom_accessor; +@end + +@interface ExplicitAccessorInCategory () +- (int)in_category; + +// This is an ordinary method, not a getter. +- (int)no_custom_accessor; +@end + +@implementation ExplicitAccessorInCategory +- (void)foo { + // Make sure we don't farm bodies for explicit accessors: in particular, + // we're not sure that the accessor always returns the same value. + clang_analyzer_eval(self.normal == self.normal); // expected-warning{{UNKNOWN}} + // Also this used to crash. + clang_analyzer_eval(self.in_category == self.in_category); // expected-warning{{UNKNOWN}} + + // When there is no explicit accessor defined (even if it looks like there is), + // farm the getter body and see if it does actually always yield the same value. + clang_analyzer_eval(self.no_custom_accessor == self.no_custom_accessor); // expected-warning{{TRUE}} + clang_analyzer_eval(self.still_no_custom_accessor == self.still_no_custom_accessor); // expected-warning{{TRUE}} +} +@end |