]> granicus.if.org Git - clang/commitdiff
Enhance "auto synthesis will not synthesize property in protocol" to include property...
authorTed Kremenek <kremenek@apple.com>
Thu, 12 Dec 2013 23:40:14 +0000 (23:40 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 12 Dec 2013 23:40:14 +0000 (23:40 +0000)
Implements <rdar://problem/15617839>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197187 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/default-synthesize-3.m
test/SemaObjC/default-synthesize.m
test/SemaObjC/forward-protocol-incomplete-impl-warn.m

index 741d4c6e2763308d5a51a83fdb214ec540db36f2..b0deed75ec53d7013b6e234e4659a944f439f3a7 100644 (file)
@@ -701,8 +701,8 @@ def warn_owning_getter_rule : Warning<
   " convention for returning 'owned' objects">,
   InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
 def warn_auto_synthesizing_protocol_property :Warning<
-  "auto property synthesis will not synthesize property"
-  " declared in a protocol">,
+  "auto property synthesis will not synthesize property %0"
+  " declared in protocol %1">,
   InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
 def warn_no_autosynthesis_shared_ivar_property : Warning <
   "auto property synthesis will not synthesize property "
index f70e84d7a061c0efc9e7a2f800eede2235361c46..78e774b39ffc041bda19a902776248bb9fae7102 100644 (file)
@@ -1574,10 +1574,12 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
       }
       continue;
     }
-    if (isa<ObjCProtocolDecl>(Prop->getDeclContext())) {
+    if (ObjCProtocolDecl *Proto =
+          dyn_cast<ObjCProtocolDecl>(Prop->getDeclContext())) {
       // We won't auto-synthesize properties declared in protocols.
       Diag(IMPDecl->getLocation(), 
-           diag::warn_auto_synthesizing_protocol_property);
+           diag::warn_auto_synthesizing_protocol_property)
+        << Prop << Proto;
       Diag(Prop->getLocation(), diag::note_property_declare);
       continue;
     }
index 0275806dd0e5a6c1c820f79bd2f00282d9c963b7..e409d216928f2634f3abfc56db83a2d7594a739d 100644 (file)
@@ -172,12 +172,12 @@ typedef NSObject<Fooing> FooObject;
 @interface Okay : NSObject<Fooing>
 @end
 
-@implementation Okay // expected-warning 2 {{auto property synthesis will not synthesize property declared in a protocol}}
+@implementation Okay // expected-warning {{auto property synthesis will not synthesize property 'muahahaha' declared in protocol 'Fooing'}} expected-warning {{auto property synthesis will not synthesize property 'hoho' declared in protocol 'SubFooling'}}
 @end
 
 @interface Fail : FooObject
 @end
 
-@implementation Fail // expected-warning 2 {{auto property synthesis will not synthesize property declared in a protocol}}
+@implementation Fail // expected-warning {{auto property synthesis will not synthesize property 'muahahaha' declared in protocol 'Fooing'}} expected-warning {{auto property synthesis will not synthesize property 'hoho' declared in protocol 'SubFooling'}}
 @end
 
index dd16c1361d89902ac0e9366deecf0c657b95817f..9356b9f5b3a3f1d9d998845e00e8cad9c83ba061 100644 (file)
 @interface MyClass <MyProtocol> 
 @end
  
-@implementation MyClass // expected-warning {{auto property synthesis will not synthesize property declared in a protocol}}
+@implementation MyClass // expected-warning {{auto property synthesis will not synthesize property 'requiredString' declared in protocol 'MyProtocol'}}
 @end
index c3efeba4f9ecb07edc9bf436d807bc002a2de302..654ef59f3d825260a1cefb784c32ee268b65b173 100644 (file)
@@ -15,6 +15,6 @@
 @interface IBImageCatalogDocument : NSObject <DVTInvalidation> // expected-note {{required for direct or indirect protocol 'DVTInvalidation'}}
 @end
 
-@implementation IBImageCatalogDocument // expected-warning {{auto property synthesis will not synthesize property declared in a protocol}} \ 
+@implementation IBImageCatalogDocument // expected-warning {{auto property synthesis will not synthesize property 'Prop' declared in protocol 'DVTInvalidation'}} \ 
                                       // expected-warning {{method 'invalidate' in protocol not implemented}}
 @end