QoI: -Wreadonly-iboutlet-property should have the warning's location on the property.
authorTed Kremenek <kremenek@apple.com>
Sat, 9 Feb 2013 07:13:16 +0000 (07:13 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 9 Feb 2013 07:13:16 +0000 (07:13 +0000)
There's no need to refer to the @implementation at all.

Fixes <rdar://problem/13186515>

llvm-svn: 174802

clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaObjCProperty.cpp
clang/test/SemaObjC/iboutlet.m

index e190d7b5a621b0473db17ad85dfabe6ee1205759..615b598e77e3be75983d3b1c6fc63a21a4f7e79c 100644 (file)
@@ -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<
index da7b4729b11b49ac0cc7568c7a458d0b260e6d1b..298bad8efbb7a8859eb02a34993bc9b32ddb1945 100644 (file)
@@ -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)) {
index 93637497028a44261de0d61fd9f0065baada504c..01e1bfc13bea1ba0c29108848dcf595231c3a44e 100644 (file)
@@ -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