]> granicus.if.org Git - clang/commitdiff
Add test case for <rdar://problem/8356342>.
authorTed Kremenek <kremenek@apple.com>
Thu, 28 Oct 2010 02:50:32 +0000 (02:50 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 28 Oct 2010 02:50:32 +0000 (02:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117525 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/retain-release.m

index 064165aaf9e1e34c7e83328ba1931eadaeee33bc..c9760de2bb28f60743f361ee416e240dd15b94cd 100644 (file)
@@ -1367,3 +1367,22 @@ void r8272168() {
   GetAClassThatImplementsProt_R8272168();
 }
 
+// Test case for <rdar://problem/8356342>, which in the past triggered
+// a false positive.
+@interface RDar8356342
+- (NSDate*) rdar8356342:(NSDate *)inValue;
+@end
+
+@implementation RDar8356342
+- (NSDate*) rdar8356342:(NSDate*)inValue {
+  NSDate *outValue = inValue;
+  if (outValue == 0)
+    outValue = [[NSDate alloc] init]; // no-warning
+
+  if (outValue != inValue)
+    [outValue autorelease];
+
+  return outValue;
+}
+@end
+