modocache created this revision.
modocache added a reviewer: cfe-commits.

The tests that verify that accessing a property without using the result
emits a warning were needlessly complicated. Remove several layers of
abstraction to make the tests much simpler to read and reason about.

http://reviews.llvm.org/D12047

Files:
  test/SemaObjC/access-property-getter.m

Index: test/SemaObjC/access-property-getter.m
===================================================================
--- test/SemaObjC/access-property-getter.m
+++ test/SemaObjC/access-property-getter.m
@@ -1,53 +1,17 @@
 // RUN: %clang_cc1 -verify %s
 
-@protocol NSObject
-- (oneway void)release;
+@protocol Protocol
+- (oneway void) method;
 @end
 
-@protocol XCOutputStreams <NSObject>
-@end
-
-
-@interface XCWorkQueueCommandInvocation 
-{
-    id <XCOutputStreams> _outputStream;
-}
-@end
-
-@interface XCWorkQueueCommandSubprocessInvocation : 
XCWorkQueueCommandInvocation
-@end
-
-@interface XCWorkQueueCommandLocalSubprocessInvocation : 
XCWorkQueueCommandSubprocessInvocation
-@end
-
-@interface XCWorkQueueCommandDistributedSubprocessInvocation : 
XCWorkQueueCommandSubprocessInvocation
-@end
-
-@interface XCWorkQueueCommandCacheFetchInvocation : 
XCWorkQueueCommandSubprocessInvocation
-
-@end
-
-@implementation XCWorkQueueCommandCacheFetchInvocation
-- (id)harvestPredictivelyProcessedOutputFiles
-{
-     _outputStream.release;    // expected-warning {{property access result 
unused - getters should not be used for side effects}}
-     return 0;
+void accessMethodViaPropertySyntaxAndTriggerWarning(id<Protocol> object) {
+    object.method; // expected-warning {{property access result unused - 
getters should not be used for side effects}}
 }
-@end
 
 // rdar://19137815
 #pragma clang diagnostic ignored "-Wunused-getter-return-value"
 
-@interface NSObject @end
-
-@interface I : NSObject
-@property (copy) id window;
-@end
-
-@implementation I
-- (void) Meth {
-  [self window];
-  self.window;
+void 
accessMethodViaPropertySyntaxWhenWarningIsIgnoredDoesNotTriggerWarning(id<Protocol>
 object) {
+    object.method;
 }
-@end
 


Index: test/SemaObjC/access-property-getter.m
===================================================================
--- test/SemaObjC/access-property-getter.m
+++ test/SemaObjC/access-property-getter.m
@@ -1,53 +1,17 @@
 // RUN: %clang_cc1 -verify %s
 
-@protocol NSObject
-- (oneway void)release;
+@protocol Protocol
+- (oneway void) method;
 @end
 
-@protocol XCOutputStreams <NSObject>
-@end
-
-
-@interface XCWorkQueueCommandInvocation 
-{
-    id <XCOutputStreams> _outputStream;
-}
-@end
-
-@interface XCWorkQueueCommandSubprocessInvocation : XCWorkQueueCommandInvocation
-@end
-
-@interface XCWorkQueueCommandLocalSubprocessInvocation : XCWorkQueueCommandSubprocessInvocation
-@end
-
-@interface XCWorkQueueCommandDistributedSubprocessInvocation : XCWorkQueueCommandSubprocessInvocation
-@end
-
-@interface XCWorkQueueCommandCacheFetchInvocation : XCWorkQueueCommandSubprocessInvocation
-
-@end
-
-@implementation XCWorkQueueCommandCacheFetchInvocation
-- (id)harvestPredictivelyProcessedOutputFiles
-{
-     _outputStream.release;	// expected-warning {{property access result unused - getters should not be used for side effects}}
-     return 0;
+void accessMethodViaPropertySyntaxAndTriggerWarning(id<Protocol> object) {
+    object.method; // expected-warning {{property access result unused - getters should not be used for side effects}}
 }
-@end
 
 // rdar://19137815
 #pragma clang diagnostic ignored "-Wunused-getter-return-value"
 
-@interface NSObject @end
-
-@interface I : NSObject
-@property (copy) id window;
-@end
-
-@implementation I
-- (void) Meth {
-  [self window];
-  self.window;
+void accessMethodViaPropertySyntaxWhenWarningIsIgnoredDoesNotTriggerWarning(id<Protocol> object) {
+    object.method;
 }
-@end
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to