Fix crash from <rdar://problem/6562655>: 'init' method only return a receiver alias if the return type is a location.

llvm-svn: 65084
This commit is contained in:
Ted Kremenek 2009-02-20 00:05:35 +00:00
parent cf868c458c
commit c537a6d3f1
1 changed files with 5 additions and 2 deletions

View File

@ -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));