]> granicus.if.org Git - clang/commitdiff
retain/release checker: CGBitmapContextCreateWithData() returns an owned object.
authorTed Kremenek <kremenek@apple.com>
Tue, 3 Nov 2009 05:39:12 +0000 (05:39 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 3 Nov 2009 05:39:12 +0000 (05:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85867 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFRefCount.cpp
test/Analysis/retain-release.m

index 120d422d374aa1052ea6a69fce9dd067aae624e0..853b5823b7bbaba3e92e8d4f765b335b0fd7f318 100644 (file)
@@ -1031,6 +1031,8 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) {
           // 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 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) {
           // 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;
 
index 19ea5ed1c93c2248bf2cba151193e0f9737f78a9..879e8a0413b4639859823a7f82d010c74321c137 100644 (file)
@@ -1119,7 +1119,7 @@ void rdar_7358899(void *data,
     // 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);
 }