aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-02-09 07:13:16 +0000
committerTed Kremenek <kremenek@apple.com>2013-02-09 07:13:16 +0000
commita4475a6b8277f24ed15d7b67d9dab77444c77cb1 (patch)
tree301be00ed0594dc98bde79f416c7e69dbf1784c9
parent992c59247497ba38e904142f9ac3028c3e1874af (diff)
QoI: -Wreadonly-iboutlet-property should have the warning's location on the property.
There's no need to refer to the @implementation at all. Fixes <rdar://problem/13186515> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174802 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td4
-rw-r--r--lib/Sema/SemaObjCProperty.cpp4
-rw-r--r--test/SemaObjC/iboutlet.m14
3 files changed, 10 insertions, 12 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index e190d7b5a6..615b598e77 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -790,9 +790,9 @@ def warn_undeclared_selector : Warning<
def warn_implicit_atomic_property : Warning<
"property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
def note_auto_readonly_iboutlet_fixup_suggest : Note<
- "readonly IBOutlet property should be changed to be readwrite">;
+ "property should be changed to be readwrite">;
def warn_auto_readonly_iboutlet_property : Warning<
- "readonly IBOutlet property when auto-synthesized may "
+ "readonly IBOutlet property '%0' when auto-synthesized may "
"not work correctly with 'nib' loader">,
InGroup<DiagGroup<"readonly-iboutlet-property">>;
def warn_auto_implicit_atomic_property : Warning<
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index da7b4729b1..298bad8efb 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -861,8 +861,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
}
if (!ReadWriteProperty) {
- Diag(IC->getLocation(), diag::warn_auto_readonly_iboutlet_property);
- Diag(property->getLocation(), diag::note_property_declare);
+ Diag(property->getLocation(), diag::warn_auto_readonly_iboutlet_property)
+ << property->getName();
SourceLocation readonlyLoc;
if (LocPropertyAttribute(Context, "readonly",
property->getLParenLoc(), readonlyLoc)) {
diff --git a/test/SemaObjC/iboutlet.m b/test/SemaObjC/iboutlet.m
index 9363749702..01e1bfc13b 100644
--- a/test/SemaObjC/iboutlet.m
+++ b/test/SemaObjC/iboutlet.m
@@ -9,17 +9,15 @@
#define IBOutlet __attribute__((iboutlet))
@interface I
-@property (getter = MyGetter, readonly, assign) IBOutlet NSView *myView; // expected-note {{property declared here}} \
- // expected-note {{readonly IBOutlet property should be changed to be readwrite}}
+@property (getter = MyGetter, readonly, assign) IBOutlet NSView *myView; // expected-warning {{readonly IBOutlet property 'myView' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}}
-@property (readonly) IBOutlet NSView *myView1; // expected-note {{readonly IBOutlet property should be changed to be readwrite}} \
- // expected-note {{property declared here}}
+@property (readonly) IBOutlet NSView *myView1; // expected-warning {{readonly IBOutlet property 'myView1' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}}
-@property (getter = MyGetter, READONLY) IBOutlet NSView *myView2; // expected-note {{property declared here}}
+@property (getter = MyGetter, READONLY) IBOutlet NSView *myView2; // expected-warning {{readonly IBOutlet property 'myView2' when auto-synthesized may not work correctly with 'nib' loader}}
@end
-@implementation I // expected-warning 3 {{readonly IBOutlet property when auto-synthesized may not work correctly with 'nib' loader}}
+@implementation I
@end
@@ -29,7 +27,7 @@
@interface NSObject @end
@interface RKTFHView : NSObject
-@property( readonly ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadOnly; // expected-note {{property declared here}} expected-note {{readonly IBOutlet property should be changed to be readwrite}}
+@property( readonly ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadOnly; // expected-warning {{readonly IBOutlet property 'autoReadOnlyReadOnly' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}}
@property( readonly ) __attribute__((iboutlet)) UILabel *autoReadOnlyReadWrite;
@property( readonly ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite;
@end
@@ -39,6 +37,6 @@
@property( readwrite ) __attribute__((iboutlet)) UILabel *synthReadOnlyReadWrite;
@end
-@implementation RKTFHView // expected-warning {{readonly IBOutlet property when auto-synthesized may not work correctly with 'nib' loader}}
+@implementation RKTFHView
@synthesize synthReadOnlyReadWrite=_synthReadOnlyReadWrite;
@end