summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-11-19 19:26:30 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-11-19 19:26:30 +0000
commit3b65982b9fe09329bd64518a390052f3ca3b0a08 (patch)
tree68f80f6e9f46eb1fa150d3f0a574a81d803b1cf6
parent90946ca5b59af385e02cb9205ca9d135622cb354 (diff)
downloadbcm5719-llvm-3b65982b9fe09329bd64518a390052f3ca3b0a08.tar.gz
bcm5719-llvm-3b65982b9fe09329bd64518a390052f3ca3b0a08.zip
ObjectiveC ARC. Removes a bogus warning when a weak
property is redeclared as 'weak' in class extension. // rdar://15465916 llvm-svn: 195146
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp4
-rw-r--r--clang/test/SemaObjC/arc-decls.m5
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 9d18c659c27..d9d9cec1b70 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -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);
}
diff --git a/clang/test/SemaObjC/arc-decls.m b/clang/test/SemaObjC/arc-decls.m
index f8e80c78194..903cea2a0e8 100644
--- a/clang/test/SemaObjC/arc-decls.m
+++ b/clang/test/SemaObjC/arc-decls.m
@@ -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
OpenPOWER on IntegriCloud