[cfe-commits] r85867 - in /cfe/trunk: lib/Analysis/CFRefCount.cpp test/Analysis/retain-release.m

Ted Kremenek kremenek at apple.com
Mon Nov 2 21:39:13 PST 2009


Author: kremenek
Date: Mon Nov  2 23:39:12 2009
New Revision: 85867

URL: http://llvm.org/viewvc/llvm-project?rev=85867&view=rev
Log:
retain/release checker: CGBitmapContextCreateWithData() returns an owned object.

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp
    cfe/trunk/test/Analysis/retain-release.m

Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=85867&r1=85866&r2=85867&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Mon Nov  2 23:39:12 2009
@@ -1031,6 +1031,8 @@
           // Eventually this can be improved by recognizing that the pixel
           // buffer passed to CVPixelBufferCreateWithBytes is released via
           // a callback and doing full IPA to make sure this is done correctly.
+          // FIXME: This function has an out parameter that returns an
+          // allocated object.
           ScratchArgs = AF.Add(ScratchArgs, 7, StopTracking);
           S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing,
                                    DoNothing);
@@ -1044,7 +1046,8 @@
           // passed to CGBitmapContextCreateWithData is released via
           // a callback and doing full IPA to make sure this is done correctly.
           ScratchArgs = AF.Add(ScratchArgs, 8, StopTracking);
-          S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing,DoNothing);          
+          S = getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF, true),
+                                   DoNothing,DoNothing);          
         }
         break;
 

Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=85867&r1=85866&r2=85867&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Mon Nov  2 23:39:12 2009
@@ -1119,7 +1119,7 @@
     // this is freed later by the callback.
     NSNumber *number = [[NSNumber alloc] initWithInt:5]; // no-warning
 
-  CGBitmapContextCreateWithData(data, width, height, bitsPerComponent,
+  CGBitmapContextCreateWithData(data, width, height, bitsPerComponent, // expected-warning{{leak}}
     bytesPerRow, space, bitmapInfo, releaseCallback, number);
 }
 





More information about the cfe-commits mailing list