} else if(FName == "NSMakeCollectable") {
// Handle: id NSMakeCollectable(CFTypeRef)
AllowAnnotations = false;
- return RetTy->isObjCIdType() ? getUnarySummary(FT, cfmakecollectable)
+ return RetTy->isObjCIdType() ? getUnarySummary(FT, DoNothing)
: getPersistentStopSummary();
} else if (FName == "CMBufferQueueDequeueAndRetain" ||
FName == "CMBufferQueueDequeueIfDataReadyAndRetain") {
// We want to ignore such annotation.
AllowAnnotations = false;
- return getUnarySummary(FT, cfretain);
+ return getUnarySummary(FT, IncRef);
} else if (isAutorelease(FD, FName)) {
// The headers use cf_consumed, but we can fully model CFAutorelease
// ourselves.
AllowAnnotations = false;
- return getUnarySummary(FT, cfautorelease);
+ return getUnarySummary(FT, Autorelease);
} else if (isMakeCollectable(FName)) {
AllowAnnotations = false;
- return getUnarySummary(FT, cfmakecollectable);
+ return getUnarySummary(FT, DoNothing);
} else {
return getCFCreateGetRuleSummary(FD);
}
if (cocoa::isRefType(RetTy, "CG", FName) ||
cocoa::isRefType(RetTy, "CV", FName)) {
if (isRetain(FD, FName))
- return getUnarySummary(FT, cfretain);
+ return getUnarySummary(FT, IncRef);
else
return getCFCreateGetRuleSummary(FD);
}
FName = FName.substr(FName.startswith("CGCF") ? 4 : 2);
if (isRelease(FD, FName))
- return getUnarySummary(FT, cfrelease);
+ return getUnarySummary(FT, DecRef);
else {
assert(ScratchArgs.isEmpty());
// Remaining CoreFoundation and CoreGraphics functions.
return None;
}
-// TODO: UnaryFuncKind is a very funny enum, it really should not exist:
-// just pass the needed effect directly!
const RetainSummary *
RetainSummaryManager::getUnarySummary(const FunctionType* FT,
- UnaryFuncKind func) {
+ ArgEffectKind AE) {
// Unary functions have no arg effects by definition.
ArgEffects ScratchArgs(AF.getEmptyMap());
if (!FTP || FTP->getNumParams() != 1)
return getPersistentStopSummary();
- ArgEffect Effect(DoNothing, ObjKind::CF);
- switch (func) {
- case cfretain: Effect = Effect.withKind(IncRef); break;
- case cfrelease: Effect = Effect.withKind(DecRef); break;
- case cfautorelease: Effect = Effect.withKind(Autorelease); break;
- case cfmakecollectable: Effect = Effect.withKind(DoNothing); break;
- }
+ ArgEffect Effect(AE, ObjKind::CF);
ScratchArgs = AF.add(ScratchArgs, 0, Effect);
return getPersistentSummary(RetEffect::MakeNoRet(),