Add special cases to retain checker for 'create' methods in QCView, QCRenderer, and CIContext (Apple APIs).

This fixes:

<rdar://problem/6902710> clang: false positives w/QC and CoreImage methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72187 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index d3f6ffb..30ff67f 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1371,17 +1371,17 @@
                  DecRefMsg));
   
   // The next methods are allocators.
-  RetainSummary* Summ = getPersistentSummary(ObjCAllocRetE);  
+  RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE);  
   
   // Create the "copy" selector.  
-  addNSObjectMethSummary(GetNullarySelector("copy", Ctx), Summ);  
+  addNSObjectMethSummary(GetNullarySelector("copy", Ctx), AllocSumm);  
 
   // Create the "mutableCopy" selector.
-  addNSObjectMethSummary(GetNullarySelector("mutableCopy", Ctx), Summ);
+  addNSObjectMethSummary(GetNullarySelector("mutableCopy", Ctx), AllocSumm);
   
   // Create the "retain" selector.
   RetEffect E = RetEffect::MakeReceiverAlias();
-  Summ = getPersistentSummary(E, IncRefMsg);
+  RetainSummary *Summ = getPersistentSummary(E, IncRefMsg);
   addNSObjectMethSummary(GetNullarySelector("retain", Ctx), Summ);
   
   // Create the "release" selector.
@@ -1449,6 +1449,18 @@
   
   addPanicSummary("NSAssertionHandler", "handleFailureInMethod", "object",
                   "file", "lineNumber", "description", NULL);
+  
+  // Create summaries QCRenderer/QCView -createSnapShotImageOfType:
+  addInstMethSummary("QCRenderer", AllocSumm,
+                     "createSnapshotImageOfType", NULL);
+  addInstMethSummary("QCView", AllocSumm,
+                     "createSnapshotImageOfType", NULL);
+
+  // Create summaries for CIContext, 'createCGImage'.
+  addInstMethSummary("CIContext", AllocSumm,
+                     "createCGImage", "fromRect", NULL);
+  addInstMethSummary("CIContext", AllocSumm,
+                     "createCGImage", "fromRect", "format", "colorSpace", NULL);
 }
 
 //===----------------------------------------------------------------------===//