| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.NoUnretainedMemberChecker -fobjc-runtime-has-weak -fobjc-weak -verify %s |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
#include "objc-mock-types.h" |
| 5 |
|
| 6 |
struct Foo { |
| 7 |
__weak NSString *weakPtr = nullptr; |
| 8 |
Foo(); |
| 9 |
~Foo(); |
| 10 |
void bar(); |
| 11 |
}; |
| 12 |
|
| 13 |
@interface ObjectWithWeakProperty : NSObject |
| 14 |
@property(nonatomic, weak) NSString *weak_prop; |
| 15 |
@end |
| 16 |
|
| 17 |
@implementation ObjectWithWeakProperty |
| 18 |
@end |
| 19 |
|
| 20 |
NS_REQUIRES_PROPERTY_DEFINITIONS |
| 21 |
@interface NoSynthesisObjectWithWeakProperty : NSObject |
| 22 |
@property(nonatomic, readonly, weak) NSString *weak_prop; |
| 23 |
@end |
| 24 |
|
| 25 |
@implementation NoSynthesisObjectWithWeakProperty { |
| 26 |
__weak NSNumber *weak_ivar; |
| 27 |
} |
| 28 |
- (NSString *)weak_prop { |
| 29 |
return nil; |
| 30 |
} |
| 31 |
@end |