summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-06-05 23:18:01 +0000
committerTed Kremenek <kremenek@apple.com>2009-06-05 23:18:01 +0000
commita03705c82d4a60a981ed4fb89757322234565473 (patch)
treef23f0069819c420182494dba6798845feb6e7120 /clang/lib/Analysis/CFRefCount.cpp
parentafa8a1592facce213d16c96af82a9f1c35516d2b (diff)
downloadbcm5719-llvm-a03705c82d4a60a981ed4fb89757322234565473.tar.gz
bcm5719-llvm-a03705c82d4a60a981ed4fb89757322234565473.zip
Fix:
<rdar://problem/6948053> False positive: object substitution during -init* methods warns about returning +0 when using -fobjc-gc-only llvm-svn: 72971
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index 56ab0eb4f6e..532d16da0f0 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/lib/Analysis/CFRefCount.cpp
@@ -636,7 +636,11 @@ class VISIBILITY_HIDDEN RetainSummaryManager {
/// 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 @@ public:
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 @@ RetainSummaryManager::getInitMethodSummary(QualType RetTy) {
// '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 @@ void RetainSummaryManager::InitializeMethodSummaries() {
// 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);
OpenPOWER on IntegriCloud