[cfe-commits] r65084 - /cfe/trunk/lib/Analysis/CFRefCount.cpp
Ted Kremenek
kremenek at apple.com
Thu Feb 19 16:05:36 PST 2009
Author: kremenek
Date: Thu Feb 19 18:05:35 2009
New Revision: 65084
URL: http://llvm.org/viewvc/llvm-project?rev=65084&view=rev
Log:
Fix crash from <rdar://problem/6562655>: 'init' method only return a receiver alias if the return type is a location.
Modified:
cfe/trunk/lib/Analysis/CFRefCount.cpp
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=65084&r1=65083&r2=65084&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Thu Feb 19 18:05:35 2009
@@ -915,8 +915,11 @@
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 @@
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));
More information about the cfe-commits
mailing list