diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-26 21:21:19 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-26 21:21:19 +0000 |
commit | 97b6ac54077e3bdc7a30ce7611a8eb2a9c388efd (patch) | |
tree | ed08fe8128acd588fbbfd97991c130b41c784ab3 | |
parent | fee8eda35b3ca2be79bc811602a573de2c565210 (diff) | |
download | bcm5719-llvm-97b6ac54077e3bdc7a30ce7611a8eb2a9c388efd.tar.gz bcm5719-llvm-97b6ac54077e3bdc7a30ce7611a8eb2a9c388efd.zip |
objc-arc: Mention property's attribute by name when
finding life-time conflict with its declared ivar.
// rdar://10007230
llvm-svn: 138659
-rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/arc-property-lifetime.m | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 3d8fbd37c12..2781675f00a 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -2851,7 +2851,8 @@ def err_arc_strong_property_ownership : Error< "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">; diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 46f64561af5..4b9cd66f96e 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -487,7 +487,9 @@ static void checkARCPropertyImpl(Sema &S, SourceLocation propertyImplLoc, 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; } diff --git a/clang/test/SemaObjC/arc-property-lifetime.m b/clang/test/SemaObjC/arc-property-lifetime.m index b1c84c75c05..88321e23933 100644 --- a/clang/test/SemaObjC/arc-property-lifetime.m +++ b/clang/test/SemaObjC/arc-property-lifetime.m @@ -79,7 +79,7 @@ @implementation Gorf @synthesize x; -@synthesize y; // expected-error {{existing ivar 'y' for unsafe_unretained property 'y' must be __unsafe_unretained}} +@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; -@synthesize y; // expected-error {{existing ivar 'y' for unsafe_unretained property 'y' must be __unsafe_unretained}} +@synthesize y; // expected-error {{existing ivar 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}} @synthesize z; @end |