aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-02-20 00:05:35 +0000
committerTed Kremenek <kremenek@apple.com>2009-02-20 00:05:35 +0000
commitc3cf7b27df5047477c138619d2e8fff179b85a83 (patch)
tree92d9c73830645e415f811a90b2a4cf26b233a248 /lib/Analysis/CFRefCount.cpp
parent92dd386e3f05d176b45a638199d51f536bd9d1c4 (diff)
Fix crash from <rdar://problem/6562655>: 'init' method only return a receiver alias if the return type is a location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 36c1b79af3..8e120afecc 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -915,8 +915,11 @@ RetainSummary*
RetainSummaryManager::getInitMethodSummary(ObjCMessageExpr* ME) {
assert(ScratchArgs.empty());
+ // 'init' methods only return an alias if the return type is a location type.
+ QualType T = ME->getType();
RetainSummary* Summ =
- getPersistentSummary(RetEffect::MakeReceiverAlias());
+ getPersistentSummary(Loc::IsLocType(T) ? RetEffect::MakeReceiverAlias()
+ : RetEffect::MakeNoRet());
ObjCMethodSummaries[ME] = Summ;
return Summ;
@@ -1608,7 +1611,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst,
unsigned Count = Builder.getCurrentBlockCount();
SymbolRef Sym = Eng.getSymbolManager().getConjuredSymbol(Ex, Count);
- SVal X = Loc::IsLocType(Ex->getType())
+ SVal X = Loc::IsLocType(T)
? cast<SVal>(loc::SymbolVal(Sym))
: cast<SVal>(nonloc::SymbolVal(Sym));