[cfe-commits] r167814 - /cfe/trunk/test/Analysis/malloc.mm

Anna Zaks ganna at apple.com
Mon Nov 12 19:34:49 PST 2012


Author: zaks
Date: Mon Nov 12 21:34:49 2012
New Revision: 167814

URL: http://llvm.org/viewvc/llvm-project?rev=167814&view=rev
Log:
Add a test that shows that reporting a leak after failure to free is
tricky.

Modified:
    cfe/trunk/test/Analysis/malloc.mm

Modified: cfe/trunk/test/Analysis/malloc.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc.mm?rev=167814&r1=167813&r2=167814&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc.mm (original)
+++ cfe/trunk/test/Analysis/malloc.mm Mon Nov 12 21:34:49 2012
@@ -245,9 +245,12 @@
   if (!string) {free(characters);}
 }
 
-void test12365078_false_negative_no_malloc(unichar *characters) {
+NSString *test12365078_no_malloc_returnValue(unichar *characters) {
   NSString *string = [[NSString alloc] initWithCharactersNoCopy:characters length:12 freeWhenDone:1];
-  if (!string) {;}
+  if (!string) {
+    return 0; // no-warning
+  }
+  return string;
 }
 
 void test12365078_nocheck_nomalloc(unichar *characters) {





More information about the cfe-commits mailing list