[cfe-commits] r138659 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaObjCProperty.cpp test/SemaObjC/arc-property-lifetime.m

Fariborz Jahanian fjahanian at apple.com
Fri Aug 26 14:21:19 PDT 2011


Author: fjahanian
Date: Fri Aug 26 16:21:19 2011
New Revision: 138659

URL: http://llvm.org/viewvc/llvm-project?rev=138659&view=rev
Log:
objc-arc: Mention property's attribute by name when
finding life-time conflict with its declared ivar.
// rdar://10007230

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
    cfe/trunk/test/SemaObjC/arc-property-lifetime.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=138659&r1=138658&r2=138659&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Aug 26 16:21:19 2011
@@ -2851,7 +2851,8 @@
   "existing ivar %1 for strong property %0 may not be "
   "%select{|__unsafe_unretained||__weak}2">;
 def err_arc_assign_property_ownership : Error<
-  "existing ivar %1 for unsafe_unretained property %0 must be __unsafe_unretained">;
+  "existing ivar %1 for property %0 with %select{unsafe_unretained| assign}2 "
+  "attribute must be __unsafe_unretained">;
 def err_arc_inconsistent_property_ownership : Error<
   "%select{strong|weak|unsafe_unretained}1 property %0 may not also be "
   "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=138659&r1=138658&r2=138659&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Aug 26 16:21:19 2011
@@ -487,7 +487,9 @@
     case Qualifiers::OCL_Strong:
       S.Diag(propertyImplLoc, diag::err_arc_assign_property_ownership)
         << property->getDeclName()
-        << ivar->getDeclName();
+        << ivar->getDeclName()
+        << ((property->getPropertyAttributesAsWritten() 
+            & ObjCPropertyDecl::OBJC_PR_assign) != 0);
       break;
     }
 

Modified: cfe/trunk/test/SemaObjC/arc-property-lifetime.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-property-lifetime.m?rev=138659&r1=138658&r2=138659&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-property-lifetime.m (original)
+++ cfe/trunk/test/SemaObjC/arc-property-lifetime.m Fri Aug 26 16:21:19 2011
@@ -79,7 +79,7 @@
 
 @implementation Gorf
 @synthesize x;
- at synthesize y; // expected-error {{existing ivar 'y' for unsafe_unretained property 'y' must be __unsafe_unretained}}
+ at synthesize y; // expected-error {{existing ivar 'y' for property 'y' with  assign attribute must be __unsafe_unretained}}
 @synthesize z;
 @end
 
@@ -94,7 +94,7 @@
 
 @implementation Gorf2
 @synthesize x;
- at synthesize y; // expected-error {{existing ivar 'y' for unsafe_unretained property 'y' must be __unsafe_unretained}}
+ at synthesize y; // expected-error {{existing ivar 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}}
 @synthesize z;
 @end
 





More information about the cfe-commits mailing list