r178824 - [analyzer] Updated the testcase.

Anton Yartsev anton.yartsev at gmail.com
Thu Apr 4 17:37:32 PDT 2013


Author: ayartsev
Date: Thu Apr  4 19:37:32 2013
New Revision: 178824

URL: http://llvm.org/viewvc/llvm-project?rev=178824&view=rev
Log:
[analyzer] Updated the testcase.

Missed check added to testMallocFreeNoWarn().
Removed FIXMEs as the current behaviour is considered acceptable now.

Modified:
    cfe/trunk/test/Analysis/NewDelete-intersections.mm

Modified: cfe/trunk/test/Analysis/NewDelete-intersections.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/NewDelete-intersections.mm?rev=178824&r1=178823&r2=178824&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/NewDelete-intersections.mm (original)
+++ cfe/trunk/test/Analysis/NewDelete-intersections.mm Thu Apr  4 19:37:32 2013
@@ -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;  





More information about the cfe-commits mailing list