r195146 - ObjectiveC ARC. Removes a bogus warning when a weak

Fariborz Jahanian fjahanian at apple.com
Tue Nov 19 11:26:30 PST 2013


Author: fjahanian
Date: Tue Nov 19 13:26:30 2013
New Revision: 195146

URL: http://llvm.org/viewvc/llvm-project?rev=195146&view=rev
Log:
ObjectiveC ARC. Removes a bogus warning when a weak 
property is redeclared as 'weak' in class extension.
// rdar://15465916

Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
    cfe/trunk/test/SemaObjC/arc-decls.m

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=195146&r1=195145&r2=195146&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue Nov 19 13:26:30 2013
@@ -463,10 +463,12 @@ Sema::HandlePropertyInClassExtension(Sco
       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);
             }

Modified: cfe/trunk/test/SemaObjC/arc-decls.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-decls.m?rev=195146&r1=195145&r2=195146&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-decls.m (original)
+++ cfe/trunk/test/SemaObjC/arc-decls.m Tue Nov 19 13:26:30 2013
@@ -113,8 +113,13 @@ struct __attribute__((objc_ownership(non
 
 @interface SomeClassOwnedByController
 @property (readonly) ControllerClass *controller; // expected-note {{property declared here}}
+
+// rdar://15465916
+ at 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}}
+
+ at property (readwrite, weak) ControllerClass *weak_controller;
 @end





More information about the cfe-commits mailing list