Add summary lookup for IOServiceGetMatchingService.
Convert tabs to spaces. llvm-svn: 73198
This commit is contained in:
parent
a74ead4103
commit
ea675cf6a3
|
@ -637,10 +637,10 @@ class VISIBILITY_HIDDEN RetainSummaryManager {
|
||||||
/// objects.
|
/// objects.
|
||||||
RetEffect ObjCAllocRetE;
|
RetEffect ObjCAllocRetE;
|
||||||
|
|
||||||
/// ObjCInitRetE - Default return effect for init methods returning Objective-C
|
/// ObjCInitRetE - Default return effect for init methods returning Objective-C
|
||||||
/// objects.
|
/// objects.
|
||||||
RetEffect ObjCInitRetE;
|
RetEffect ObjCInitRetE;
|
||||||
|
|
||||||
RetainSummary DefaultSummary;
|
RetainSummary DefaultSummary;
|
||||||
RetainSummary* StopSummary;
|
RetainSummary* StopSummary;
|
||||||
|
|
||||||
|
@ -780,8 +780,8 @@ public:
|
||||||
GCEnabled(gcenabled), AF(BPAlloc), ScratchArgs(AF.GetEmptyMap()),
|
GCEnabled(gcenabled), AF(BPAlloc), ScratchArgs(AF.GetEmptyMap()),
|
||||||
ObjCAllocRetE(gcenabled ? RetEffect::MakeGCNotOwned()
|
ObjCAllocRetE(gcenabled ? RetEffect::MakeGCNotOwned()
|
||||||
: RetEffect::MakeOwned(RetEffect::ObjC, true)),
|
: RetEffect::MakeOwned(RetEffect::ObjC, true)),
|
||||||
ObjCInitRetE(gcenabled ? RetEffect::MakeGCNotOwned()
|
ObjCInitRetE(gcenabled ? RetEffect::MakeGCNotOwned()
|
||||||
: RetEffect::MakeOwnedWhenTrackedReceiver()),
|
: RetEffect::MakeOwnedWhenTrackedReceiver()),
|
||||||
DefaultSummary(AF.GetEmptyMap() /* per-argument effects (none) */,
|
DefaultSummary(AF.GetEmptyMap() /* per-argument effects (none) */,
|
||||||
RetEffect::MakeNoRet() /* return effect */,
|
RetEffect::MakeNoRet() /* return effect */,
|
||||||
MayEscape, /* default argument effect */
|
MayEscape, /* default argument effect */
|
||||||
|
@ -971,31 +971,42 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) {
|
||||||
|
|
||||||
// FIXME: This should all be refactored into a chain of "summary lookup"
|
// FIXME: This should all be refactored into a chain of "summary lookup"
|
||||||
// filters.
|
// filters.
|
||||||
switch (strlen(FName)) {
|
switch (strlen(FName)) {
|
||||||
default: break;
|
default: break;
|
||||||
case 17:
|
case 17:
|
||||||
// Handle: id NSMakeCollectable(CFTypeRef)
|
// Handle: id NSMakeCollectable(CFTypeRef)
|
||||||
if (!memcmp(FName, "NSMakeCollectable", 17)) {
|
if (!memcmp(FName, "NSMakeCollectable", 17)) {
|
||||||
S = (RetTy == Ctx.getObjCIdType())
|
S = (RetTy == Ctx.getObjCIdType())
|
||||||
? getUnarySummary(FT, cfmakecollectable)
|
? getUnarySummary(FT, cfmakecollectable)
|
||||||
: getPersistentStopSummary();
|
: getPersistentStopSummary();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28:
|
|
||||||
if (!memcmp(FName, "IOServiceGetMatchingServices", 28)) {
|
case 27:
|
||||||
// FIXES: <rdar://problem/6326900>
|
if (!memcmp(FName, "IOServiceGetMatchingService", 27)) {
|
||||||
// This should be addressed using a API table. This strcmp is also
|
// Part of <rdar://problem/6961230>.
|
||||||
// a little gross, but there is no need to super optimize here.
|
// This should be addressed using a API table.
|
||||||
assert (ScratchArgs.isEmpty());
|
assert (ScratchArgs.isEmpty());
|
||||||
ScratchArgs = AF.Add(ScratchArgs, 1, DecRef);
|
ScratchArgs = AF.Add(ScratchArgs, 1, DecRef);
|
||||||
S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);
|
S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
case 28:
|
||||||
// Did we get a summary?
|
if (!memcmp(FName, "IOServiceGetMatchingServices", 28)) {
|
||||||
if (S)
|
// FIXES: <rdar://problem/6326900>
|
||||||
break;
|
// This should be addressed using a API table. This strcmp is also
|
||||||
|
// a little gross, but there is no need to super optimize here.
|
||||||
|
assert (ScratchArgs.isEmpty());
|
||||||
|
ScratchArgs = AF.Add(ScratchArgs, 1, DecRef);
|
||||||
|
S = getPersistentSummary(RetEffect::MakeNoRet(), DoNothing, DoNothing);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Did we get a summary?
|
||||||
|
if (S)
|
||||||
|
break;
|
||||||
|
|
||||||
// Enable this code once the semantics of NSDeallocateObject are resolved
|
// Enable this code once the semantics of NSDeallocateObject are resolved
|
||||||
// for GC. <rdar://problem/6619988>
|
// for GC. <rdar://problem/6619988>
|
||||||
|
@ -1180,19 +1191,19 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ,
|
||||||
if (!FD)
|
if (!FD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QualType RetTy = FD->getResultType();
|
QualType RetTy = FD->getResultType();
|
||||||
|
|
||||||
// Determine if there is a special return effect for this method.
|
// Determine if there is a special return effect for this method.
|
||||||
if (isTrackedObjCObjectType(RetTy)) {
|
if (isTrackedObjCObjectType(RetTy)) {
|
||||||
if (FD->getAttr<NSReturnsRetainedAttr>()) {
|
if (FD->getAttr<NSReturnsRetainedAttr>()) {
|
||||||
Summ.setRetEffect(ObjCAllocRetE);
|
Summ.setRetEffect(ObjCAllocRetE);
|
||||||
}
|
}
|
||||||
else if (FD->getAttr<CFReturnsRetainedAttr>()) {
|
else if (FD->getAttr<CFReturnsRetainedAttr>()) {
|
||||||
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
|
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (RetTy->getAsPointerType()) {
|
else if (RetTy->getAsPointerType()) {
|
||||||
if (FD->getAttr<CFReturnsRetainedAttr>()) {
|
if (FD->getAttr<CFReturnsRetainedAttr>()) {
|
||||||
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
|
Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1386,7 +1397,7 @@ void RetainSummaryManager::InitializeMethodSummaries() {
|
||||||
// Create the "init" selector. It just acts as a pass-through for the
|
// Create the "init" selector. It just acts as a pass-through for the
|
||||||
// receiver.
|
// receiver.
|
||||||
addNSObjectMethSummary(GetNullarySelector("init", Ctx),
|
addNSObjectMethSummary(GetNullarySelector("init", Ctx),
|
||||||
getPersistentSummary(ObjCInitRetE, DecRefMsg));
|
getPersistentSummary(ObjCInitRetE, DecRefMsg));
|
||||||
|
|
||||||
// The next methods are allocators.
|
// The next methods are allocators.
|
||||||
RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE);
|
RetainSummary *AllocSumm = getPersistentSummary(ObjCAllocRetE);
|
||||||
|
|
Loading…
Reference in New Issue