r197187 - Enhance "auto synthesis will not synthesize property in protocol" to include property and protocol name.

Ted Kremenek kremenek at apple.com
Thu Dec 12 15:40:15 PST 2013


Author: kremenek
Date: Thu Dec 12 17:40:14 2013
New Revision: 197187

URL: http://llvm.org/viewvc/llvm-project?rev=197187&view=rev
Log:
Enhance "auto synthesis will not synthesize property in protocol" to include property and protocol name.

Implements <rdar://problem/15617839>.

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

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=197187&r1=197186&r2=197187&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 12 17:40:14 2013
@@ -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 "

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=197187&r1=197186&r2=197187&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Thu Dec 12 17:40:14 2013
@@ -1574,10 +1574,12 @@ void Sema::DefaultSynthesizeProperties(S
       }
       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;
     }

Modified: cfe/trunk/test/SemaObjC/default-synthesize-3.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize-3.m?rev=197187&r1=197186&r2=197187&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize-3.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize-3.m Thu Dec 12 17:40:14 2013
@@ -172,12 +172,12 @@ typedef NSObject<Fooing> FooObject;
 @interface Okay : NSObject<Fooing>
 @end
 
- at implementation Okay // expected-warning 2 {{auto property synthesis will not synthesize property declared in a protocol}}
+ at 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
 
- at implementation Fail // expected-warning 2 {{auto property synthesis will not synthesize property declared in a protocol}}
+ at 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
 

Modified: cfe/trunk/test/SemaObjC/default-synthesize.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize.m?rev=197187&r1=197186&r2=197187&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize.m Thu Dec 12 17:40:14 2013
@@ -136,5 +136,5 @@
 @interface MyClass <MyProtocol> 
 @end
  
- at implementation MyClass // expected-warning {{auto property synthesis will not synthesize property declared in a protocol}}
+ at implementation MyClass // expected-warning {{auto property synthesis will not synthesize property 'requiredString' declared in protocol 'MyProtocol'}}
 @end

Modified: cfe/trunk/test/SemaObjC/forward-protocol-incomplete-impl-warn.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/forward-protocol-incomplete-impl-warn.m?rev=197187&r1=197186&r2=197187&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/forward-protocol-incomplete-impl-warn.m (original)
+++ cfe/trunk/test/SemaObjC/forward-protocol-incomplete-impl-warn.m Thu Dec 12 17:40:14 2013
@@ -15,6 +15,6 @@
 @interface IBImageCatalogDocument : NSObject <DVTInvalidation> // expected-note {{required for direct or indirect protocol 'DVTInvalidation'}}
 @end
 
- at implementation IBImageCatalogDocument // expected-warning {{auto property synthesis will not synthesize property declared in a protocol}} \ 
+ at 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





More information about the cfe-commits mailing list