ObjectiveC ARC. Removes a bogus warning when a weak

property is redeclared as 'weak' in class extension.
// rdar://15465916

llvm-svn: 195146
This commit is contained in:
Fariborz Jahanian 2013-11-19 19:26:30 +00:00
parent 90946ca5b5
commit 3b65982b9f
2 changed files with 8 additions and 1 deletions

View File

@ -463,10 +463,12 @@ Sema::HandlePropertyInClassExtension(Scope *S,
QualType PrimaryPropertyQT =
Context.getCanonicalType(PIDecl->getType()).getUnqualifiedType();
if (isa<ObjCObjectPointerType>(PrimaryPropertyQT)) {
bool PropertyIsWeak = ((PIkind & ObjCPropertyDecl::OBJC_PR_weak) != 0);
Qualifiers::ObjCLifetime PrimaryPropertyLifeTime =
PrimaryPropertyQT.getObjCLifetime();
if (PrimaryPropertyLifeTime == Qualifiers::OCL_None &&
(Attributes & ObjCDeclSpec::DQ_PR_weak)) {
(Attributes & ObjCDeclSpec::DQ_PR_weak) &&
!PropertyIsWeak) {
Diag(AtLoc, diag::warn_property_implicitly_mismatched);
Diag(PIDecl->getLocation(), diag::note_property_declare);
}

View File

@ -113,8 +113,13 @@ struct __attribute__((objc_ownership(none))) S2 {}; // expected-error {{'objc_ow
@interface SomeClassOwnedByController
@property (readonly) ControllerClass *controller; // expected-note {{property declared here}}
// rdar://15465916
@property (readonly, weak) ControllerClass *weak_controller;
@end
@interface SomeClassOwnedByController ()
@property (readwrite, weak) ControllerClass *controller; // expected-warning {{primary property declaration is implicitly strong while redeclaration in class extension is weak}}
@property (readwrite, weak) ControllerClass *weak_controller;
@end