summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/malloc.mm
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-11-13 03:34:49 +0000
committerAnna Zaks <ganna@apple.com>2012-11-13 03:34:49 +0000
commitde13814a37f37e40c023bd7ec8c8cc50a69b4bae (patch)
treeb7f3fca9451b547fcc77b28f23a98de936b43b36 /clang/test/Analysis/malloc.mm
parent67291b90f9c811045a97eba72a0af75baa028aae (diff)
downloadbcm5719-llvm-de13814a37f37e40c023bd7ec8c8cc50a69b4bae.tar.gz
bcm5719-llvm-de13814a37f37e40c023bd7ec8c8cc50a69b4bae.zip
Add a test that shows that reporting a leak after failure to free is
tricky. llvm-svn: 167814
Diffstat (limited to 'clang/test/Analysis/malloc.mm')
-rw-r--r--clang/test/Analysis/malloc.mm7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/test/Analysis/malloc.mm b/clang/test/Analysis/malloc.mm
index 34b3c334992..99d1de80222 100644
--- a/clang/test/Analysis/malloc.mm
+++ b/clang/test/Analysis/malloc.mm
@@ -245,9 +245,12 @@ void test12365078_no_malloc(unichar *characters) {
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) {
OpenPOWER on IntegriCloud