Fix:

<rdar://problem/6948053> False positive: object substitution during -init* methods warns about returning +0 when using -fobjc-gc-only



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72971 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 56ab0eb..532d16d 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -636,7 +636,11 @@
   /// ObjCAllocRetE - Default return effect for methods returning Objective-C
   ///  objects.
   RetEffect ObjCAllocRetE;
-  
+
+	/// ObjCInitRetE - Default return effect for init methods returning Objective-C
+  ///  objects.
+  RetEffect ObjCInitRetE;
+	
   RetainSummary DefaultSummary;
   RetainSummary* StopSummary;
   
@@ -776,6 +780,8 @@
      GCEnabled(gcenabled), AF(BPAlloc), ScratchArgs(AF.GetEmptyMap()),
      ObjCAllocRetE(gcenabled ? RetEffect::MakeGCNotOwned()
                              : RetEffect::MakeOwned(RetEffect::ObjC, true)),
+		 ObjCInitRetE(gcenabled ? RetEffect::MakeGCNotOwned()
+														:	RetEffect::MakeOwnedWhenTrackedReceiver()),
      DefaultSummary(AF.GetEmptyMap() /* per-argument effects (none) */,
                     RetEffect::MakeNoRet() /* return effect */,
                     MayEscape, /* default argument effect */
@@ -1156,8 +1162,7 @@
   // 'init' methods conceptually return a newly allocated object and claim
   // the receiver.  
   if (isTrackedObjCObjectType(RetTy) || isTrackedCFObjectType(RetTy))
-    return getPersistentSummary(RetEffect::MakeOwnedWhenTrackedReceiver(),
-                                DecRefMsg);
+    return getPersistentSummary(ObjCInitRetE, DecRefMsg);
   
   return getDefaultSummary();
 }
@@ -1374,8 +1379,7 @@
   // Create the "init" selector.  It just acts as a pass-through for the
   // receiver.
   addNSObjectMethSummary(GetNullarySelector("init", Ctx),
-                 getPersistentSummary(RetEffect::MakeOwnedWhenTrackedReceiver(),
-                 DecRefMsg));
+												 getPersistentSummary(ObjCInitRetE, DecRefMsg));
   
   // The next methods are allocators.
   RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE);