typedef MapTy::iterator iterator;
+ iterator find(ObjCInterfaceDecl* D, IdentifierInfo *ClsName, Selector S) {
+ // Lookup the method using the decl for the class @interface. If we
+ // have no decl, lookup using the class name.
+ return D ? find(D, S) : find(ClsName, S);
+ }
+
iterator find(ObjCInterfaceDecl* D, Selector S) {
// Do a lookup with the (D,S) pair. If we find a match return
return getPersistentSummary(getArgEffects(), RE, ReceiverEff, DefaultEff);
}
- RetainSummary* getPersistentStopSummary() {
+ RetainSummary *getPersistentStopSummary() {
if (StopSummary)
return StopSummary;
return StopSummary;
}
- RetainSummary* getInitMethodSummary(ObjCMessageExpr* ME);
+ RetainSummary *getInitMethodSummary(QualType RetTy);
void InitializeClassMethodSummaries();
void InitializeMethodSummaries();
~RetainSummaryManager();
RetainSummary* getSummary(FunctionDecl* FD);
- RetainSummary* getMethodSummary(ObjCMessageExpr* ME, ObjCInterfaceDecl* ID);
+
+ RetainSummary* getMethodSummary(ObjCMessageExpr* ME, ObjCInterfaceDecl* ID) {
+ return getMethodSummary(ME->getSelector(), ME->getClassName(),
+ ID, ME->getMethodDecl(), ME->getType());
+ }
+
+ RetainSummary* getMethodSummary(Selector S, IdentifierInfo *ClsName,
+ ObjCInterfaceDecl* ID,
+ ObjCMethodDecl *MD, QualType RetTy);
RetainSummary *getClassMethodSummary(Selector S, IdentifierInfo *ClsName,
ObjCInterfaceDecl *ID,
//===----------------------------------------------------------------------===//
RetainSummary*
-RetainSummaryManager::getInitMethodSummary(ObjCMessageExpr* ME) {
+RetainSummaryManager::getInitMethodSummary(QualType RetTy) {
assert(ScratchArgs.empty());
// 'init' methods only return an alias if the return type is a location type.
- QualType T = ME->getType();
- RetainSummary* Summ =
- getPersistentSummary(Loc::IsLocType(T) ? RetEffect::MakeReceiverAlias()
- : RetEffect::MakeNoRet());
-
- ObjCMethodSummaries[ME] = Summ;
- return Summ;
+ return getPersistentSummary(Loc::IsLocType(RetTy)
+ ? RetEffect::MakeReceiverAlias()
+ : RetEffect::MakeNoRet());
}
RetainSummary*
}
RetainSummary*
-RetainSummaryManager::getMethodSummary(ObjCMessageExpr* ME,
- ObjCInterfaceDecl* ID) {
+RetainSummaryManager::getMethodSummary(Selector S, IdentifierInfo *ClsName,
+ ObjCInterfaceDecl* ID,
+ ObjCMethodDecl *MD, QualType RetTy) {
- Selector S = ME->getSelector();
-
- // Look up a summary in our summary cache.
- ObjCMethodSummariesTy::iterator I = ObjCMethodSummaries.find(ID, S);
+ // Look up a summary in our summary cache.
+ ObjCMethodSummariesTy::iterator I = ObjCMethodSummaries.find(ID, ClsName, S);
if (I != ObjCMethodSummaries.end())
return I->second;
// Annotations take precedence over all other ways to derive
// summaries.
- RetainSummary *Summ = getMethodSummaryFromAnnotations(ME->getMethodDecl());
+ RetainSummary *Summ = getMethodSummaryFromAnnotations(MD);
if (!Summ) {
// "initXXX": pass-through for receiver.
if (deriveNamingConvention(S.getIdentifierInfoForSlot(0)->getName())
== InitRule)
- return getInitMethodSummary(ME);
-
- Summ = getCommonMethodSummary(ME->getMethodDecl(), S, ME->getType());
+ Summ = getInitMethodSummary(RetTy);
+ else
+ Summ = getCommonMethodSummary(MD, S, RetTy);
}
- ObjCMethodSummaries[ME] = Summ;
+ ObjCMethodSummaries[ObjCSummaryKey(ClsName, S)] = Summ;
return Summ;
}
ObjCMethodDecl *MD, QualType RetTy){
assert(ClsName && "Class name must be specified.");
- ObjCMethodSummariesTy::iterator I;
-
- if (ID) {
- // Lookup the method using the decl for the class @interface.
- I = ObjCClassMethodSummaries.find(ID, S);
- }
- else {
- // Fallback to using the class name.
- // Look up a summary in our cache of Selectors -> Summaries.
- I = ObjCClassMethodSummaries.find(ClsName, S);
- }
+ ObjCMethodSummariesTy::iterator I =
+ ObjCClassMethodSummaries.find(ID, ClsName, S);
if (I != ObjCClassMethodSummaries.end())
return I->second;
// FIXME: Wouldn't it be great if this code could be reduced? It's just
// a chain of lookups.
+ // FIXME: Is this really working as expected? There are cases where
+ // we just use the 'ID' from the message expression.
const GRState* St = Builder.GetState(Pred);
SVal V = Eng.getStateManager().GetSValAsScalarOrLoc(St, Receiver);