aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
authorAnton Yartsev <anton.yartsev@gmail.com>2013-04-05 00:37:32 +0000
committerAnton Yartsev <anton.yartsev@gmail.com>2013-04-05 00:37:32 +0000
commit6e22712b73ce5f0361355c9f2d0fa81b56722cd8 (patch)
tree1d4918bf8b9f4999b19abdf1536fe45550a0c950 /test/Analysis
parent9c6bbb3492cc34df1eed1e151c94935846edc17f (diff)
[analyzer] Updated the testcase.
Missed check added to testMallocFreeNoWarn(). Removed FIXMEs as the current behaviour is considered acceptable now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/NewDelete-intersections.mm9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/Analysis/NewDelete-intersections.mm b/test/Analysis/NewDelete-intersections.mm
index ca588f5c05..3a87e4f3f1 100644
--- a/test/Analysis/NewDelete-intersections.mm
+++ b/test/Analysis/NewDelete-intersections.mm
@@ -11,7 +11,7 @@ extern "C" void free(void *);
// checkers bounded with cplusplus.NewDelete.
//----------------------------------------------------------------------------
-// malloc()/free() are subjects of unix.Malloc and unix.MallocWithAnnotations
+//----- malloc()/free() are subjects of unix.Malloc and unix.MallocWithAnnotations
void testMallocFreeNoWarn() {
int i;
free(&i); // no warn
@@ -24,6 +24,10 @@ void testMallocFreeNoWarn() {
free(p2); // no warn
int *p3 = (int *)malloc(sizeof(int)); // no warn
+
+ int *p4 = (int *)malloc(sizeof(int));
+ free(p4);
+ int j = *p4; // no warn
}
void testDeleteMalloced() {
@@ -36,19 +40,16 @@ void testFreeOpNew() {
void *p = operator new(0);
free(p);
} // expected-warning{{Memory is never released; potential leak}}
-// FIXME: Pointer should escape
void testFreeNewExpr() {
int *p = new int;
free(p);
} // expected-warning{{Memory is never released; potential leak}}
-// FIXME: Pointer should escape
void testObjcFreeNewed() {
int *p = new int;
NSData *nsdata = [NSData dataWithBytesNoCopy:p length:sizeof(int) freeWhenDone:1]; // expected-warning{{Memory is never released; potential leak}}
}
-// FIXME: Pointer should escape
void testFreeAfterDelete() {
int *p = new int;