Author: kremenek
Date: Thu Sep  6 18:47:02 2012
New Revision: 163362

URL: http://llvm.org/viewvc/llvm-project?rev=163362&view=rev
Log:
Teach RetainCountChecker that CFPlugInInstanceCreate  does not
return a CF object at all.

Fixes <rdar://problem/9566345>

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
    cfe/trunk/test/Analysis/retain-release.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=163362&r1=163361&r2=163362&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Thu Sep  6 
18:47:02 2012
@@ -1074,6 +1074,8 @@
       // The headers on OS X 10.8 use cf_consumed/ns_returns_retained,
       // but we can fully model NSMakeCollectable ourselves.
       AllowAnnotations = false;
+    } else if (FName == "CFPlugInInstanceCreate") {
+      S = getPersistentSummary(RetEffect::MakeNoRet());
     } else if (FName == "IOBSDNameMatching" ||
                FName == "IOServiceMatching" ||
                FName == "IOServiceNameMatching" ||

Modified: cfe/trunk/test/Analysis/retain-release.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=163362&r1=163361&r2=163362&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Thu Sep  6 18:47:02 2012
@@ -303,6 +303,10 @@
 // This is how NSMakeCollectable is declared in the OS X 10.8 headers.
 id NSMakeCollectable(CFTypeRef __attribute__((cf_consumed))) 
__attribute__((ns_returns_retained));
 
+typedef const struct __CFUUID * CFUUIDRef;
+
+extern
+void *CFPlugInInstanceCreate(CFAllocatorRef allocator, CFUUIDRef factoryUUID, 
CFUUIDRef typeUUID);
 
 
//===----------------------------------------------------------------------===//
 // Test cases.
@@ -1907,3 +1911,11 @@
   MyCFType x = CreateMyCFType(); // expected-warning {{leak of an object 
stored into 'x'}}
 }
 
+//===----------------------------------------------------------------------===//
+// Test calling CFPlugInInstanceCreate, which appears in CF but doesn't
+// return a CF object.
+//===----------------------------------------------------------------------===//
+
+void test_CFPlugInInstanceCreate(CFUUIDRef factoryUUID, CFUUIDRef typeUUID) {
+  CFPlugInInstanceCreate(kCFAllocatorDefault, factoryUUID, typeUUID); // 
no-warning
+}


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to