[cfe-commits] r124620 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaObjCProperty.cpp test/SemaObjC/custom-atomic-property.m
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Jan 31 15:20:04 PST 2011
Author: akirtzidis
Date: Mon Jan 31 17:20:03 2011
New Revision: 124620
URL: http://llvm.org/viewvc/llvm-project?rev=124620&view=rev
Log:
Improve the diagnostic for -Wcustom-atomic-properties. Suggestion by Fariborz!
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/custom-atomic-property.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=124620&r1=124619&r2=124620&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jan 31 17:20:03 2011
@@ -387,7 +387,7 @@
"writable atomic property %0 cannot pair a synthesized setter/getter "
"with a user defined setter/getter">;
def warn_default_atomic_custom_getter_setter : Warning<
- "atomic by default property %0 has a user defined setter/getter "
+ "atomic by default property %0 has a user defined %select{getter|setter}1 "
"(property should be marked 'atomic' if this is intended)">,
InGroup<CustomAtomic>, DefaultIgnore;
def err_use_continuation_class : Error<
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=124620&r1=124619&r2=124620&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Jan 31 17:20:03 2011
@@ -1096,13 +1096,13 @@
if (GetterMethod) {
Diag(GetterMethod->getLocation(),
diag::warn_default_atomic_custom_getter_setter)
- << Property->getIdentifier();
+ << Property->getIdentifier() << 0;
Diag(Property->getLocation(), diag::note_property_declare);
}
if (SetterMethod) {
Diag(SetterMethod->getLocation(),
diag::warn_default_atomic_custom_getter_setter)
- << Property->getIdentifier();
+ << Property->getIdentifier() << 1;
Diag(Property->getLocation(), diag::note_property_declare);
}
}
Modified: cfe/trunk/test/SemaObjC/custom-atomic-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/custom-atomic-property.m?rev=124620&r1=124619&r2=124620&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/custom-atomic-property.m (original)
+++ cfe/trunk/test/SemaObjC/custom-atomic-property.m Mon Jan 31 17:20:03 2011
@@ -5,6 +5,16 @@
@end
@implementation Foo
- -(Foo*)myProp {return 0;} // expected-warning {{atomic by default property 'myProp' has a user defined setter/getter (property should be marked 'atomic' if this is intended)}}
- -(void)setMyProp:(Foo*)e {} // expected-warning {{atomic by default property 'myProp' has a user defined setter/getter (property should be marked 'atomic' if this is intended)}}
+ -(Foo*)myProp {return 0;} // expected-warning {{atomic by default property 'myProp' has a user defined getter (property should be marked 'atomic' if this is intended)}}
+ -(void)setMyProp:(Foo*)e {} // expected-warning {{atomic by default property 'myProp' has a user defined setter (property should be marked 'atomic' if this is intended)}}
+ at end
+
+ at interface Foo2 {
+ Foo *myProp;
+}
+ at property (assign) Foo *myProp;
+ at end
+
+ at implementation Foo2
+ at synthesize myProp; // no warnings.
@end
More information about the cfe-commits
mailing list