[PATCH] D12047: test/SemaObjC: Remove cruft in unused getter test

Brian Gesiak via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 14 19:42:20 PDT 2015


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
 
- at protocol NSObject
-- (oneway void)release;
+ at protocol Protocol
+- (oneway void) method;
 @end
 
- at protocol XCOutputStreams <NSObject>
- at end
-
-
- at interface XCWorkQueueCommandInvocation 
-{
-    id <XCOutputStreams> _outputStream;
-}
- at end
-
- at interface XCWorkQueueCommandSubprocessInvocation : XCWorkQueueCommandInvocation
- at end
-
- at interface XCWorkQueueCommandLocalSubprocessInvocation : XCWorkQueueCommandSubprocessInvocation
- at end
-
- at interface XCWorkQueueCommandDistributedSubprocessInvocation : XCWorkQueueCommandSubprocessInvocation
- at end
-
- at interface XCWorkQueueCommandCacheFetchInvocation : XCWorkQueueCommandSubprocessInvocation
-
- at end
-
- at 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}}
 }
- at end
 
 // rdar://19137815
 #pragma clang diagnostic ignored "-Wunused-getter-return-value"
 
- at interface NSObject @end
-
- at interface I : NSObject
- at property (copy) id window;
- at end
-
- at implementation I
-- (void) Meth {
-  [self window];
-  self.window;
+void accessMethodViaPropertySyntaxWhenWarningIsIgnoredDoesNotTriggerWarning(id<Protocol> object) {
+    object.method;
 }
- at end
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12047.32213.patch
Type: text/x-patch
Size: 1738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150815/25b9fd96/attachment.bin>


More information about the cfe-commits mailing list